@@ -181,9 +181,7 @@ test.suite('ts-node', (test) => {
181
181
throw new Error ( 'Command was expected to fail, but it succeeded.' ) ;
182
182
}
183
183
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 ' \) ; \} / ) ;
187
185
} ) ;
188
186
189
187
test ( 'should work with source maps in --transpile-only mode' , async ( ) => {
@@ -192,9 +190,7 @@ test.suite('ts-node', (test) => {
192
190
throw new Error ( 'Command was expected to fail, but it succeeded.' ) ;
193
191
}
194
192
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 ' \) ; \} / ) ;
198
194
} ) ;
199
195
200
196
test ( 'eval should work with source maps' , async ( ) => {
@@ -203,9 +199,7 @@ test.suite('ts-node', (test) => {
203
199
throw new Error ( 'Command was expected to fail, but it succeeded.' ) ;
204
200
}
205
201
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 ' \) ; \} / ) ;
209
203
} ) ;
210
204
211
205
for ( const flavor of [
@@ -294,20 +288,16 @@ test.suite('ts-node', (test) => {
294
288
test ( 'should use source maps with react tsx' , async ( ) => {
295
289
const r = await exec ( `${ CMD_TS_NODE_WITH_PROJECT_FLAG } "throw error react tsx.tsx"` ) ;
296
290
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 ' \) ; \} /
301
293
) ;
302
294
} ) ;
303
295
304
296
test ( 'should use source maps with react tsx in --transpile-only mode' , async ( ) => {
305
297
const r = await exec ( `${ CMD_TS_NODE_WITH_PROJECT_FLAG } --transpile-only "throw error react tsx.tsx"` ) ;
306
298
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 ' \) ; \} /
311
301
) ;
312
302
} ) ;
313
303
@@ -420,8 +410,7 @@ test.suite('ts-node', (test) => {
420
410
expect ( r . err ) . not . toBe ( null ) ;
421
411
expect ( r . stderr . replace ( / \r \n / g, '\n' ) ) . toMatch (
422
412
'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'."
425
414
) ;
426
415
} ) ;
427
416
@@ -430,8 +419,7 @@ test.suite('ts-node', (test) => {
430
419
expect ( r . err ) . not . toBe ( null ) ;
431
420
expect ( r . stderr . replace ( / \r \n / g, '\n' ) ) . toMatch (
432
421
'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'."
435
423
) ;
436
424
} ) ;
437
425
} ) ;
0 commit comments