simov / loca Goto Github PK
View Code? Open in Web Editor NEWWebKit reporter for Mocha
License: MIT License
WebKit reporter for Mocha
License: MIT License
Thanks for this awesome reporter!
Would be possible to add an option to only expand test groups in case one fail?
I use this loca
with mocha
and node-webkit
. I found an example (https://github.com/visionmedia/mocha/wiki/Using-mocha-with-node-webkit) how to test web-kit
applications with mocha
.
config.js
// show the dev tools by default
require('nw.gui').Window.get().showDevTools().resizeTo(800, 1000);
$(function () {
// programatically
var Mocha = require('mocha'),
fs = require('fs'),
path = require('path');
// First, you need to instantiate a Mocha instance.
var mocha = new Mocha;
mocha.reporter('loca');
// pass the browser context
mocha.suite.emit('pre-require', window, null, mocha);
// Then, append your tests
// Here is an example:
fs.readdirSync('test').filter(function (file) {
// Only keep the .js files
return file.substr(-3) === '.js';
}).forEach(function (file) {
// Instead of using mocha's "addFile"
$('head').append('<script src="'+path.join('test', file)+'"></script>');
});
// Now, you can run the tests.
mocha.run(function (failures) {
process.on('exit', function () {
process.exit(failures);
});
});
});
test.js
var assert = require('chai').assert;
describe('Functions', function(){
describe('myFunction', function(){
it('should return vale one multiplied by value two', function(){
assert.equal(1, myFunction(1, 1));
assert.equal(64, myFunction(8, 8));
})
})
})
If I run this, the tests will run but loca
will cause the error Uncaught Error: write EPIPE
Functions C:\Users\Liebig\AppData\Local\Temp\nw8764_9618\node_modules\loca\webkit.js:49
Uncaught Error: write EPIPE events.js:82
myFunction C:\Users\Liebig\AppData\Local\Temp\nw8764_9618\node_modules\loca\webkit.js:49
โ should return vale one multiplied by value two C:\Users\Liebig\AppData\Local\Temp\nw8764_9618\node_modules\loca\webkit.js:63
duration: 26.000ms C:\Users\Liebig\AppData\Local\Temp\nw8764_9618\node_modules\loca\webkit.js:83
1 passing C:\Users\Liebig\AppData\Local\Temp\nw8764_9618\node_modules\loca\webkit.js:86
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.