Skip to content

Commit

Permalink
try to fix node assert
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed May 21, 2018
1 parent dbb6248 commit 5cae4b3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
10 changes: 5 additions & 5 deletions integration-tests/__tests__/__snapshots__/failures.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ exports[`not throwing Error objects 5`] = `
10 |
at packages/jest-jasmine2/build/jasmine/Spec.js:85:20
at packages/jest-jasmine2/build/jasmine/Spec.js:50:20
at __tests__/during_tests.test.js:7:1
● Boolean thrown during test
Expand All @@ -159,7 +159,7 @@ exports[`not throwing Error objects 5`] = `
14 | });
at packages/jest-jasmine2/build/jasmine/Spec.js:85:20
at packages/jest-jasmine2/build/jasmine/Spec.js:50:20
at __tests__/during_tests.test.js:11:1
● undefined thrown during test
Expand All @@ -175,7 +175,7 @@ exports[`not throwing Error objects 5`] = `
19 | });
at packages/jest-jasmine2/build/jasmine/Spec.js:85:20
at packages/jest-jasmine2/build/jasmine/Spec.js:50:20
at __tests__/during_tests.test.js:16:1
● Object thrown during test
Expand All @@ -198,7 +198,7 @@ exports[`not throwing Error objects 5`] = `
24 | });
at packages/jest-jasmine2/build/jasmine/Spec.js:85:20
at packages/jest-jasmine2/build/jasmine/Spec.js:50:20
at __tests__/during_tests.test.js:21:1
● Error during test
Expand Down Expand Up @@ -391,7 +391,7 @@ exports[`works with async failures 1`] = `
29 |
30 | setTimeout(done, 10);
at packages/jest-jasmine2/build/jasmine/Spec.js:85:20
at packages/jest-jasmine2/build/jasmine/Spec.js:50:20
at __tests__/async_failures.test.js:27:1
"
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/__tests__/failures.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ test('works with node assert', () => {
69 |
at packages/jest-jasmine2/build/jasmine/Spec.js:85:20
at packages/jest-jasmine2/build/jasmine/Spec.js:50:20
at __tests__/node_assertion_error.test.js:66:1
`;

Expand Down
10 changes: 4 additions & 6 deletions packages/jest-jasmine2/src/jasmine/Spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/* @flow */
/* eslint-disable sort-keys */

import {AssertionError} from 'assert';

import ExpectationFailed from '../expectation_failed';

import expectationResultFactory from '../expectation_result_factory';
Expand Down Expand Up @@ -137,12 +135,12 @@ Spec.prototype.onException = function onException(error) {
return;
}

if (error instanceof ExpectationFailed) {
return;
if (error && error.code === 'ERR_ASSERTION') {
error = assertionErrorMessage(error, {expand: this.expand});
}

if (error instanceof AssertionError) {
error = assertionErrorMessage(error, {expand: this.expand});
if (error instanceof ExpectationFailed) {
return;
}

this.addExpectationResult(
Expand Down

0 comments on commit 5cae4b3

Please sign in to comment.