@@ -181,9 +181,7 @@ test.suite('ts-node', (test) => {
181181 throw new Error ( 'Command was expected to fail, but it succeeded.' ) ;
182182 }
183183
184- expect ( r . err . message ) . toMatch (
185- [ `${ join ( TEST_DIR , 'throw error.ts' ) } :100` , " bar() { throw new Error('this is a demo'); }" ] . join ( '\n' )
186- ) ;
184+ expect ( r . err . message . replace ( / \r \n / g, '\n' ) ) . toMatch ( / t h r o w ( | % 2 0 ) e r r o r \. t s : 1 0 0 \n b a r \( \) \{ t h r o w n e w E r r o r \( ' t h i s i s a d e m o ' \) ; \} / ) ;
187185 } ) ;
188186
189187 test ( 'should work with source maps in --transpile-only mode' , async ( ) => {
@@ -192,9 +190,7 @@ test.suite('ts-node', (test) => {
192190 throw new Error ( 'Command was expected to fail, but it succeeded.' ) ;
193191 }
194192
195- expect ( r . err . message ) . toMatch (
196- [ `${ join ( TEST_DIR , 'throw error.ts' ) } :100` , " bar() { throw new Error('this is a demo'); }" ] . join ( '\n' )
197- ) ;
193+ expect ( r . err . message . replace ( / \r \n / g, '\n' ) ) . toMatch ( / t h r o w ( | % 2 0 ) e r r o r \. t s : 1 0 0 \n b a r \( \) \{ t h r o w n e w E r r o r \( ' t h i s i s a d e m o ' \) ; \} / ) ;
198194 } ) ;
199195
200196 test ( 'eval should work with source maps' , async ( ) => {
@@ -203,9 +199,7 @@ test.suite('ts-node', (test) => {
203199 throw new Error ( 'Command was expected to fail, but it succeeded.' ) ;
204200 }
205201
206- expect ( r . err . message ) . toMatch (
207- [ `${ join ( TEST_DIR , 'throw error.ts' ) } :100` , " bar() { throw new Error('this is a demo'); }" ] . join ( '\n' )
208- ) ;
202+ expect ( r . err . message . replace ( / \r \n / g, '\n' ) ) . toMatch ( / t h r o w ( | % 2 0 ) e r r o r \. t s : 1 0 0 \n b a r \( \) \{ t h r o w n e w E r r o r \( ' t h i s i s a d e m o ' \) ; \} / ) ;
209203 } ) ;
210204
211205 for ( const flavor of [
@@ -294,20 +288,16 @@ test.suite('ts-node', (test) => {
294288 test ( 'should use source maps with react tsx' , async ( ) => {
295289 const r = await exec ( `${ CMD_TS_NODE_WITH_PROJECT_FLAG } "throw error react tsx.tsx"` ) ;
296290 expect ( r . err ) . not . toBe ( null ) ;
297- expect ( r . err ! . message ) . toMatch (
298- [ `${ join ( TEST_DIR , './throw error react tsx.tsx' ) } :100` , " bar() { throw new Error('this is a demo'); }" ] . join (
299- '\n'
300- )
291+ expect ( r . err ! . message . replace ( / \r \n / g, '\n' ) ) . toMatch (
292+ / t h r o w ( | % 2 0 ) e r r o r ( | % 2 0 ) r e a c t ( | % 2 0 ) t s x \. t s x : 1 0 0 \n b a r \( \) \{ t h r o w n e w E r r o r \( ' t h i s i s a d e m o ' \) ; \} /
301293 ) ;
302294 } ) ;
303295
304296 test ( 'should use source maps with react tsx in --transpile-only mode' , async ( ) => {
305297 const r = await exec ( `${ CMD_TS_NODE_WITH_PROJECT_FLAG } --transpile-only "throw error react tsx.tsx"` ) ;
306298 expect ( r . err ) . not . toBe ( null ) ;
307- expect ( r . err ! . message ) . toMatch (
308- [ `${ join ( TEST_DIR , './throw error react tsx.tsx' ) } :100` , " bar() { throw new Error('this is a demo'); }" ] . join (
309- '\n'
310- )
299+ expect ( r . err ! . message . replace ( / \r \n / g, '\n' ) ) . toMatch (
300+ / t h r o w ( | % 2 0 ) e r r o r ( | % 2 0 ) r e a c t ( | % 2 0 ) t s x \. t s x : 1 0 0 \n b a r \( \) \{ t h r o w n e w E r r o r \( ' t h i s i s a d e m o ' \) ; \} /
311301 ) ;
312302 } ) ;
313303
@@ -420,8 +410,7 @@ test.suite('ts-node', (test) => {
420410 expect ( r . err ) . not . toBe ( null ) ;
421411 expect ( r . stderr . replace ( / \r \n / g, '\n' ) ) . toMatch (
422412 'TSError: ⨯ Unable to compile TypeScript:\n' +
423- "maxnodemodulesjsdepth/other.ts(4,7): error TS2322: Type 'string' is not assignable to type 'boolean'.\n" +
424- '\n'
413+ "maxnodemodulesjsdepth/other.ts(4,7): error TS2322: Type 'string' is not assignable to type 'boolean'."
425414 ) ;
426415 } ) ;
427416
@@ -430,8 +419,7 @@ test.suite('ts-node', (test) => {
430419 expect ( r . err ) . not . toBe ( null ) ;
431420 expect ( r . stderr . replace ( / \r \n / g, '\n' ) ) . toMatch (
432421 'TSError: ⨯ Unable to compile TypeScript:\n' +
433- "maxnodemodulesjsdepth-scoped/other.ts(7,7): error TS2322: Type 'string' is not assignable to type 'boolean'.\n" +
434- '\n'
422+ "maxnodemodulesjsdepth-scoped/other.ts(7,7): error TS2322: Type 'string' is not assignable to type 'boolean'."
435423 ) ;
436424 } ) ;
437425 } ) ;
0 commit comments