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

Ability to pass a path to a specific test file you want to run #5735

Closed
agjs opened this issue Mar 6, 2018 · 10 comments
Closed

Ability to pass a path to a specific test file you want to run #5735

agjs opened this issue Mar 6, 2018 · 10 comments

Comments

@agjs
Copy link

agjs commented Mar 6, 2018

I'd be willing to do the PR for this one and make it work. I'm mind blown that the entire library is based on regular expressions when it comes to resolving paths. I'm not really sure who made those decisions and why but not being able to pass a relative path to the file you want to run is mind-blowing.

@rickhanlonii
Copy link
Member

@agjs sorry to hear about your mind exploding

You can pass the path to the file you want to test as long as your configured matchers allow for it. We tried allowing it to skip the matchers and it didn't work out. See here and the related links for more info

@agjs
Copy link
Author

agjs commented Mar 6, 2018

So your solution is to close the thread with "We failed to make it work so no one will"?

Amazing.

@thymikee thymikee reopened this Mar 6, 2018
@thymikee
Copy link
Collaborator

thymikee commented Mar 6, 2018

I think this is just a lack of feature. @rickhanlonii could close this issue just because it doesn't conform to provided issue template, so don't blame him ;)

I'll tag it as a feature request. Please provide how would you like this to work, e.g.:

jest --testPath ../my/path

@agjs
Copy link
Author

agjs commented Mar 6, 2018

Hi and thanks for reopening this.

CLI should work more or less just like any other test runner, mocha or similar. Your little example demonstrates how it should work.

One should simply be able to provide a path to a file and run that specific test. This shouldn't involve any pattern-matching but simply read the file path and execute that specific file.

@rickhanlonii
Copy link
Member

My bad, @agjs! I assumed you were asking to do this without an extra CLI arg

For more context, we added support for this without an arg in #3882, and decided to roll back in #5544 and #5582, since we decided that Jest should never run tests that are excluded through the config

@agjs
Copy link
Author

agjs commented Mar 8, 2018

I never said that that running a test by a filePath should exclude a config file. You can still pass a config file via --config flag. What I said is, it would be nice to provide a full path to a file that I want to run, without recursively running through every single folder looking for the string to match.

@naguibihab
Copy link

Are there any updates on this?

@scotthovestadt
Copy link
Contributor

If you want to pass file paths in instead of pattern matching (for programmatic runs or similar), there is:
https://jestjs.io/docs/en/cli#runtestsbypath

Not sure I'm seeing the point of this feature request, but maybe I'm missing something?

@SimenB
Copy link
Member

SimenB commented Apr 30, 2019

--runTestsByPath covers the feature request I think. It was undocumented at the time this issue was opened, which might be why OP didn't know about it?

@SimenB SimenB closed this as completed Apr 30, 2019
@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.
Projects
None yet
Development

No branches or pull requests

6 participants