JSDOM Issue before all" hook: Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.
Closed this issue · 5 comments
I was getting
before all" hook:
Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.
For
before(function () {
this.jsdom = require('jsdom-global')()
})
after(function () {
this.jsdom()
})
Changing above lines code to import statement below resolved the issue.
import 'jsdom-global/register';
Stating here , so in case anybody else encounter the same will have a solution. Thanks!
It looks like you did before(function(done)...) with an argument.
On Wed, Aug 3, 2016, 11:59 PM Apurva B - Globant notifications@github.com
wrote:
I was getting
before all" hook:
Error: timeout of 2000ms exceeded. Ensure the done() callback is being
called in this test.
Forbefore(function () {
this.jsdom = require('jsdom-global')()
})after(function () {
this.jsdom()
})Changing above lines code to import statement below resolved the issue.
import 'jsdom-global/register';
Stating here , so in case anybody else encounter the same will have a
solution. Thanks!—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#10, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEikeHsPSIRZukJ59ds2Ds9JqtsXxg8ks5qcG7xgaJpZM4JbhAp
.
Nope! Just as I have mentioned ..without argument.
before(function () {
this.jsdom = require('jsdom-global')()
})
after(function () {
this.jsdom()
})
Alright. Thanks for the report! I'm closing this issue now as it's been resolved. If anyone can replicate the issue, please leave a note.
I just came across the issue as well, it seems initialising jsdom sometimes takes a while, setting the timeout higher solves the issue
let cleanup: () => void
before(function() {
this.timeout(5000)
cleanup = jsdom('', { url: 'http://localhost' })
})
after(() => {
cleanup()
})
Weirdly enough, instrumenting it, it only seems to take ~500ms
let cleanup: () => void
before(function() {
// this.timeout(5000)
const start = process.hrtime()
cleanup = jsdom('', { url: 'http://localhost' })
console.log(`Loading took ${process.hrtime(start)[1] / 1000000}ms`)
})
after(() => {
cleanup()
})