Skip to content

Commit 8c16548

Browse files
committed
try to fix node assert
1 parent 23ea923 commit 8c16548

File tree

1 file changed

+4
-6
lines changed
  • packages/jest-jasmine2/src/jasmine

1 file changed

+4
-6
lines changed

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';
@@ -148,12 +146,12 @@ Spec.prototype.onException = function onException(error) {
148146
return;
149147
}
150148

151-
if (error instanceof ExpectationFailed) {
152-
return;
149+
if (error && error.code === 'ERR_ASSERTION') {
150+
error = assertionErrorMessage(error, {expand: this.expand});
153151
}
154152

155-
if (error instanceof AssertionError) {
156-
error = assertionErrorMessage(error, {expand: this.expand});
153+
if (error instanceof ExpectationFailed) {
154+
return;
157155
}
158156

159157
this.addExpectationResult(

0 commit comments

Comments
 (0)