jsdom-runner

0.0.3 • Public • Published

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-runner

API

var runner = require('jsdom-runner')

runner(pageOptions, jsdomOptions)

Returns a writable stream. Pipe your js code into it.

  • pageOptions: options for create-html module, documentation is here
  • jsdomOptions: options for jsdom instance, documentation is here

Install

npm install -g jsdom-runner

But --save-dev option should suffice!

Similar projects

Package Sidebar

Install

npm i jsdom-runner

Weekly Downloads

1

Version

0.0.3

License

MIT

Last publish

Collaborators

  • krazylek