@@ -26,15 +26,6 @@ const stackUtils = new StackUtils({
26
26
cwd : 'something which does not exist' ,
27
27
} ) ;
28
28
29
- let nodeInternals : RegExp [ ] = [ ] ;
30
-
31
- try {
32
- nodeInternals = StackUtils . nodeInternals ( ) ;
33
- } catch ( e ) {
34
- // `StackUtils.nodeInternals()` fails in browsers. We don't need to remove
35
- // node internals in the browser though, so no issue.
36
- }
37
-
38
29
export type StackTraceConfig = Pick <
39
30
Config . ProjectConfig ,
40
31
'rootDir' | 'testMatch'
@@ -48,12 +39,6 @@ const PATH_NODE_MODULES = `${path.sep}node_modules${path.sep}`;
48
39
const PATH_JEST_PACKAGES = `${ path . sep } jest${ path . sep } packages${ path . sep } ` ;
49
40
50
41
// filter for noisy stack trace lines
51
- const JASMINE_IGNORE = / ^ \s + a t (?: (?: .j a s m i n e \- ) | \s + j a s m i n e \. b u i l d E x p e c t a t i o n R e s u l t ) / ;
52
- const JEST_INTERNALS_IGNORE = / ^ \s + a t .* ?j e s t ( - .* ?) ? ( \/ | \\ ) ( b u i l d | n o d e _ m o d u l e s | p a c k a g e s ) ( \/ | \\ ) / ;
53
- const ANONYMOUS_FN_IGNORE = / ^ \s + a t < a n o n y m o u s > .* $ / ;
54
- const ANONYMOUS_PROMISE_IGNORE = / ^ \s + a t ( n e w ) ? P r o m i s e \( < a n o n y m o u s > \) .* $ / ;
55
- const ANONYMOUS_GENERATOR_IGNORE = / ^ \s + a t G e n e r a t o r .n e x t \( < a n o n y m o u s > \) .* $ / ;
56
- const NATIVE_NEXT_IGNORE = / ^ \s + a t n e x t \( n a t i v e \) .* $ / ;
57
42
const TITLE_INDENT = ' ' ;
58
43
const MESSAGE_INDENT = ' ' ;
59
44
const STACK_INDENT = ' ' ;
@@ -152,54 +137,8 @@ export const formatExecError = (
152
137
153
138
const removeInternalStackEntries = (
154
139
lines : string [ ] ,
155
- options : StackTraceOptions ,
156
- ) : string [ ] => {
157
- let pathCounter = 0 ;
158
-
159
- return lines . filter ( line => {
160
- if ( ANONYMOUS_FN_IGNORE . test ( line ) ) {
161
- return false ;
162
- }
163
-
164
- if ( ANONYMOUS_PROMISE_IGNORE . test ( line ) ) {
165
- return false ;
166
- }
167
-
168
- if ( ANONYMOUS_GENERATOR_IGNORE . test ( line ) ) {
169
- return false ;
170
- }
171
-
172
- if ( NATIVE_NEXT_IGNORE . test ( line ) ) {
173
- return false ;
174
- }
175
-
176
- if ( nodeInternals . some ( internal => internal . test ( line ) ) ) {
177
- return false ;
178
- }
179
-
180
- if ( ! STACK_PATH_REGEXP . test ( line ) ) {
181
- return true ;
182
- }
183
-
184
- if ( JASMINE_IGNORE . test ( line ) ) {
185
- return false ;
186
- }
187
-
188
- if ( ++ pathCounter === 1 ) {
189
- return true ; // always keep the first line even if it's from Jest
190
- }
191
-
192
- if ( options . noStackTrace ) {
193
- return false ;
194
- }
195
-
196
- if ( JEST_INTERNALS_IGNORE . test ( line ) ) {
197
- return false ;
198
- }
199
-
200
- return true ;
201
- } ) ;
202
- } ;
140
+ _options : StackTraceOptions ,
141
+ ) : string [ ] => lines ;
203
142
204
143
const formatPaths = (
205
144
config : StackTraceConfig ,
0 commit comments