Skip to content

Commit 21fd945

Browse files
committed
trim when adding custom stack trace
1 parent 7ed2886 commit 21fd945

2 files changed

Lines changed: 2 additions & 5 deletions

File tree

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ exports[`not throwing Error objects 2`] = `
1414
● Test suite failed to run
1515
1616
Error
17+
1718
banana
1819
1920
"
@@ -142,7 +143,6 @@ exports[`not throwing Error objects 5`] = `
142143
9 | });
143144
10 |
144145
145-
146146
at packages/jest-jasmine2/build/jasmine/Spec.js:85:20
147147
at __tests__/during_tests.test.js:7:1
148148
@@ -158,7 +158,6 @@ exports[`not throwing Error objects 5`] = `
158158
13 | throw false;
159159
14 | });
160160
161-
162161
at packages/jest-jasmine2/build/jasmine/Spec.js:85:20
163162
at __tests__/during_tests.test.js:11:1
164163
@@ -174,7 +173,6 @@ exports[`not throwing Error objects 5`] = `
174173
18 | throw undefined;
175174
19 | });
176175
177-
178176
at packages/jest-jasmine2/build/jasmine/Spec.js:85:20
179177
at __tests__/during_tests.test.js:16:1
180178
@@ -197,7 +195,6 @@ exports[`not throwing Error objects 5`] = `
197195
23 | throw deepObject;
198196
24 | });
199197
200-
201198
at packages/jest-jasmine2/build/jasmine/Spec.js:85:20
202199
at __tests__/during_tests.test.js:21:1
203200

packages/jest-jasmine2/src/expectation_result_factory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function stackFormatter(options, initError, errorMessage) {
4747
}
4848

4949
if (initError) {
50-
return errorMessage + '\n' + initError.stack;
50+
return errorMessage.trimRight() + '\n\n' + initError.stack;
5151
}
5252

5353
return new Error(errorMessage).stack;

0 commit comments

Comments
 (0)