mirror of
https://github.com/Microsoft/vscode
synced 2024-10-12 06:17:18 +00:00
report unexpected errors in tests
This commit is contained in:
parent
e32df1933a
commit
676dca3521
24
test/all.js
24
test/all.js
|
@ -157,6 +157,30 @@ function main() {
|
|||
});
|
||||
}
|
||||
|
||||
// report failing test for every unexpected error during any of the tests
|
||||
var unexpectedErrors = [];
|
||||
suite('Errors', function () {
|
||||
test('should not have unexpected errors in tests', function () {
|
||||
if (unexpectedErrors.length) {
|
||||
unexpectedErrors.forEach(function (stack) {
|
||||
console.error('');
|
||||
console.error(stack);
|
||||
});
|
||||
|
||||
assert.ok(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// replace the default unexpected error handler to be useful during tests
|
||||
loader('vs/base/common/errors').setUnexpectedErrorHandler(function (err) {
|
||||
try {
|
||||
throw new Error('oops');
|
||||
} catch (e) {
|
||||
unexpectedErrors.push((err && err.message ? err.message : err) + '\n' + e.stack);
|
||||
}
|
||||
});
|
||||
|
||||
// fire up mocha
|
||||
run();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue