0.0.3 • Published 8 years ago
jsdom-runner v0.0.3
jsdom-runner
run browser tests or scripts within an emulated DOM
Usage
This library is intended to run any script from NodeJs inside an emulated DOM provided by jsdom.
Script is read from standard input and results are displayed to standard output or standard error by connecting the jsdom console to NodeJs console.
For example Tape results are directed to stdout. Any test library or script writing to the console should work.
Example
test.js:
var test = require('tape');
test('demo', function (t) {
t.equal(1+1, 2)
t.end()
})Then build it and run the test:
browserify test.js | jsdom-runnerAPI
var runner = require('jsdom-runner')runner(pageOptions, jsdomOptions)
Returns a writable stream. Pipe your js code into it.
pageOptions: options forcreate-htmlmodule, documentation is herejsdomOptions: options for jsdom instance, documentation is here
Install
npm install -g jsdom-runnerBut --save-dev option should suffice!
Similar projects
- https://github.com/substack/testling (tests with the browser installed on your system)
- https://github.com/shama/testron (tests with Electron)
- https://github.com/rstacruz/jsdom-global (different approach, injects the DOM into the test)