@@ -274,35 +274,37 @@ describe('babelJestTransformer', () => {
274274 expect ( typeof babelJest . process ) . toBe ( 'function' )
275275 } )
276276
277- it ( 'should return babelJestTransformer with javascript file path' , ( ) => {
278- const FILE = 'src/__mocks__/babel-foo.config.js'
279- const cs = createConfigSet ( {
280- jestConfig : {
281- globals : {
282- 'ts-jest' : {
283- babelConfig : FILE ,
277+ it . each ( [ 'src/__mocks__/babel-foo.config.js' , 'src/__mocks__/babel-foo.config.cjs' ] ) (
278+ 'should return babelJestTransformer with javascript file path' ,
279+ ( babelFilePath ) => {
280+ const cs = createConfigSet ( {
281+ jestConfig : {
282+ globals : {
283+ 'ts-jest' : {
284+ babelConfig : babelFilePath ,
285+ } ,
284286 } ,
285287 } ,
286- } ,
287- resolve : null ,
288- } )
289- const babelJest = cs . babelJestTransformer as Transformer
288+ resolve : null ,
289+ } )
290+ const babelJest = cs . babelJestTransformer as Transformer
290291
291- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
292- const babelCfg = cs . babelConfig !
293- expect ( babelCfg . cwd ) . toEqual ( cs . cwd )
294- expect ( babelCfg . presets ) . toMatchInlineSnapshot ( `
292+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
293+ const babelCfg = cs . babelConfig !
294+ expect ( babelCfg . cwd ) . toEqual ( cs . cwd )
295+ expect ( babelCfg . presets ) . toMatchInlineSnapshot ( `
295296 Array [
296297 "@babel/preset-env",
297298 "@babel/preset-typescript",
298299 "@babel/preset-react",
299300 ]
300301 ` )
301- expect ( babelJest . canInstrument ) . toBe ( true )
302- expect ( babelJest . createTransformer ) . toBeUndefined ( )
303- expect ( typeof babelJest . getCacheKey ) . toBe ( 'function' )
304- expect ( typeof babelJest . process ) . toBe ( 'function' )
305- } )
302+ expect ( babelJest . canInstrument ) . toBe ( true )
303+ expect ( babelJest . createTransformer ) . toBeUndefined ( )
304+ expect ( typeof babelJest . getCacheKey ) . toBe ( 'function' )
305+ expect ( typeof babelJest . process ) . toBe ( 'function' )
306+ } ,
307+ )
306308
307309 it ( 'should return babelJestTransformer with loaded config object' , ( ) => {
308310 /* eslint-disable-next-line jest/no-mocks-import */
0 commit comments