jest: Jest v26 is failing when run without cli options

šŸ› 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Ā® Coreā„¢ i5-6300U CPU @ 2.40GHz Binaries: Node: 12.13.1 - C:\Program Files\nodejs\node.EXE npm: 6.13.1 - C:\Program Files\nodejs\npm.CMD npmPackages: jest: ^26.0.1 => 26.0.1

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (7 by maintainers)

Commits related to this issue

Most upvoted comments

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.

In package.json, adding --runInBand option is also a legit workaround for the time being. Adding that, the options wonā€™t be added behind the scene, and there will be no Turkish char problem:

/*package.json*/
"scripts": {
  "test": "jest --runInBand"
}

But expect a longer time to complete as it runs tests one by one

Thanks @rasgele you have solved my problem as well just by changing some region settings. Ä°yi gĆ¼nler! šŸ˜ƒ

I changed my language and it worked for me. sad but true.

Just created an issue in camelcase project as well.

seems like we should pass locale to camelcase - anyone up for sending a PR?

Adding the locale environment to test script works. You can update your test command in package.json

"scripts": {
    "test": "LANG='en_US.UTF-8' jest"
  }

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 šŸ˜„

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