Skip to content

Commit 42280e8

Browse files
jsorefboneskull
authored andcommitted
Fix broken nextTick test
1 parent 2f8173a commit 42280e8

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

test/unit/throw.spec.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,21 @@ describe('a test that throws', function () {
4545

4646
it('should not pass if throwing async and test is async', function (done) {
4747
var test = new Test('im async and throw undefined async', function (done2) {
48-
process.nexTick(function () {
48+
process.nextTick(function () {
4949
throw undefined;
5050
});
5151
});
5252
suite.addTest(test);
5353
runner = new Runner(suite);
54+
var uncaught = Runner.prototype.uncaught;
55+
Runner.prototype.uncaught = function () {
56+
Runner.prototype.uncaught = uncaught;
57+
done();
58+
};
5459
runner.on('end', function () {
5560
expect(runner.failures).to.equal(1);
5661
expect(test.state).to.equal('failed');
57-
done();
62+
expect(runner.uncaught).toBeCalled();
5863
});
5964
runner.run();
6065
});
@@ -91,16 +96,21 @@ describe('a test that throws', function () {
9196

9297
it('should not pass if throwing async and test is async', function (done) {
9398
var test = new Test('im async and throw null async', function (done2) {
94-
process.nexTick(function () {
99+
process.nextTick(function () {
95100
throw null;
96101
});
97102
});
98103
suite.addTest(test);
99104
runner = new Runner(suite);
105+
var uncaught = Runner.prototype.uncaught;
106+
Runner.prototype.uncaught = function () {
107+
Runner.prototype.uncaught = uncaught;
108+
done();
109+
};
100110
runner.on('end', function () {
101111
expect(runner.failures).to.equal(1);
102112
expect(test.state).to.equal('failed');
103-
done();
113+
expect(runner.uncaught).toBeCalled();
104114
});
105115
runner.run();
106116
});

0 commit comments

Comments
 (0)