https://github.com/codeyellowbv/jsdom-test
Run given html file through jsdom to run unit tests and report the output of the tests.
https://github.com/codeyellowbv/jsdom-test
Last synced: 10 months ago
JSON representation
Run given html file through jsdom to run unit tests and report the output of the tests.
- Host: GitHub
- URL: https://github.com/codeyellowbv/jsdom-test
- Owner: CodeYellowBV
- Created: 2015-08-29T13:01:55.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-08-29T13:44:50.000Z (almost 11 years ago)
- Last Synced: 2025-07-03T17:53:52.394Z (12 months ago)
- Language: JavaScript
- Size: 125 KB
- Stars: 0
- Watchers: 15
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# jsdom-test
This is a simple CLI wrapper around jsdom. It runs the html file you feed it. This file should run your unit tests. If one or more tests fail, it will stop with exit code `1`.
To be able to know when your tests are finished, you should create a callback `window.onMochaTestFinish`. It accepts one parameter; the failed test count.
Here is an example of this in Mocha:
```js
var failedCount = 0;
afterEach(function() {
if (this.currentTest.state === 'failed') {
failedCount++;
}
});
afterAll(function(done) {
if (_.isFunction(window.onMochaTestFinish)) {
window.onMochaTestFinish(failedCount);
}
done();
});
```
## Usage
```
jsdom-test dist/test.html
```