Skip to content

Commit

Permalink
Fix broken nextTick test
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoref authored and boneskull committed Dec 9, 2017
1 parent 2f8173a commit 42280e8
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions test/unit/throw.spec.js
Expand Up @@ -45,16 +45,21 @@ describe('a test that throws', function () {

it('should not pass if throwing async and test is async', function (done) {
var test = new Test('im async and throw undefined async', function (done2) {
process.nexTick(function () {
process.nextTick(function () {
throw undefined;
});
});
suite.addTest(test);
runner = new Runner(suite);
var uncaught = Runner.prototype.uncaught;
Runner.prototype.uncaught = function () {
Runner.prototype.uncaught = uncaught;
done();
};
runner.on('end', function () {
expect(runner.failures).to.equal(1);
expect(test.state).to.equal('failed');
done();
expect(runner.uncaught).toBeCalled();
});
runner.run();
});
Expand Down Expand Up @@ -91,16 +96,21 @@ describe('a test that throws', function () {

it('should not pass if throwing async and test is async', function (done) {
var test = new Test('im async and throw null async', function (done2) {
process.nexTick(function () {
process.nextTick(function () {
throw null;
});
});
suite.addTest(test);
runner = new Runner(suite);
var uncaught = Runner.prototype.uncaught;
Runner.prototype.uncaught = function () {
Runner.prototype.uncaught = uncaught;
done();
};
runner.on('end', function () {
expect(runner.failures).to.equal(1);
expect(test.state).to.equal('failed');
done();
expect(runner.uncaught).toBeCalled();
});
runner.run();
});
Expand Down

0 comments on commit 42280e8

Please sign in to comment.