Skip to content

Commit 09251f2

Browse files
committed
remove unecessary double stack when we have one
1 parent ec0ce6a commit 09251f2

3 files changed

Lines changed: 8 additions & 34 deletions

File tree

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

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,6 @@ exports[`works with node assert 1`] = `
463463
18 | test('assert with a message', () => {
464464
465465
at __tests__/node_assertion_error.test.js:15:3
466-
467-
at __tests__/node_assertion_error.test.js:14:1
468466
469467
assert with a message
470468
@@ -487,8 +485,6 @@ exports[`works with node assert 1`] = `
487485
22 | test('assert.ok', () => {
488486
489487
at __tests__/node_assertion_error.test.js:19:3
490-
491-
at __tests__/node_assertion_error.test.js:18:1
492488
493489
assert.ok
494490
@@ -508,8 +504,6 @@ exports[`works with node assert 1`] = `
508504
26 | test('assert.ok with a message', () => {
509505
510506
at __tests__/node_assertion_error.test.js:23:10
511-
512-
at __tests__/node_assertion_error.test.js:22:1
513507
514508
assert.ok with a message
515509
@@ -532,8 +526,6 @@ exports[`works with node assert 1`] = `
532526
30 | test('assert.equal', () => {
533527
534528
at __tests__/node_assertion_error.test.js:27:10
535-
536-
at __tests__/node_assertion_error.test.js:26:1
537529
538530
assert.equal
539531
@@ -553,8 +545,6 @@ exports[`works with node assert 1`] = `
553545
34 | test('assert.notEqual', () => {
554546
555547
at __tests__/node_assertion_error.test.js:31:10
556-
557-
at __tests__/node_assertion_error.test.js:30:1
558548
559549
assert.notEqual
560550
@@ -578,8 +568,6 @@ exports[`works with node assert 1`] = `
578568
38 | test('assert.deepEqual', () => {
579569
580570
at __tests__/node_assertion_error.test.js:35:10
581-
582-
at __tests__/node_assertion_error.test.js:34:1
583571
584572
assert.deepEqual
585573
@@ -613,8 +601,6 @@ exports[`works with node assert 1`] = `
613601
42 | test('assert.deepEqual with a message', () => {
614602
615603
at __tests__/node_assertion_error.test.js:39:10
616-
617-
at __tests__/node_assertion_error.test.js:38:1
618604
619605
assert.deepEqual with a message
620606
@@ -651,8 +637,6 @@ exports[`works with node assert 1`] = `
651637
46 | test('assert.notDeepEqual', () => {
652638
653639
at __tests__/node_assertion_error.test.js:43:10
654-
655-
at __tests__/node_assertion_error.test.js:42:1
656640
657641
assert.notDeepEqual
658642
@@ -676,8 +660,6 @@ exports[`works with node assert 1`] = `
676660
50 | test('assert.strictEqual', () => {
677661
678662
at __tests__/node_assertion_error.test.js:47:10
679-
680-
at __tests__/node_assertion_error.test.js:46:1
681663
682664
assert.strictEqual
683665
@@ -697,8 +679,6 @@ exports[`works with node assert 1`] = `
697679
54 | test('assert.notStrictEqual', () => {
698680
699681
at __tests__/node_assertion_error.test.js:51:10
700-
701-
at __tests__/node_assertion_error.test.js:50:1
702682
703683
assert.notStrictEqual
704684
@@ -725,8 +705,6 @@ exports[`works with node assert 1`] = `
725705
58 | test('assert.deepStrictEqual', () => {
726706
727707
at __tests__/node_assertion_error.test.js:55:10
728-
729-
at __tests__/node_assertion_error.test.js:54:1
730708
731709
assert.deepStrictEqual
732710
@@ -756,8 +734,6 @@ exports[`works with node assert 1`] = `
756734
62 | test('assert.notDeepStrictEqual', () => {
757735
758736
at __tests__/node_assertion_error.test.js:59:10
759-
760-
at __tests__/node_assertion_error.test.js:58:1
761737
762738
assert.notDeepStrictEqual
763739
@@ -781,8 +757,6 @@ exports[`works with node assert 1`] = `
781757
66 | test('assert.ifError', () => {
782758
783759
at __tests__/node_assertion_error.test.js:63:10
784-
785-
at __tests__/node_assertion_error.test.js:62:1
786760
787761
assert.ifError
788762
@@ -806,8 +780,6 @@ exports[`works with node assert 1`] = `
806780
74 | });
807781
808782
at __tests__/node_assertion_error.test.js:71:10
809-
810-
at __tests__/node_assertion_error.test.js:70:1
811783
812784
assert.throws
813785
@@ -827,8 +799,6 @@ exports[`works with node assert 1`] = `
827799
79 |
828800
829801
at __tests__/node_assertion_error.test.js:77:10
830-
831-
at __tests__/node_assertion_error.test.js:76:1
832802
833803
"
834804
`;

integration-tests/__tests__/failures.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ test('works with node assert', () => {
111111
70 | test('assert.doesNotThrow', () => {
112112
113113
at __tests__/node_assertion_error.test.js:67:10
114-
115-
at __tests__/node_assertion_error.test.js:66:1
116114
`;
117115

118116
expect(summary).toContain(ifErrorMessage);

packages/jest-jasmine2/src/expectation_result_factory.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,14 @@ function stackFormatter(options, initError, errorMessage) {
3636
return '';
3737
}
3838

39-
if (options.error && options.error.stack) {
40-
return options.error.stack;
39+
if (options.error) {
40+
if (options.error.stack) {
41+
return options.error.stack;
42+
}
43+
44+
if (options.error === errorMessage) {
45+
return errorMessage;
46+
}
4147
}
4248

4349
if (initError) {

0 commit comments

Comments
 (0)