Skip to content

[Bug]: Default transform regex does not escape dot properly #4579

Closed
@nikwen

Description

@nikwen

Version

29.7.0

Steps to reproduce

  1. npm i -D jest typescript ts-jest @types/jest
  2. npx ts-jest config:init

Expected behavior

Regex in jest.config.js escapes dot properly, e.g. '^.+\\.tsx?$'.

Actual behavior

Regex is not escaped properly: '^.+.tsx?$'

Regexes are defined here:

export const TS_TRANSFORM_PATTERN = '^.+.tsx?$'
export const ESM_TS_TRANSFORM_PATTERN = '^.+\\.m?tsx?$'
export const TS_JS_TRANSFORM_PATTERN = '^.+.[tj]sx?$'
export const ESM_TS_JS_TRANSFORM_PATTERN = '^.+\\.m?[tj]sx?$'
export const JS_TRANSFORM_PATTERN = '^.+.jsx?$'
export const ESM_JS_TRANSFORM_PATTERN = '^.+\\.m?jsx?$'

Debug log

Irrelevant for this issue

Additional context

No response

Environment

System:
    OS: macOS 14.7
    CPU: (8) arm64 Apple M1
  Binaries:
    Node: 20.16.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 10.8.1 - /usr/local/bin/npm
  npmPackages:
    jest: 29.7.0 => 29.7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions