Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve chai support (with detailed output, to match jest exceptions) #8444

Closed
wants to merge 36 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
04c7b47
expand the assersion type error checking
rpgeeganage May 9, 2019
a68725d
fix the linting in the modified files
rpgeeganage May 9, 2019
cd84d63
added same fix for the circus
rpgeeganage May 9, 2019
da41f0a
updated the CHANGELOG.md
rpgeeganage May 9, 2019
59ab223
remove an accident commit on unwanted file
rpgeeganage May 9, 2019
15e2cc6
chore(jest-config): util types (#8437)
JoshRosenstein May 11, 2019
f0a6fa7
added test
rpgeeganage May 11, 2019
c4140d5
added tests
rpgeeganage May 11, 2019
b43f85a
fixed linting
rpgeeganage May 11, 2019
7f22d1e
update the snapshot
rpgeeganage May 11, 2019
9da7213
expand the assersion type error checking
rpgeeganage May 9, 2019
919848f
fix the linting in the modified files
rpgeeganage May 9, 2019
3301eab
added same fix for the circus
rpgeeganage May 9, 2019
51981ef
updated the CHANGELOG.md
rpgeeganage May 9, 2019
008aaf1
remove an accident commit on unwanted file
rpgeeganage May 9, 2019
824f96c
added test
rpgeeganage May 11, 2019
31dc2ce
added tests
rpgeeganage May 11, 2019
eaea884
fixed linting
rpgeeganage May 11, 2019
60d2847
update the snapshot
rpgeeganage May 11, 2019
76808f1
Merge branch 'improve_chai_output' of https://github.com/rpgeeganage/…
rpgeeganage May 11, 2019
3a3184e
expand the assersion type error checking
rpgeeganage May 9, 2019
ce74f6c
fix the linting in the modified files
rpgeeganage May 9, 2019
0396d93
added same fix for the circus
rpgeeganage May 9, 2019
8d430b6
updated the CHANGELOG.md
rpgeeganage May 9, 2019
fad812b
remove an accident commit on unwanted file
rpgeeganage May 9, 2019
711ff3d
added test
rpgeeganage May 11, 2019
246174c
added tests
rpgeeganage May 11, 2019
b3ca01c
fixed linting
rpgeeganage May 11, 2019
8b922cf
update the snapshot
rpgeeganage May 11, 2019
8a2cf42
expand the assersion type error checking
rpgeeganage May 9, 2019
b3b4c4d
fix the linting in the modified files
rpgeeganage May 9, 2019
d25ef62
updated the CHANGELOG.md
rpgeeganage May 9, 2019
da811e9
remove an accident commit on unwanted file
rpgeeganage May 9, 2019
c535263
added tests
rpgeeganage May 11, 2019
5610557
update the snapshot
rpgeeganage May 11, 2019
8533e19
Merge branch 'improve_chai_output' of https://github.com/rpgeeganage/…
rpgeeganage May 11, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/jest-jasmine2/src/jasmine/Env.ts
Expand Up @@ -663,7 +663,10 @@ export default function(j$: Jasmine) {
let checkIsError;
let message;

if (error instanceof AssertionError) {
if (
error instanceof AssertionError ||
error.name === AssertionError.name
) {
checkIsError = false;
// @ts-ignore TODO Possible error: j$.Spec does not have expand property
message = assertionErrorMessage(error, {expand: j$.Spec.expand});
Expand Down
13 changes: 9 additions & 4 deletions packages/jest-jasmine2/src/jasmine/Spec.ts
Expand Up @@ -236,10 +236,9 @@ export default class Spec {
passed: false,
expected: '',
actual: '',
error:
error instanceof AssertionError
? assertionErrorMessage(error, {expand: this.expand})
: error,
error: this.isAssertionError(error)
? assertionErrorMessage(error, {expand: this.expand})
: error,
},
true,
);
Expand Down Expand Up @@ -292,6 +291,12 @@ export default class Spec {
getFullName() {
return this.getSpecName(this);
}

isAssertionError(error: Error) {
return (
error instanceof AssertionError || error.name === AssertionError.name
);
}
}

Spec.pendingSpecExceptionMessage = '=> marked Pending';
Expand Down