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

testRegex not detecting .coffee files #1707

Closed
jeremyhcho opened this issue Sep 15, 2016 · 4 comments
Closed

testRegex not detecting .coffee files #1707

jeremyhcho opened this issue Sep 15, 2016 · 4 comments

Comments

@jeremyhcho
Copy link

Hey Jest team,

Running into an issue with getting Jest and Coffeescript to work together. I'm not sure if I have everything set up perfectly, but it looks like the testRegex field isn't detecting .coffee files. Here's what I have so far: https://github.com/hyungccho/jest-coffeescript-bug.

Steps to reproduce:

  • npm install
  • npm test
  • See that sample-test.js is being detected while sample-test.coffee isn't.

Other notes:

If I remove js from the regex, this is what I see:

No tests found
  3 files checked.
  testPathDirs: /Users/hyungcho/Desktop/hyfn/projects/jest-coffeescript-bug - 3 matches
  testRegex: (/__tests__/.*|\.(test|spec))\.(coffee)$ - 0 matches
  testPathIgnorePatterns: /node_modules/ - 3 matches

testRegex seems to be correctly formatted, and I definitely do have a .coffee test file inside __tests__, but it doesn't read it.

Node: v6.2.2
NPM: v3.9.5
OS: OSX El Capitan v10.11.1

@cpojer
Copy link
Member

cpojer commented Sep 15, 2016

Please also add coffee to moduleFileExtensions. Jest only looks at files with this extension and then testRegex is used to narrow down the files.

@cpojer cpojer closed this as completed Sep 15, 2016
@jeremyhcho
Copy link
Author

@cpojer Thanks for the quick response!

@mirismaili
Copy link

mirismaili commented May 22, 2019

I also had the same issue with .js.flow files. So added moduleFileExtensions: ["js", "flow"] and the problem solved. Thanks.

This was referenced Nov 17, 2020
@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 May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants