Skip to content

Commit 5cae4b3

Browse files
committed
try to fix node assert
1 parent dbb6248 commit 5cae4b3

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

integration-tests/__tests__/__snapshots__/failures.test.js.snap

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ exports[`not throwing Error objects 5`] = `
143143
10 |
144144
145145
146-
at packages/jest-jasmine2/build/jasmine/Spec.js:85:20
146+
at packages/jest-jasmine2/build/jasmine/Spec.js:50:20
147147
at __tests__/during_tests.test.js:7:1
148148
149149
● Boolean thrown during test
@@ -159,7 +159,7 @@ exports[`not throwing Error objects 5`] = `
159159
14 | });
160160
161161
162-
at packages/jest-jasmine2/build/jasmine/Spec.js:85:20
162+
at packages/jest-jasmine2/build/jasmine/Spec.js:50:20
163163
at __tests__/during_tests.test.js:11:1
164164
165165
● undefined thrown during test
@@ -175,7 +175,7 @@ exports[`not throwing Error objects 5`] = `
175175
19 | });
176176
177177
178-
at packages/jest-jasmine2/build/jasmine/Spec.js:85:20
178+
at packages/jest-jasmine2/build/jasmine/Spec.js:50:20
179179
at __tests__/during_tests.test.js:16:1
180180
181181
● Object thrown during test
@@ -198,7 +198,7 @@ exports[`not throwing Error objects 5`] = `
198198
24 | });
199199
200200
201-
at packages/jest-jasmine2/build/jasmine/Spec.js:85:20
201+
at packages/jest-jasmine2/build/jasmine/Spec.js:50:20
202202
at __tests__/during_tests.test.js:21:1
203203
204204
● Error during test
@@ -391,7 +391,7 @@ exports[`works with async failures 1`] = `
391391
29 |
392392
30 | setTimeout(done, 10);
393393
394-
at packages/jest-jasmine2/build/jasmine/Spec.js:85:20
394+
at packages/jest-jasmine2/build/jasmine/Spec.js:50:20
395395
at __tests__/async_failures.test.js:27:1
396396
397397
"

integration-tests/__tests__/failures.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ test('works with node assert', () => {
130130
69 |
131131
132132
133-
at packages/jest-jasmine2/build/jasmine/Spec.js:85:20
133+
at packages/jest-jasmine2/build/jasmine/Spec.js:50:20
134134
at __tests__/node_assertion_error.test.js:66:1
135135
`;
136136

packages/jest-jasmine2/src/jasmine/Spec.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3131
/* @flow */
3232
/* eslint-disable sort-keys */
3333

34-
import {AssertionError} from 'assert';
35-
3634
import ExpectationFailed from '../expectation_failed';
3735

3836
import expectationResultFactory from '../expectation_result_factory';
@@ -137,12 +135,12 @@ Spec.prototype.onException = function onException(error) {
137135
return;
138136
}
139137

140-
if (error instanceof ExpectationFailed) {
141-
return;
138+
if (error && error.code === 'ERR_ASSERTION') {
139+
error = assertionErrorMessage(error, {expand: this.expand});
142140
}
143141

144-
if (error instanceof AssertionError) {
145-
error = assertionErrorMessage(error, {expand: this.expand});
142+
if (error instanceof ExpectationFailed) {
143+
return;
146144
}
147145

148146
this.addExpectationResult(

0 commit comments

Comments
 (0)