I am using this question as example:
Use Nightmare.js without ES6 syntax and yield
But if i put it in a mocha test this will go in a timeout, here the code:
describe('Google', function() {
it('should do things', function(done) {
var x = Date.now();
var nightmare = Nightmare();
Promise.resolve(nightmare
.goto('http://google.com')
.evaluate(function() {
return document.getElementsByTagName('html')[0].innerHTML;
}))
.then(function(html) {
console.log("done in " + (Date.now()-x) + "ms");
console.log("result", html);
expect(html).to.equal('abc');
done();
return nightmare.end();
}).then(function(result) {
}, function(err) {
console.error(err); // notice that `throw`ing in here doesn't work
});
});
});
But the problem is that done()
is never called.