import StackUtils from 'stack-utils' ; export type MakeErrorMessage = ( error : Error , sourceFrames : readonly string [ ] ) => string ; export function withFullStackTrace ( ) { const stack = new StackUtils ( { cwd : process . cwd ( ) , internals : [ ... StackUtils . nodeInternals ( ) , /\s*at .*[/]fake-cucumber[/]/ , ] , } ) ; return ( error , sourceFrames ) => { const trace = stack . clean ( error . stack ) . trim ( ) . split ( '\n' ) . concat ( sourceFrames ) . map ( ( frame ) => `    at ${ frame }` ) . join ( '\n' ) ; return `${ error . message }\n${ trace }` ; } ; } export function withSourceFramesOnlyStackTrace ( ) { return ( error , sourceFrames ) => { return [ error . message , ... sourceFrames ] . join ( '\n' ) ; } ; }