forked from mochajs/mocha
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempt at testing (failing due to uncaught exception)
- Loading branch information
Showing
2 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import '/base/mocha.js'; | ||
|
||
var Mocha = window.Mocha; | ||
var Suite = Mocha.Suite; | ||
var Runner = Mocha.Runner; | ||
|
||
mocha.allowUncaught() | ||
|
||
it('should include the stack of uncaught exceptions', function(done) { | ||
var suite = new Suite('Suite', 'root'); | ||
var runner = new Runner(suite); | ||
runner.allowUncaught = true; | ||
var err; | ||
runner.fail = function(e) { | ||
err = e; | ||
}; | ||
|
||
setTimeout(function throwTestError() { | ||
throw new Error('test error'); | ||
}, 1); | ||
|
||
setTimeout(function() { | ||
expect(err, 'to be an', Error); | ||
expect(err.stack, 'to contain', 'at throwTestError') | ||
done(); | ||
}, 2); | ||
}); |