jest --watch fails with ambiguous argument

Created on 9 Jun 2020  路  1Comment  路  Source: facebook/jest

馃悰 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
Bug Report Needs Repro Needs Triage

Most helpful comment

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.

>All comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

StephanBijzitter picture StephanBijzitter  路  3Comments

jardakotesovec picture jardakotesovec  路  3Comments

kentor picture kentor  路  3Comments

ianp picture ianp  路  3Comments

nsand picture nsand  路  3Comments