You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Luke Childs 388c728eeb 1.0.2 9 years ago
src Invoke strict mode 9 years ago
test Add test for return value 9 years ago
.gitignore Add travis and coveralls integration 9 years ago
.travis.yml Add travis and coveralls integration 9 years ago
README.md Fix typo 9 years ago
package.json 1.0.2 9 years ago

README.md

node-browser-environment Build Status Coverage Status

Simulates a global browser environment using jsdom.

This allows you to run browser modules in node with minimal or no effort. Can also be used to test browser modules with any node test framework. Please note, only the DOM is simulated, if you want to run a module that requires more advanced browser features (like localStorage), you'll need to polyfill that seperately.

Warning

This module adds a lot of stuff to the global namespace, use with care.

Install

npm install --save node-browser-environment

Usage

// Setup global browser environment
require('node-browser-environment')();

// or if you're using ES6 modules
import browserEnv from 'node-browser-environment';
browserEnv();

// Now you have access to a browser like environment:

typeof document;
// 'object'

typeof window;
// 'object'

var div = document.createElement('div');
// HTMLDivElement

div instanceof HTMLElement
// true

License

MIT © Luke Childs