Skip to content

TypeScript Jest reporter loads successfully on Node v22.22.x but fails on v22.13.0 with "Unexpected token ':'" #66258

Description

@kyrillosisaac2

Version

22.13.0

Platform

Ubuntu 22.04.5 LTS (x86_64)

Subsystem

No response

What steps will reproduce the bug?

A Jest custom reporter is referenced directly as a .ts file:
 

reporters: [
'<repo-root>/tests/src/reporters/log-on-failure.reporter.ts',
'default',
]

### How often does it reproduce? Is there a required condition?

Always on the affected environment.

Required conditions:

- Node.js v22.13.0
- Ubuntu 22.04.5 LTS (x86_64)
- A Jest custom reporter referenced directly as a `.ts` file
- The reporter contains TypeScript syntax such as type annotations (`: string`)
- The reporter is loaded through Jest/Node without an explicit TypeScript loader

Observed behavior:

- Reproduces consistently on every run on Node.js v22.13.0
- Does not reproduce on a separate macOS Apple Silicon machine running Node.js v22.22.x using the same repository, branch, and reporter source

Example command:

```bash
pnpm run test:infra

### What is the expected behavior? Why is that the expected behavior?

When this scenario is not supported on the current Node.js version, Node.js should provide a more actionable error message that helps developers identify the root cause and potential resolution.

Instead of only reporting:

```text
SyntaxError: Unexpected token ':'

### What do you see instead?

```text
SyntaxError: Unexpected token ':'

### Additional information

_No response_

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions