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

Specify a single test file to run with Jest #1696

Closed
thangngoc89 opened this issue Sep 14, 2016 · 3 comments
Closed

Specify a single test file to run with Jest #1696

thangngoc89 opened this issue Sep 14, 2016 · 3 comments

Comments

@thangngoc89
Copy link

thangngoc89 commented Sep 14, 2016

Do you want to request a feature or report a bug?

This is a feature request

What is the current behavior?
I can't specify a single test file to run with Jest

What is the expected behavior?
I'm migrating test files from AVA to Jest and with AVA I can do this ava path/to/test/file.js. It's pretty handy when you run integration test after a build.

I'll try to explain my situation here and maybe you can help me with a work around.

I have integration test in

__tests__/*.js

My unit tests are in

src/**/__tests__/*.js

My current Jest setup in package.json (I filtered out the non-relevant part)

"jest": {
    "preprocessorIgnorePatterns": [
      "node_modules"
    ],
    "testPathDirs": [
      "src"
    ],
  }

Do you have any workaround that I can use to run integration tests without running unit tests?


Update

I renamed my integration tests folder to integration-tests. After reading some Jest's test file, I find out that I can pass a testRegex like to from CLI:

jest --config '{"testRegex": "integration-tests"}'

Writing JSON is always tedious. Do you guys thing this should be improve? Should testRegex be a CLI flag?

@aaronabramov
Copy link
Contributor

hey @thangngoc89!
you can pass a testRegex directly to cli

jest integration-tests should just work!

@thangngoc89
Copy link
Author

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 14, 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

2 participants