Skip to content

Commit

Permalink
fix(transformer): allow transforming of .cts/.mts extensions. (kulshe…
Browse files Browse the repository at this point in the history
  • Loading branch information
smack0007 authored and Zachary Snow committed May 21, 2024
1 parent fa0dfd8 commit a31621f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export const LINE_FEED = '\n'
export const DECLARATION_TYPE_EXT = '.d.ts'
export const JS_JSX_EXTENSIONS = ['.js', '.jsx']
export const TS_TSX_REGEX = /\.m?tsx?$/
export const JS_JSX_REGEX = /\.m?jsx?$/
export const TS_TSX_REGEX = /\.[cm]?tsx?$/
export const JS_JSX_REGEX = /\.[cm]?jsx?$/
// `extensionsToTreatAsEsm` will throw error with `.mjs`
export const TS_EXT_TO_TREAT_AS_ESM = ['.ts', '.tsx', '.mts']
export const JS_EXT_TO_TREAT_AS_ESM = ['.jsx']
Expand Down
4 changes: 2 additions & 2 deletions src/legacy/ts-jest-transformer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ describe('TsJestTransformer', () => {
expect(process.env.TS_JEST).toBe('1')
})

test.each(['foo.ts', 'foo.tsx', 'foo.mts', 'foo.mtsx'])('should process ts/tsx file', (filePath) => {
test.each(['foo.ts', 'foo.tsx', 'foo.cts', 'foo.mts', 'foo.mtsx'])('should process ts/tsx file', (filePath) => {
const fileContent = 'const foo = 1'
const output = 'var foo = 1'
tr.getCacheKey(fileContent, filePath, baseTransformOptions)
Expand All @@ -345,7 +345,7 @@ describe('TsJestTransformer', () => {
})
})

test.each(['foo.js', 'foo.jsx', 'foo.mjs', 'foo.mjsx'])(
test.each(['foo.js', 'foo.jsx', 'foo.cjs', 'foo.mjs', 'foo.mjsx'])(
'should process js/jsx file with allowJs true',
(filePath) => {
const fileContent = 'const foo = 1'
Expand Down

0 comments on commit a31621f

Please sign in to comment.