https://github.com/simov/loca
WebKit reporter for Mocha
https://github.com/simov/loca
Last synced: 6 months ago
JSON representation
WebKit reporter for Mocha
- Host: GitHub
- URL: https://github.com/simov/loca
- Owner: simov
- License: mit
- Created: 2014-06-17T09:08:15.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2017-06-02T15:40:14.000Z (over 8 years ago)
- Last Synced: 2025-04-10T11:04:08.845Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 109 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# loca
![Loca][4]
## browser
### [live demo][3]
### example
```js
var should = chai.should();
// mocha.reporter('webkit'); // in case this got merged in
mocha.reporter(mocha.WebKit);
mocha.setup({
ui: 'bdd',
globals: ['']
});
describe('test suite', function () {
it('...', function () {});
});
mocha.run();
```
## node-webkit
### run
```bash
$ cd reporter/nw/
$ nw .
```
### example
```html
Node WebKit Mocha Reporter
// show the dev tools by default
require('nw.gui').Window.get().showDevTools().resizeTo(800, 1000);
// programatically
var should = require('should');
var Mocha = require('mocha'),
fs = require('fs'),
path = require('path');
// First, you need to instantiate a Mocha instance.
var mocha = new Mocha;
// mocha.reporter('webkit'); // in case this got merged in
mocha.reporter(require('loca'));
// Then, you need to use the method "addFile" on the mocha
// object for each file.
// Here is an example:
fs.readdirSync('test').filter(function (file) {
// Only keep the .js files
return file.substr(-3) === '.js';
}).forEach(function (file) {
// Use the method "addFile" to add the file to mocha
mocha.addFile(
path.join('test', file)
);
});
// Now, you can run the tests.
mocha.run(function (failures) {
process.on('exit', function () {
process.exit(failures);
});
});
```
## more info
- [mocha original issue][2]
- [mocha pull request][1]
## license
MIT
[1]: https://github.com/visionmedia/mocha/pull/1246
[2]: https://github.com/visionmedia/mocha/issues/960#issuecomment-46750530
[3]: http://simov.github.io/loca/reporter/browser/
[4]: http://i.imgur.com/dFvQRtE.png