Jest: Jest v26 is failing when run without cli options

Created on 10 May 2020  ·  12Comments  ·  Source: facebook/jest

🐛 Bug Report

When running the jest without cli options, it's failing.

receiving following message in console

> jest

● Unrecognized CLI Parameters:

  Following options were not recognized:
  ["run-in-band", "test-location-in-results"]

  CLI Options Documentation:
  https://jestjs.io/docs/en/cli.html

npm ERR! Test failed.  See above for more details.

Problem is with version 26.0.1 (and 26.0.0). Same scenario is working with version 25.5.4.

To Reproduce

Followed the docs of jest. https://jestjs.io/docs/en/getting-started

Expected behavior

When no option is set, it is expected to run all tests.

Link to repl or repo (highly encouraged)

https://github.com/basarbk/jest-without-params-fail

envinfo

System:
OS: Windows 10 10.0.10240
CPU: (4) x64 Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz
Binaries:
Node: 12.13.1 - C:Program Filesnodejsnode.EXE
npm: 6.13.1 - C:Program Filesnodejsnpm.CMD
npmPackages:
jest: ^26.0.1 => 26.0.1

Bug Report Needs Repro Needs Triage

Most helpful comment

I've experienced same.
Problems is with host locale and camelcase dependency.
validateCLIOptions method in jest-validate\build\validateCLIOptions.js calls camelcase for each argv and tries to match them with allowed options. (see [this] line)(https://github.com/facebook/jest/blob/63ebaa6e3848ddf228b1acc6f870c7eaca34e46c/packages/jest-validate/src/validateCLIOptions.ts#L81)
When it calls camelcase for arg run-in-band, camelcase returns runİnBand (capital 'i' in Turkish) if host has 'tr-TR' locale. And runİnBand is not one of allowed options (although runInBand is).

Workaround for Win10: Settings > Region & Language > Adminstrative language settings > Formats.
Set Format to English (United States). That changes locale of node to en-US.

I guess proper solution would be camelcase providing locale option and jest-validate just provides en-US as locale.

All 12 comments

Cannot repro. Run yarn test or npm run test and see it works. If you have global jest installed, please remove it, it's supposed to be installed locally per-project.

I cannot reproduce this

image

I don't have jest globally installed. It's just installed locally for this project. But it's interesting that it's only occuring in my machine. will look into it to figure out if I'm missing something.

Maybe you have an alias set up?

No i don't have any alias matching to jest. The thing is if i replace 26.0.1 with 25.5.4, npm install --save-dev [email protected] and then run npm test again, it's working. So that's why I suspected something changed between these versions.

I don't have access to a windows machine, so I can't test there. We do run many tests on CI with Windows though, so I don't think it's as simple as that

I tested this on another windows machine and it's working there. So the problem must be about my environment. If I find the reason, I'll post it here. Thank you for your time.

image
I am experiencing same issue. I have created empty folder (no js files and other stuff) to verify that's not because of another something

Well I had to make a little change at built js files:
From:
test1
To:
test2
I couldn't find where are the args. coming from but I think they are from yarn(I didn't even install yarn so I don't know). But hey! At least it works very well :D

I had confirmed the problem was about my environment. But couldn't find the reason of it. Now my windows is reinstalled and I no longer see this issue. Previously I had jest globally installed then removed. Maybe that was causing the problem. Or maybe it was something about the caching of npm.

I've experienced same.
Problems is with host locale and camelcase dependency.
validateCLIOptions method in jest-validate\build\validateCLIOptions.js calls camelcase for each argv and tries to match them with allowed options. (see [this] line)(https://github.com/facebook/jest/blob/63ebaa6e3848ddf228b1acc6f870c7eaca34e46c/packages/jest-validate/src/validateCLIOptions.ts#L81)
When it calls camelcase for arg run-in-band, camelcase returns runİnBand (capital 'i' in Turkish) if host has 'tr-TR' locale. And runİnBand is not one of allowed options (although runInBand is).

Workaround for Win10: Settings > Region & Language > Adminstrative language settings > Formats.
Set Format to English (United States). That changes locale of node to en-US.

I guess proper solution would be camelcase providing locale option and jest-validate just provides en-US as locale.

Just created an issue in camelcase project as well.

Was this page helpful?
0 / 5 - 0 ratings