Skip to content

Commit 80d3e4d

Browse files
committed
fix: escape dot for TS_TRANSFORM_PATTERN regex
Fixes #4579
1 parent 4811d42 commit 80d3e4d

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

src/cli/__snapshots__/cli.spec.ts.snap

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ exports[`config init should create a jest config file with cli options for confi
55
module.exports = {
66
testEnvironment: "node",
77
transform: {
8-
"^.+.tsx?$": ["ts-jest",{}],
8+
"^.+\\.tsx?$": ["ts-jest",{}],
99
},
1010
};"
1111
`;
@@ -15,7 +15,7 @@ exports[`config init should create a jest config file with cli options for confi
1515
export default {
1616
testEnvironment: "node",
1717
transform: {
18-
"^.+.tsx?$": ["ts-jest",{}],
18+
"^.+\\.tsx?$": ["ts-jest",{}],
1919
},
2020
};"
2121
`;
@@ -66,7 +66,7 @@ exports[`config init should update package.json for config type default when use
6666
"version": "0.0.0-mock.0",
6767
"jest": {
6868
"transform": {
69-
"^.+.tsx?$": [
69+
"^.+\\\\.tsx?$": [
7070
"ts-jest",
7171
{}
7272
]
@@ -82,7 +82,7 @@ exports[`config init should update package.json for config type js-with-babel-fu
8282
"jest": {
8383
"transform": {
8484
"^.+.jsx?$": "babel-jest",
85-
"^.+.tsx?$": [
85+
"^.+\\\\.tsx?$": [
8686
"ts-jest",
8787
{
8888
"tsconfig": "tsconfig.test.json"
@@ -114,7 +114,7 @@ exports[`config migrate should generate transform config with existing transform
114114
"module.exports = {
115115
transform: {
116116
'^.+.jsx?$': 'babel-jest',
117-
'^.+.tsx?$': [
117+
'^.+\\\\.tsx?$': [
118118
'ts-jest',
119119
{},
120120
],
@@ -130,7 +130,7 @@ exports[`config migrate should generate transform config with existing transform
130130
'ts-jest',
131131
{},
132132
],
133-
'^.+.tsx?$': [
133+
'^.+\\\\.tsx?$': [
134134
'ts-jest',
135135
{},
136136
],
@@ -142,7 +142,7 @@ exports[`config migrate should generate transform config with existing transform
142142
exports[`config migrate should migrate preset if valid preset value is used 1`] = `
143143
""jest": {
144144
"transform": {
145-
"^.+.tsx?$": [
145+
"^.+\\\\.tsx?$": [
146146
"ts-jest",
147147
{}
148148
]
@@ -154,7 +154,7 @@ exports[`config migrate should migrate preset if valid preset value is used 1`]
154154
exports[`config migrate should migrate preset if valid preset value is used 2`] = `
155155
""jest": {
156156
"transform": {
157-
"^.+.tsx?$": [
157+
"^.+\\\\.tsx?$": [
158158
"ts-jest",
159159
{}
160160
]
@@ -166,7 +166,7 @@ exports[`config migrate should migrate preset if valid preset value is used 2`]
166166
exports[`config migrate should migrate preset if valid preset value is used 3`] = `
167167
""jest": {
168168
"transform": {
169-
"^.+.tsx?$": [
169+
"^.+\\\\.tsx?$": [
170170
"ts-jest",
171171
{}
172172
]
@@ -179,7 +179,7 @@ exports[`config migrate should reset testMatch if testRegex is used 1`] = `
179179
""jest": {
180180
"testRegex": "foo-pattern",
181181
"transform": {
182-
"^.+.tsx?$": [
182+
"^.+\\\\.tsx?$": [
183183
"ts-jest",
184184
{}
185185
]
@@ -194,7 +194,7 @@ exports[`config migrate should reset testMatch if testRegex is used 2`] = `
194194
"foo-pattern"
195195
],
196196
"transform": {
197-
"^.+.tsx?$": [
197+
"^.+\\\\.tsx?$": [
198198
"ts-jest",
199199
{}
200200
]
@@ -210,7 +210,7 @@ exports[`config migrate should reset testMatch if testRegex is used 3`] = `
210210
"**/__tests__/**/*.(spec|test).[tj]s?(x)"
211211
],
212212
"transform": {
213-
"^.+.tsx?$": [
213+
"^.+\\\\.tsx?$": [
214214
"ts-jest",
215215
{}
216216
]
@@ -225,7 +225,7 @@ exports[`config migrate should reset testMatch if testRegex is used 4`] = `
225225
"**/__tests__/**/*.(spec|test).[tj]s?(x)"
226226
],
227227
"transform": {
228-
"^.+.tsx?$": [
228+
"^.+\\\\.tsx?$": [
229229
"ts-jest",
230230
{}
231231
]
@@ -238,7 +238,7 @@ exports[`config migrate should reset testMatch if testRegex is used 5`] = `
238238
""jest": {
239239
"testRegex": "foo-pattern",
240240
"transform": {
241-
"^.+.tsx?$": [
241+
"^.+\\\\.tsx?$": [
242242
"ts-jest",
243243
{}
244244
]

src/cli/cli.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ describe('config', () => {
285285
",
286286
"stdout": ""jest": {
287287
"transform": {
288-
"^.+.tsx?$": [
288+
"^.+\\\\.tsx?$": [
289289
"ts-jest",
290290
{
291291
"tsconfig": {
@@ -386,7 +386,7 @@ describe('config', () => {
386386
"**/__tests__/**/*.ts?(x)"
387387
],
388388
"transform": {
389-
"^.+.tsx?$": [
389+
"^.+\\\\.tsx?$": [
390390
"ts-jest",
391391
{
392392
"tsconfig": {
@@ -475,7 +475,7 @@ describe('config', () => {
475475
expect(res.stdout).toMatchInlineSnapshot(`
476476
"module.exports = {
477477
transform: {
478-
'^.+.tsx?$': [
478+
'^.+\\\\.tsx?$': [
479479
'ts-jest',
480480
{},
481481
],
@@ -556,7 +556,7 @@ describe('config', () => {
556556
'ts-jest',
557557
{},
558558
],
559-
'^.+.tsx?$': [
559+
'^.+\\\\.tsx?$': [
560560
'ts-jest',
561561
{},
562562
],
@@ -600,7 +600,7 @@ describe('config', () => {
600600
"ts-jest",
601601
{}
602602
],
603-
"^.+.tsx?$": [
603+
"^.+\\\\.tsx?$": [
604604
"ts-jest",
605605
{}
606606
]

src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export const DECLARATION_TYPE_EXT = '.d.ts'
33
export const JS_JSX_EXTENSIONS = ['.js', '.jsx']
44
export const TS_TSX_REGEX = /\.[cm]?tsx?$/
55
export const JS_JSX_REGEX = /\.[cm]?jsx?$/
6-
export const TS_TRANSFORM_PATTERN = '^.+.tsx?$'
6+
export const TS_TRANSFORM_PATTERN = '^.+\\.tsx?$'
77
export const ESM_TS_TRANSFORM_PATTERN = '^.+\\.m?tsx?$'
88
export const TS_JS_TRANSFORM_PATTERN = '^.+.[tj]sx?$'
99
export const ESM_TS_JS_TRANSFORM_PATTERN = '^.+\\.m?[tj]sx?$'

src/presets/__snapshots__/create-jest-preset.spec.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
exports[`create-jest-preset CJS presets createDefaultLegacyPreset should return preset config 1`] = `
44
{
55
"transform": {
6-
"^.+.tsx?$": [
6+
"^.+\\.tsx?$": [
77
"ts-jest",
88
{
99
"tsconfig": "tsconfig.spec.json",
@@ -16,7 +16,7 @@ exports[`create-jest-preset CJS presets createDefaultLegacyPreset should return
1616
exports[`create-jest-preset CJS presets createDefaultPreset should return preset config 1`] = `
1717
{
1818
"transform": {
19-
"^.+.tsx?$": [
19+
"^.+\\.tsx?$": [
2020
"ts-jest",
2121
{
2222
"tsconfig": "tsconfig.spec.json",
@@ -30,7 +30,7 @@ exports[`create-jest-preset CJS presets createJsWithBabelLegacyPreset should ret
3030
{
3131
"transform": {
3232
"^.+.jsx?$": "babel-jest",
33-
"^.+.tsx?$": [
33+
"^.+\\.tsx?$": [
3434
"ts-jest/legacy",
3535
{
3636
"babelConfig": {
@@ -47,7 +47,7 @@ exports[`create-jest-preset CJS presets createJsWithBabelPreset should return pr
4747
{
4848
"transform": {
4949
"^.+.jsx?$": "babel-jest",
50-
"^.+.tsx?$": [
50+
"^.+\\.tsx?$": [
5151
"ts-jest",
5252
{
5353
"babelConfig": {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy