Merge pull request #6311 from jvilk/mocha-fixes

[mocha] Adding definition of mocha.throwError, with test to cover it.
This commit is contained in:
Masahiro Wakame
2015-10-16 23:35:09 +09:00
2 changed files with 10 additions and 0 deletions
+4
View File
@@ -249,3 +249,7 @@ function test_run_withOnComplete() {
console.log(failures);
});
}
function test_throwError() {
mocha.throwError(new Error("I'm an error!"));
}
+6
View File
@@ -100,6 +100,12 @@ declare class Mocha {
invert(): Mocha;
ignoreLeaks(value: boolean): Mocha;
checkLeaks(): Mocha;
/**
* Function to allow assertion libraries to throw errors directly into mocha.
* This is useful when running tests in a browser because window.onerror will
* only receive the 'message' attribute of the Error.
*/
throwError(error: Error): void;
/** Enables growl support. */
growl(): Mocha;
globals(value: string): Mocha;