@@ -307,30 +307,30 @@ Jest configuration written to "${normalize('/foo/bar/package.json')}".
307
307
)
308
308
const res = await runCli ( ...noOption , pkgPaths . current )
309
309
expect ( res ) . toMatchInlineSnapshot ( `
310
- Object {
311
- "exitCode": 0,
312
- "log": "",
313
- "stderr": "
314
- Migrated Jest configuration:
315
-
316
-
317
- Detected preset 'default' as the best matching preset for your configuration.
318
- Visit https://kulshekhar.github.io/ts-jest/user/config/#jest-preset for more information about presets.
319
-
320
- ",
321
- "stdout": "\\"jest\\": {
322
- \\"globals\\": {
323
- \\"ts-jest\\": {
324
- \\"tsconfig\\": {
325
- \\"target\\": \\"es6\\"
326
- }
327
- }
328
- },
329
- \\"preset\\": \\"ts-jest\\"
330
- }
331
- ",
332
- }
333
- `)
310
+ Object {
311
+ "exitCode": 0,
312
+ "log": "",
313
+ "stderr": "
314
+ Migrated Jest configuration:
315
+
316
+
317
+ Detected preset 'default' as the best matching preset for your configuration.
318
+ Visit https://kulshekhar.github.io/ts-jest/user/config/#jest-preset for more information about presets.
319
+
320
+ ",
321
+ "stdout": "\\"jest\\": {
322
+ \\"globals\\": {
323
+ \\"ts-jest\\": {
324
+ \\"tsconfig\\": {
325
+ \\"target\\": \\"es6\\"
326
+ }
327
+ }
328
+ },
329
+ \\"preset\\": \\"ts-jest\\"
330
+ }
331
+ ",
332
+ }
333
+ ` )
334
334
expect ( fs . writeFileSync ) . not . toHaveBeenCalled ( )
335
335
} )
336
336
@@ -346,24 +346,24 @@ Jest configuration written to "${normalize('/foo/bar/package.json')}".
346
346
)
347
347
const res = await runCli ( ...fullOptions , pkgPaths . current )
348
348
expect ( res ) . toMatchInlineSnapshot ( `
349
- Object {
350
- "exitCode": 0,
351
- "log": "",
352
- "stderr": "
353
- Migrated Jest configuration:
354
- ",
355
- "stdout": "\\"jest\\": {
356
- \\"globals\\": {
357
- \\"ts-jest\\": {
358
- \\"tsconfig\\": {
359
- \\"target\\": \\"es6\\"
360
- }
361
- }
362
- }
363
- }
364
- ",
365
- }
366
- `)
349
+ Object {
350
+ "exitCode": 0,
351
+ "log": "",
352
+ "stderr": "
353
+ Migrated Jest configuration:
354
+ ",
355
+ "stdout": "\\"jest\\": {
356
+ \\"globals\\": {
357
+ \\"ts-jest\\": {
358
+ \\"tsconfig\\": {
359
+ \\"target\\": \\"es6\\"
360
+ }
361
+ }
362
+ }
363
+ }
364
+ ",
365
+ }
366
+ ` )
367
367
expect ( fs . writeFileSync ) . not . toHaveBeenCalled ( )
368
368
} )
369
369
@@ -388,29 +388,29 @@ Jest configuration written to "${normalize('/foo/bar/package.json')}".
388
388
)
389
389
const res = await runCli ( ...noOption , pkgPaths . current )
390
390
expect ( res . stdout ) . toMatchInlineSnapshot ( `
391
- "\\"jest\\": {
392
- \\"globals\\": {
393
- \\"ts-jest\\": {
394
- \\"tsconfig\\": {
395
- \\"target\\": \\"es6\\"
396
- }
397
- }
398
- },
399
- \\"moduleFileExtensions\\": [
400
- \\"js\\",
401
- \\"ts\\",
402
- \\"tsx\\"
403
- ],
404
- \\"testMatch\\": [
405
- \\"**/?(*.)+(spec|test).js?(x)\\",
406
- \\"**/?(*.)+(spec|test).ts?(x)\\",
407
- \\"**/__tests__/**/*.js?(x)\\",
408
- \\"**/__tests__/**/*.ts?(x)\\"
409
- ],
410
- \\"preset\\": \\"ts-jest\\"
411
- }
412
- "
413
- `)
391
+ "\\"jest\\": {
392
+ \\"globals\\": {
393
+ \\"ts-jest\\": {
394
+ \\"tsconfig\\": {
395
+ \\"target\\": \\"es6\\"
396
+ }
397
+ }
398
+ },
399
+ \\"moduleFileExtensions\\": [
400
+ \\"js\\",
401
+ \\"ts\\",
402
+ \\"tsx\\"
403
+ ],
404
+ \\"testMatch\\": [
405
+ \\"**/?(*.)+(spec|test).js?(x)\\",
406
+ \\"**/?(*.)+(spec|test).ts?(x)\\",
407
+ \\"**/__tests__/**/*.js?(x)\\",
408
+ \\"**/__tests__/**/*.ts?(x)\\"
409
+ ],
410
+ \\"preset\\": \\"ts-jest\\"
411
+ }
412
+ "
413
+ ` )
414
414
} )
415
415
416
416
it ( 'should reset testMatch if testRegex is used' , async ( ) => {
@@ -427,13 +427,13 @@ Jest configuration written to "${normalize('/foo/bar/package.json')}".
427
427
)
428
428
const res = await runCli ( ...noOption , pkgPaths . current )
429
429
expect ( res . stdout ) . toMatchInlineSnapshot ( `
430
- "\\"jest\\": {
431
- \\"testRegex\\": \\"foo-pattern\\",
432
- \\"preset\\": \\"ts-jest\\",
433
- \\"testMatch\\": null
434
- }
435
- "
436
- `)
430
+ "\\"jest\\": {
431
+ \\"testRegex\\": \\"foo-pattern\\",
432
+ \\"preset\\": \\"ts-jest\\",
433
+ \\"testMatch\\": null
434
+ }
435
+ "
436
+ ` )
437
437
} )
438
438
439
439
it ( 'should detect best preset' , async ( ) => {
@@ -445,43 +445,43 @@ Jest configuration written to "${normalize('/foo/bar/package.json')}".
445
445
jest . doMock ( pkgPaths . nextCfg , ( ) => ( { } ) , { virtual : true } )
446
446
let res = await runCli ( ...noOption , pkgPaths . currentCfg )
447
447
expect ( res . stdout ) . toMatchInlineSnapshot ( `
448
- "module.exports = {
449
- preset: 'ts-jest',
450
- }
451
- "
452
- `)
448
+ "module.exports = {
449
+ preset: 'ts-jest',
450
+ }
451
+ "
452
+ ` )
453
453
454
454
// js-with-ts from args
455
455
jest . doMock ( pkgPaths . nextCfg , ( ) => ( { } ) , { virtual : true } )
456
456
res = await runCli ( ...noOption , '--allow-js' , pkgPaths . currentCfg )
457
457
expect ( res . stdout ) . toMatchInlineSnapshot ( `
458
- "module.exports = {
459
- preset: 'ts-jest/presets/js-with-ts',
460
- }
461
- "
462
- `)
458
+ "module.exports = {
459
+ preset: 'ts-jest/presets/js-with-ts',
460
+ }
461
+ "
462
+ ` )
463
463
464
464
// js-with-ts from previous transform
465
465
jest . doMock ( pkgPaths . nextCfg , ( ) => ( { transform : { '^.+\\.[tj]sx?$' : 'ts-jest' } } ) , { virtual : true } )
466
466
res = await runCli ( ...noOption , pkgPaths . currentCfg )
467
467
expect ( res . stdout ) . toMatchInlineSnapshot ( `
468
- "module.exports = {
469
- preset: 'ts-jest/presets/js-with-ts',
470
- }
471
- "
472
- `)
468
+ "module.exports = {
469
+ preset: 'ts-jest/presets/js-with-ts',
470
+ }
471
+ "
472
+ ` )
473
473
474
474
// js-with-babel from previous transform
475
475
jest . doMock ( pkgPaths . nextCfg , ( ) => ( { transform : { '^.+\\.jsx?$' : 'babel-jest' , '^.+\\.tsx?$' : 'ts-jest' } } ) , {
476
476
virtual : true ,
477
477
} )
478
478
res = await runCli ( ...noOption , pkgPaths . currentCfg )
479
479
expect ( res . stdout ) . toMatchInlineSnapshot ( `
480
- "module.exports = {
481
- preset: 'ts-jest/presets/js-with-babel',
482
- }
483
- "
484
- `)
480
+ "module.exports = {
481
+ preset: 'ts-jest/presets/js-with-babel',
482
+ }
483
+ "
484
+ ` )
485
485
486
486
// defaults when previous transform is ambiguous
487
487
jest . doMock (
@@ -491,15 +491,15 @@ Jest configuration written to "${normalize('/foo/bar/package.json')}".
491
491
)
492
492
res = await runCli ( ...noOption , pkgPaths . currentCfg )
493
493
expect ( res . stdout ) . toMatchInlineSnapshot ( `
494
- "module.exports = {
495
- transform: {
496
- '^src/js/.+\\\\\\\\.jsx?$': 'babel-jest',
497
- '^src/ts/.+\\\\\\\\.tsx?$': 'ts-jest',
498
- },
499
- preset: 'ts-jest',
500
- }
501
- "
502
- `)
494
+ "module.exports = {
495
+ transform: {
496
+ '^src/js/.+\\\\\\\\.jsx?$': 'babel-jest',
497
+ '^src/ts/.+\\\\\\\\.tsx?$': 'ts-jest',
498
+ },
499
+ preset: 'ts-jest',
500
+ }
501
+ "
502
+ ` )
503
503
} )
504
504
505
505
it ( 'should normalize transform values' , async ( ) => {
@@ -520,16 +520,16 @@ Jest configuration written to "${normalize('/foo/bar/package.json')}".
520
520
)
521
521
const res = await runCli ( ...noOption , pkgPaths . current )
522
522
expect ( res . stdout ) . toMatchInlineSnapshot ( `
523
- "\\"jest\\": {
524
- \\"transform\\": {
525
- \\"<rootDir>/src/.+\\\\\\\\.[jt]s$\\": \\"ts-jest\\",
526
- \\"foo\\\\\\\\.ts\\": \\"ts-jest\\",
527
- \\"bar\\\\\\\\.ts\\": \\"ts-jest\\"
528
- },
529
- \\"preset\\": \\"ts-jest\\"
530
- }
531
- "
532
- `)
523
+ "\\"jest\\": {
524
+ \\"transform\\": {
525
+ \\"<rootDir>/src/.+\\\\\\\\.[jt]s$\\": \\"ts-jest\\",
526
+ \\"foo\\\\\\\\.ts\\": \\"ts-jest\\",
527
+ \\"bar\\\\\\\\.ts\\": \\"ts-jest\\"
528
+ },
529
+ \\"preset\\": \\"ts-jest\\"
530
+ }
531
+ "
532
+ ` )
533
533
} )
534
534
535
535
it ( 'should output help' , async ( ) => {
0 commit comments