11import { inspect } from 'util'
22
33import { testing } from 'bs-logger'
4- import set = require ( 'lodash/set' )
4+ import set from 'lodash/set'
55
66import { backportJestConfig } from './backports'
77
@@ -13,20 +13,23 @@ beforeEach(() => {
1313} )
1414
1515describe ( 'backportJestConfig' , ( ) => {
16- // eslint-disable-next-line @typescript-eslint/no-explicit-any
17- const makeTestsFor = ( oldPath : string , _ : string , values : any [ ] ) => {
16+ const makeTestsFor = ( oldPath : string , values : unknown [ ] ) => {
1817 values . forEach ( ( val ) => {
1918 // eslint-disable-next-line @typescript-eslint/no-explicit-any
2019 let original : any
20+
2121 beforeEach ( ( ) => {
2222 original = { }
2323 set ( original , oldPath , val )
2424 } )
25+
2526 describe ( `with "${ oldPath } " set to ${ inspect ( val ) } ` , ( ) => {
2627 it ( 'should warn the user' , ( ) => {
2728 backportJestConfig ( logger , original )
29+
2830 expect ( logTarget . lines . warn ) . toMatchSnapshot ( )
2931 } ) // should warn the user
32+
3033 it ( 'should have changed the config correctly' , ( ) => {
3134 expect ( original ) . toMatchSnapshot ( 'before' )
3235 expect ( backportJestConfig ( logger , original ) ) . toMatchSnapshot ( 'migrated' )
@@ -35,17 +38,19 @@ describe('backportJestConfig', () => {
3538 } ) // for
3639 } // makeTestsFor
3740
38- makeTestsFor ( 'globals.__TS_CONFIG__' , 'globals.ts-jest.tsConfig' , [ { foo : 'bar' } ] )
41+ makeTestsFor ( 'globals.__TS_CONFIG__' , [ { foo : 'bar' } ] )
42+
43+ makeTestsFor ( 'globals.__TRANSFORM_HTML__' , [ true , false ] )
3944
40- makeTestsFor ( 'globals.__TRANSFORM_HTML__' , 'globals. ts-jest.stringifyContentPathRegex ', [ true , false ] )
45+ makeTestsFor ( 'globals.ts-jest.tsConfigFile ' , [ 'tsconfig.build.json' ] )
4146
42- makeTestsFor ( 'globals.ts-jest.tsConfigFile' , 'globals.ts-jest. tsConfig', [ 'tsconfig.build.json' ] )
47+ makeTestsFor ( 'globals.ts-jest.tsConfig' , [ 'tsconfig.build.json' ] )
4348
44- makeTestsFor ( 'globals.ts-jest.enableTsDiagnostics' , 'globals.ts-jest.diagnostics' , [ true , false , '\\.spec\\.ts$' ] )
49+ makeTestsFor ( 'globals.ts-jest.enableTsDiagnostics' , [ true , false , '\\.spec\\.ts$' ] )
4550
46- makeTestsFor ( 'globals.ts-jest.useBabelrc' , 'globals.ts-jest.babelConfig' , [ true , false ] )
51+ makeTestsFor ( 'globals.ts-jest.useBabelrc' , [ true , false ] )
4752
48- makeTestsFor ( 'globals.ts-jest.typeCheck' , 'globals.ts-jest.isolatedModules' , [ true , false ] )
53+ makeTestsFor ( 'globals.ts-jest.typeCheck' , [ true , false ] )
4954
50- makeTestsFor ( 'globals.ts-jest.skipBabel' , 'globals.ts-jest.babelConfig' , [ true , false ] )
55+ makeTestsFor ( 'globals.ts-jest.skipBabel' , [ true , false ] )
5156} )
0 commit comments