Skip to content

[Bug]: Stripping types is currently unsupported for files under node_modules #461

@colinaaa

Description

@colinaaa

Version

System:
    OS: Linux 5.15 veLinux GNU/Linux 2 (lyra) 2 (lyra)
    CPU: (64) x64 Intel(R) Xeon(R) Platinum 8457C
    Memory: 246.59 GB / 251.61 GB
    Container: Yes
    Shell: 5.2.15 - /bin/bash
  Binaries:
    Node: 22.18.0 - /run/user/1001/fnm_multishells/3890718_1754797642501/bin/node
    npm: 10.9.3 - /run/user/1001/fnm_multishells/3890718_1754797642501/bin/npm
    pnpm: 10.14.0 - /run/user/1001/fnm_multishells/3890718_1754797642501/bin/pnpm
  npmPackages:
    @rstest/core: ^0.1.3 => 0.1.3

Details

When using a .ts file from node_modules, Rstest would have this error.

I think the error message came from Node.js type stripping, which is enabled by default in v22.18.0.

If switch Node.js to < v22.18, the error message become

Unknown file extension ".ts"

It seems that Rstest is not transforming .ts files in node_modules by default (which is the default behavior for source.include of Rsbuild). But setting source.include to [/node_modules/] does not work either.

Reproduce link

https://github.com/colinaaa/rsbuild-plugin-arethetypeswrong

Reproduce Steps

  1. pnpm add -D @rstest/core
  2. Replace vitest with @rstest/core (and vi to rs, too)
  3. Run npx rstest

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions