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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

jest --watch fails with ambiguous argument #10149

Closed
ghost opened this issue Jun 9, 2020 · 3 comments 路 Fixed by #11160
Closed

jest --watch fails with ambiguous argument #10149

ghost opened this issue Jun 9, 2020 · 3 comments 路 Fixed by #11160

Comments

@ghost
Copy link

ghost commented Jun 9, 2020

馃悰 Bug Report

Jest watch fails when used in a git monorepo containing a sub-project named ui - and a default branch called ui.

jest --watch fails with:

fatal: ambiguous argument 'ui': both revision and filename
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

To Reproduce

Check out the monorepo and run npx jest --watch

Expected behavior

Jest should start watching the files. Instead, it appears that the 'jest-changed-files' tool does not handle cases where the default branch and test root have the same name.

If I run git diff commands from the ui folder it is fine - so it's possible that a cwd before running git commands might fix it?

Link to repl or repo (highly encouraged)

https://github.com/nicthemighty/jest-watch

envinfo

System:
    OS: macOS 10.15.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
  Binaries:
    Node: 10.18.1 - ~/.nvm/versions/node/v10.18.1/bin/node
    Yarn: 1.21.1 - ~/.nvm/versions/node/v10.18.1/bin/yarn
    npm: 6.13.6 - ~/.nvm/versions/node/v10.18.1/bin/npm
  npmPackages:
    jest: ^26.0.1 => 26.0.1
@ghost ghost changed the title --watch fails with ambiguous argument jest --watch fails with ambiguous argument Jun 9, 2020
@carnesen
Copy link

carnesen commented Jul 3, 2020

I encountered this error too. In my case, the branch with the same name as the subdirectory was not my default branch and deleting the branch worked around the issue.

@yokomotod
Copy link
Contributor

I faced same issue and made PR that adds '--' to separate paths from revisions according to git.

@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 10, 2021
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.

2 participants