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 committed Jan 26, 2023
1 parent a67aefd commit 005ef56
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 @@ -376,7 +376,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 @@ -391,7 +391,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 005ef56

Please sign in to comment.