question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

Jest v26 is failing when run without cli options

See original GitHub issue

šŸ› 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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:20 (3 by maintainers)

github_iconTop GitHub Comments

42reactions
rasgelecommented, Jul 18, 2020

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.

5reactions
vahdetcommented, Apr 22, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest CLI Options
The jest command line runner has a number of useful options. You can run jest --help to view all available options. Many of...
Read more >
Jest tests run through CLI but fail through Visual Studio 2019 ...
Since Jest runs without problems from the command line, this means there is something different when the tests a re run through Visual...
Read more >
jest-preset-angular - npm
Jest doesn't run in browser nor through dev server. It uses jsdom to abstract browser environment. So we have to cheat a little...
Read more >
How I Fixed The Unexpected Token Error In Jest
Not one bit. The "issue" is that Jest only wants to process CommonJS-style code. So for the Jest tests to run, it first...
Read more >
Stencil: Jest 27 Upgrade Instructions - Ionic Blog
Next, upgrade Jest. The command below assumes your project uses Jest v26. If you're using an older version of Jest, it's recommended that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found