Skip to content

Commit a791b9d

Browse files
authored
fix(jest): update test regex and return type (#959)
1 parent 57d81bf commit a791b9d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/jest/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,16 @@ function getJestTransformConfig(jestConfig: JestConfig26 | JestConfig27): Option
2828
const defaultTsConfig = readDefaultTsConfig()
2929

3030
export = {
31-
process(src: string, path: string, jestConfig: JestConfig26 | JestConfig27): Output | string {
32-
if (/\.(tsx?|jsx?|mjs)$/.test(path)) {
31+
process(src: string, path: string, jestConfig: JestConfig26 | JestConfig27): Output {
32+
if (/\.[cm]?[jt]sx?$/.test(path)) {
3333
return transformJest(src, path, {
3434
...tsCompilerOptionsToSwcConfig(defaultTsConfig, path),
3535
...getJestTransformConfig(jestConfig),
3636
})
3737
}
38-
return src
38+
39+
// Since Jest 28, "process" no longer accepts a string output.
40+
return { code: src }
3941
},
4042
getCacheKey(src: string, _filepath: string, config: Options) {
4143
return xxh64(src + JSON.stringify(config)).toString(16)

0 commit comments

Comments
 (0)