-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jest-jasmine2: pretty-print non-Error errors
- Loading branch information
Showing
6 changed files
with
153 additions
and
19 deletions.
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
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,37 @@ | ||
'use strict'; | ||
|
||
const deepObject = { | ||
notAnError: [{hello: true, tooDeep: {notVisible: true}}], | ||
}; | ||
|
||
test('Promise thrown during test', () => { | ||
throw Promise.resolve(5); | ||
}); | ||
|
||
test('Boolean thrown during test', () => { | ||
// eslint-disable-next-line no-throw-literal | ||
throw false; | ||
}); | ||
|
||
test('undefined thrown during test', () => { | ||
// eslint-disable-next-line no-throw-literal | ||
throw undefined; | ||
}); | ||
|
||
test('Object thrown during test', () => { | ||
// eslint-disable-next-line no-throw-literal | ||
throw deepObject; | ||
}); | ||
|
||
test('Error during test', () => { | ||
// eslint-disable-next-line no-undef | ||
doesNotExist.alsoThisNot; | ||
}); | ||
|
||
test('done(Error)', done => { | ||
done(new Error('this is an error')); | ||
}); | ||
|
||
test('done(non-error)', done => { | ||
done(deepObject); | ||
}); |
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
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