When catching a global error in Node.js, print the type of error
This commit is contained in:
@@ -98,9 +98,11 @@ describe("GlobalErrors", function() {
|
||||
errors.pushListener(handler);
|
||||
|
||||
var addedListener = fakeGlobal.process.on.calls.argsFor(0)[1];
|
||||
addedListener(new Error('bar'));
|
||||
const expectedError = new Error('bar');
|
||||
addedListener(expectedError);
|
||||
|
||||
expect(handler).toHaveBeenCalledWith(new Error('bar'));
|
||||
expect(handler).toHaveBeenCalledWith(expectedError);
|
||||
expect(expectedError.jasmineMessage).toBe('Uncaught exception: Error: bar');
|
||||
|
||||
errors.uninstall();
|
||||
|
||||
@@ -127,10 +129,12 @@ describe("GlobalErrors", function() {
|
||||
|
||||
errors.pushListener(handler);
|
||||
|
||||
var addedListener = fakeGlobal.process.on.calls.argsFor(0)[1];
|
||||
addedListener(new Error('bar'));
|
||||
var addedListener = fakeGlobal.process.on.calls.argsFor(1)[1];
|
||||
const expectedError = new Error('bar');
|
||||
addedListener(expectedError);
|
||||
|
||||
expect(handler).toHaveBeenCalledWith(new Error('bar'));
|
||||
expect(handler).toHaveBeenCalledWith(expectedError);
|
||||
expect(expectedError.jasmineMessage).toBe('Unhandled promise rejection: Error: bar');
|
||||
|
||||
errors.uninstall();
|
||||
|
||||
|
||||
@@ -1942,10 +1942,10 @@ describe("Env integration", function() {
|
||||
|
||||
reporter.jasmineDone.and.callFake(function() {
|
||||
expect(reporter.suiteDone).toHaveFailedExpectationsForRunnable('async suite', [
|
||||
/^(((Uncaught )?Error: suite( thrown)?)|(suite thrown))$/
|
||||
/^(((Uncaught )?(exception: )?Error: suite( thrown)?)|(suite thrown))$/
|
||||
]);
|
||||
expect(reporter.specDone).toHaveFailedExpectationsForRunnable('suite async spec', [
|
||||
/^(((Uncaught )?Error: spec( thrown)?)|(spec thrown))$/
|
||||
/^(((Uncaught )?(exception: )?Error: spec( thrown)?)|(spec thrown))$/
|
||||
]);
|
||||
done();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user