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
script
tags insidehead
; useDOMContentLoaded
event. - If you need speed from jsdom, use the callbacks or promises instead.