Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Support {m,c}{j,t}s file extensions for tests and modules #14149

Closed
nickserv opened this issue May 17, 2023 · 10 comments · Fixed by #14369
Closed

[Bug]: Support {m,c}{j,t}s file extensions for tests and modules #14149

nickserv opened this issue May 17, 2023 · 10 comments · Fixed by #14369

Comments

@nickserv
Copy link
Contributor

nickserv commented May 17, 2023

Version

29.5.0

Steps to reproduce

  1. Clone https://gist.github.com/nickmccurdy/c8f81c3f7c3587a15199ebcf151ed555
  2. npm install-test

Expected behavior

Jest runs all tests.

Actual behavior

Jest only runs tests with extensions:

  • js
  • jsx
  • ts
  • tsx

Jest doesn't run tests with extensions:

  • mjs
  • cjs
  • mts
  • cts

Additional context

  • All of these extensions are missing from testMatch and testRegex.
  • mts and mts are missing from moduleFileExtensions.
  • All of these extensions are supposed by VSCode and Vitest.

Environment

System:
    OS: macOS 12.6.5
    CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
  Binaries:
    Node: 20.1.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.6.6 - /usr/local/bin/npm
  npmPackages:
    jest: 29.5.0 => 29.5.0
@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Jun 16, 2023
@nickserv
Copy link
Contributor Author

This is still an issue.

@github-actions github-actions bot removed the Stale label Jun 16, 2023
@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Jul 17, 2023
@nickserv
Copy link
Contributor Author

This is still an issue.

@github-actions github-actions bot removed the Stale label Jul 17, 2023
@mrazauskas
Copy link
Contributor

mrazauskas commented Jul 17, 2023

I think it would be fine to add cts and mts to moduleFileExtensions. This looks similar to cjs and mjs being added in #12578. Note that this is a breaking change.

Not sure about testMatch and testRegex. Actually, why not? ;D But that should be a separate PR and it is a breaking change too.

@yinm
Copy link
Contributor

yinm commented Jul 22, 2023

Can I try to fix it?

@mrazauskas
Copy link
Contributor

Sure. As I mentioned, these are breaking changes, so PRs can only land with the next major release. It is fine to open them now, of course.

@yinm
Copy link
Contributor

yinm commented Sep 20, 2023

Probably, this issue needs to be open.
#14369 only solved the following problem (one of Additional context).

mts and mts are missing from moduleFileExtensions.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 21, 2023
@SimenB
Copy link
Member

SimenB commented Oct 30, 2023

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants