Skip to content

Commit 30c7ffb

Browse files
committed
Attempt at testing (failing due to uncaught exception)
1 parent c94fc46 commit 30c7ffb

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

karma.conf.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,11 @@ module.exports = config => {
143143
pattern: 'test/browser-specific/fixtures/esm.fixture.mjs',
144144
type: 'module'
145145
},
146-
{pattern: 'test/browser-specific/esm.spec.mjs', type: 'module'}
146+
{pattern: 'test/browser-specific/esm.spec.mjs', type: 'module'},
147+
{
148+
pattern: 'test/browser-specific/uncaught-exception.spec.mjs',
149+
type: 'module'
150+
}
147151
];
148152
break;
149153
default:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import '/base/mocha.js';
2+
3+
var Mocha = window.Mocha;
4+
var Suite = Mocha.Suite;
5+
var Runner = Mocha.Runner;
6+
7+
mocha.allowUncaught()
8+
9+
it('should include the stack of uncaught exceptions', function(done) {
10+
var suite = new Suite('Suite', 'root');
11+
var runner = new Runner(suite);
12+
runner.allowUncaught = true;
13+
var err;
14+
runner.fail = function(e) {
15+
err = e;
16+
};
17+
18+
setTimeout(function throwTestError() {
19+
throw new Error('test error');
20+
}, 1);
21+
22+
setTimeout(function() {
23+
expect(err, 'to be an', Error);
24+
expect(err.stack, 'to contain', 'at throwTestError')
25+
done();
26+
}, 2);
27+
});

0 commit comments

Comments
 (0)