File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import fs from 'node:fs';
2
2
import { originalPositionFor , TraceMap } from '@jridgewell/trace-mapping' ;
3
3
import { type StackFrame , parse as stackTraceParse } from 'stacktrace-parser' ;
4
4
import type { FormattedError , GetSourcemap } from '../types' ;
5
- import { color , formatTestPath , logger } from '../utils' ;
5
+ import { color , formatTestPath , isDebug , logger } from '../utils' ;
6
6
7
7
export async function printError (
8
8
error : FormattedError ,
@@ -109,13 +109,13 @@ const stackIgnores: (RegExp | string)[] = [
109
109
export async function parseErrorStacktrace ( {
110
110
stack,
111
111
getSourcemap,
112
- fullStack,
112
+ fullStack = isDebug ( ) ,
113
113
} : {
114
114
fullStack ?: boolean ;
115
115
stack : string ;
116
116
getSourcemap : GetSourcemap ;
117
117
} ) : Promise < StackFrame [ ] > {
118
- return Promise . all (
118
+ const stackFrames = await Promise . all (
119
119
stackTraceParse ( stack )
120
120
. filter ( ( frame ) =>
121
121
fullStack
@@ -149,4 +149,12 @@ export async function parseErrorStacktrace({
149
149
) . then ( ( frames ) =>
150
150
frames . filter ( ( frame ) : frame is StackFrame => frame !== null ) ,
151
151
) ;
152
+
153
+ if ( ! stackFrames . length && stack . length ) {
154
+ logger . log (
155
+ color . gray ( "No error stack found, set 'DEBUG=rstest' to show fullStack." ) ,
156
+ ) ;
157
+ }
158
+
159
+ return stackFrames ;
152
160
}
You can’t perform that action at this time.
0 commit comments