0.0.3 • Published 9 years ago
@olegjs/jsdom-sync v0.0.3
jsdom-sync
Synchronous script execution in jsdom. Made for unit tests.
By default all script in jsdom are executed in parallel. In some cases, like
unit testing, simplicity is more important than performance. This is a wrapper
around jsdom that feeds all script code as inline script tags, ensuring
sequential execution.
const jsdomSync = require('jsdom-sync')
const document = jsdomSync(['a.js', 'b.js'])
const window = document.defaultView
// do stuff
window.close()Notes
- All files included in
scripttags insidehead; useDOMContentLoadedevent. - If you need speed from jsdom, use the callbacks or promises instead.