Jest: Unrecognized cli patterns for jest@beta

Created on 28 Nov 2018  路  17Comments  路  Source: facebook/jest

馃悰 Bug Report

Multiple users are reporting the following error when trying jest@beta:

Unrecognized CLI Parameters:

  Following options were not recognized:
  ["changed-files-with-ancestor", "clear-cache", "clear-mocks", "collect-coverage", "detect-leaks", "detect-open-handles", "error-on-deprecated", "find-related-tests", "force-exit", "last-commit", "list-tests", "log-heap-usage", "map-coverage", "no-stack-trace", "only-changed", "only-failures", "pass-with-no-tests", "reset-mocks", "reset-modules", "restore-mocks", "run-in-band", "run-tests-by-path", "show-config", "skip-filter", "test-location-in-results", "update-snapshot", "use-stderr", "watch-all", "notify-mode", "prettier-path"]

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

To Reproduce

I am unable to repro but the steps seem to be to install and run jest@beta

@onetom @SerhiiBilyk and @bcanseco all reported the same issue in https://github.com/facebook/jest/issues/7382

All 17 comments

Note that I tried to repro and tests passed:

I saw this issue at work, and it was a patch of yargs that did it (12.0.2 -> 12.0.4). Not sure if it's yargs or yargs-parser, though. Didn't dig into it

This diff fixed it for us:

commit a72963e95c5cad2cb8f49ca6cf318d9b92ff0bec
Author: Simen Bekkhus <[email protected]>
Date:   2018-11-19 10:13:31 +0100

    chore: rollback yargs upgrade that broke Jest

diff --git a/yarn.lock b/yarn.lock
index e48ba1fc..a82399a0 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7112,7 +7112,7 @@ debug@^3.0.1, debug@^3.1.0, debug@^3.2.5:
   dependencies:
     ms "^2.1.1"

-decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2, decamelize@^1.2.0:
+decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2:
   version "1.2.0"
   resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
   integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=
@@ -20691,14 +20691,6 @@ yargs-parser@^10.1.0:
   dependencies:
     camelcase "^4.1.0"

-yargs-parser@^11.1.0:
-  version "11.1.0"
-  resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-11.1.0.tgz#0b8104116367bf663089b24e5801438ab50396a3"
-  integrity sha512-lGA5HsbjkpCfekDBHAhgE5OE8xEoqiUDylowr+BvhRCwG1xVYTsd8hx2CYC0NY4k9RIgJeybFTG2EZW4P2aN1w==
-  dependencies:
-    camelcase "^5.0.0"
-    decamelize "^1.2.0"
-
 yargs-parser@^7.0.0:
   version "7.0.0"
   resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-7.0.0.tgz#8d0ac42f16ea55debd332caf4c4038b3e3f5dfd9"
@@ -20706,7 +20698,7 @@ yargs-parser@^7.0.0:
   dependencies:
     camelcase "^4.1.0"

[email protected]:
[email protected], yargs@^12.0.1, yargs@^12.0.2:
   version "12.0.2"
   resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.2.tgz#fe58234369392af33ecbef53819171eff0f5aadc"
   integrity sha512-e7SkEx6N6SIZ5c5H22RTZae61qtn3PYUE8JYbBFlK9sYmh3DMQ6E5ygtaG/2BW0JZi4WGgTR2IV5ChqlqrDGVQ==
@@ -20724,24 +20716,6 @@ [email protected]:
     y18n "^3.2.1 || ^4.0.0"
     yargs-parser "^10.1.0"

-yargs@^12.0.1, yargs@^12.0.2:
-  version "12.0.4"
-  resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.4.tgz#5ea307c6f11f11881c3bc375f9c939194e8cf4bc"
-  integrity sha512-f5esswlPO351AnejaO2A1ZZr0zesz19RehQKwiRDqWtrraWrJy16tsUIKgDXFMVytvNOHPVmTiaTh3wO67I0fQ==
-  dependencies:
-    cliui "^4.0.0"
-    decamelize "^1.2.0"
-    find-up "^3.0.0"
-    get-caller-file "^1.0.1"
-    os-locale "^3.0.0"
-    require-directory "^2.1.1"
-    require-main-filename "^1.0.1"
-    set-blocking "^2.0.0"
-    string-width "^2.0.0"
-    which-module "^2.0.0"
-    y18n "^3.2.1 || ^4.0.0"
-    yargs-parser "^11.1.0"
-
 yargs@^3.10.0:
   version "3.32.0"
   resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.32.0.tgz#03088e9ebf9e756b69751611d2a5ef591482c995"

Got it, I'll take a deeper look

Nope :(

image

seeing this too, appears to happen consistently when providing varaduc arguments... for ex: jest --coverageReporters json html

@SimenB @rickhanlonii scratch that...found what's causing this - looks like introduced as a breaking change in yargs-parser: https://github.com/yargs/yargs-parser/pull/125/files#diff-168726dbe96b3ce427e7fedce31bb0bcR658

I think jest has one of 3 options to fix this:

A: Roll back to [email protected]. Since, the break was introduced in following release.
B: Should jest adopt this change? Aka... support both --foo-bar & --fooBar arg formats?
C: Filter out the --dashed-args before validate? (eww)

We should have B, but the object we get back from yargs should only have the camelCase ones, so we don't have multiple sources of truth

Great find @hulkish - was that fix released in a patch?

@rickhanlonii no, i think jest upgraded to the major version but maybe missed this change

@SimenB @rickhanlonii ok my attempt at B is up: https://github.com/facebook/jest/pull/7497

was that fix released in a patch?

It was released in a patch version of yargs: 12.0.3 to be exact: https://github.com/yargs/yargs/compare/v12.0.2..v12.0.3#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R32

That's a bummer, looks like @hulkish put in a fix though, thanks a ton!!

Any news on this?

It was fixed more than 7 months ago

Was this page helpful?
0 / 5 - 0 ratings