0.0.3 • Published 7 years ago

jsdom-runner v0.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

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

0.0.3

7 years ago

0.0.2

7 years ago