66 */
77
88import type { TransformOptions as BabelTransformOptions } from '@babel/core' ;
9- import type { TransformOptions as JestTransformOptions } from '@jest/transform' ;
9+ import type { TransformOptions } from '@jest/transform' ;
1010import babelJest from '../index' ;
1111
1212const { getCacheKey} = babelJest . createTransformer ( ) ;
@@ -39,9 +39,9 @@ describe('getCacheKey', () => {
3939 config : { rootDir : 'mock-root-dir' } ,
4040 configString : 'mock-config-string' ,
4141 instrument : true ,
42- } as JestTransformOptions ;
42+ } as TransformOptions < BabelTransformOptions > ;
4343
44- const oldCacheKey = getCacheKey ( sourceText , sourcePath , transformOptions ) ;
44+ const oldCacheKey = getCacheKey ! ( sourceText , sourcePath , transformOptions ) ;
4545
4646 test ( 'returns cache key hash' , ( ) => {
4747 expect ( oldCacheKey . length ) . toEqual ( 32 ) ;
@@ -54,7 +54,7 @@ describe('getCacheKey', () => {
5454
5555 const { createTransformer} : typeof import ( '../index' ) = require ( '../index' ) ;
5656
57- const newCacheKey = createTransformer ( ) . getCacheKey (
57+ const newCacheKey = createTransformer ( ) . getCacheKey ! (
5858 sourceText ,
5959 sourcePath ,
6060 transformOptions ,
@@ -77,7 +77,7 @@ describe('getCacheKey', () => {
7777
7878 const { createTransformer} : typeof import ( '../index' ) = require ( '../index' ) ;
7979
80- const newCacheKey = createTransformer ( ) . getCacheKey (
80+ const newCacheKey = createTransformer ( ) . getCacheKey ! (
8181 sourceText ,
8282 sourcePath ,
8383 transformOptions ,
@@ -87,7 +87,7 @@ describe('getCacheKey', () => {
8787 } ) ;
8888
8989 test ( 'if `sourceText` value is changing' , ( ) => {
90- const newCacheKey = getCacheKey (
90+ const newCacheKey = getCacheKey ! (
9191 'new source text' ,
9292 sourcePath ,
9393 transformOptions ,
@@ -97,7 +97,7 @@ describe('getCacheKey', () => {
9797 } ) ;
9898
9999 test ( 'if `sourcePath` value is changing' , ( ) => {
100- const newCacheKey = getCacheKey (
100+ const newCacheKey = getCacheKey ! (
101101 sourceText ,
102102 'new-source-path.js' ,
103103 transformOptions ,
@@ -107,7 +107,7 @@ describe('getCacheKey', () => {
107107 } ) ;
108108
109109 test ( 'if `configString` value is changing' , ( ) => {
110- const newCacheKey = getCacheKey ( sourceText , sourcePath , {
110+ const newCacheKey = getCacheKey ! ( sourceText , sourcePath , {
111111 ...transformOptions ,
112112 configString : 'new-config-string' ,
113113 } ) ;
@@ -129,7 +129,7 @@ describe('getCacheKey', () => {
129129
130130 const { createTransformer} : typeof import ( '../index' ) = require ( '../index' ) ;
131131
132- const newCacheKey = createTransformer ( ) . getCacheKey (
132+ const newCacheKey = createTransformer ( ) . getCacheKey ! (
133133 sourceText ,
134134 sourcePath ,
135135 transformOptions ,
@@ -152,7 +152,7 @@ describe('getCacheKey', () => {
152152
153153 const { createTransformer} : typeof import ( '../index' ) = require ( '../index' ) ;
154154
155- const newCacheKey = createTransformer ( ) . getCacheKey (
155+ const newCacheKey = createTransformer ( ) . getCacheKey ! (
156156 sourceText ,
157157 sourcePath ,
158158 transformOptions ,
@@ -162,7 +162,7 @@ describe('getCacheKey', () => {
162162 } ) ;
163163
164164 test ( 'if `instrument` value is changing' , ( ) => {
165- const newCacheKey = getCacheKey ( sourceText , sourcePath , {
165+ const newCacheKey = getCacheKey ! ( sourceText , sourcePath , {
166166 ...transformOptions ,
167167 instrument : false ,
168168 } ) ;
@@ -173,24 +173,25 @@ describe('getCacheKey', () => {
173173 test ( 'if `process.env.NODE_ENV` value is changing' , ( ) => {
174174 process . env . NODE_ENV = 'NEW_NODE_ENV' ;
175175
176- const newCacheKey = getCacheKey ( sourceText , sourcePath , transformOptions ) ;
176+ const newCacheKey = getCacheKey ! ( sourceText , sourcePath , transformOptions ) ;
177177
178178 expect ( oldCacheKey ) . not . toEqual ( newCacheKey ) ;
179179 } ) ;
180180
181181 test ( 'if `process.env.BABEL_ENV` value is changing' , ( ) => {
182182 process . env . BABEL_ENV = 'NEW_BABEL_ENV' ;
183183
184- const newCacheKey = getCacheKey ( sourceText , sourcePath , transformOptions ) ;
184+ const newCacheKey = getCacheKey ! ( sourceText , sourcePath , transformOptions ) ;
185185
186186 expect ( oldCacheKey ) . not . toEqual ( newCacheKey ) ;
187187 } ) ;
188188
189189 test ( 'if node version is changing' , ( ) => {
190+ // @ts -expect-error: Testing purpose
190191 delete process . version ;
191192 process . version = 'new-node-version' ;
192193
193- const newCacheKey = getCacheKey ( sourceText , sourcePath , transformOptions ) ;
194+ const newCacheKey = getCacheKey ! ( sourceText , sourcePath , transformOptions ) ;
194195
195196 expect ( oldCacheKey ) . not . toEqual ( newCacheKey ) ;
196197 } ) ;
0 commit comments