Skip to content

Support *.ts files for node --test  #55078

Description

@ThePlenkov

What is the problem this feature will solve?

I would like to use tests using typescript, not js. Currently if I run node --test it finds nothing.

What is the feature you are proposing to solve the problem?

node --test would pick up also typescript files and execute them since typescript now is experimentally supported

What alternatives have you considered?

Of course tools like jest or vitest can do this out-of-the-box but I would really love to write native tests to have zero dependency on thridparty libraries, just pure node.

Activity

  1. added
    test_runnerIssues and PRs related to the test runner subsystem.
    strip-typesIssues and PRs related to TypeScript type stripping.
    on Sep 23, 2024
  2. moved this from Awaiting Triage to Triaged in Node.js feature requestson Sep 23, 2024
  3. avivkeller commented on Sep 23, 2024

    @avivkeller
    Member

    This is already supported via node --experimental-strip-types --test test.ts

  4. ThePlenkov commented on Sep 23, 2024

    @ThePlenkov
    Author

    @redyetidev correct, but it doesn't pick up *.test.ts files in the same way as it does for .js, cjs, mjs. as it is described here:

    https://nodejs.org/api/test.html#running-tests-from-the-command-line

    Can we --experimental-strip-types as a flag to add also ts, cts, mts files? Thanks!

  5. avivkeller commented on Sep 23, 2024

    @avivkeller
    Member

    Oh okay, that should a simple few-line fix.

    I'll fix this later today if no one does so before me

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

    feature requestIssues requesting new Node.js features.strip-typesIssues and PRs related to TypeScript type stripping.test_runnerIssues and PRs related to the test runner subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions