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.

Unknown option "detectOpenHandles" with value true was found.

See original GitHub issue

šŸ› Bug Report

I’m trying to add detectOpenHandles from the CLI to package.json config for jest but getting this validation warning:

ā— Validation Warning:

  Unknown option "detectOpenHandles" with value true was found.
  This is probably a typing mistake. Fixing it will remove this message.

  Configuration Documentation:
  https://jestjs.io/docs/configuration.html

To Reproduce

This is my jest config in package.json:

  "jest": {
    "testTimeout": 30000,
    "restoreMocks": true,
    "forceExit": true,
    "detectOpenHandles": true,
    "silent": true
  },

I don’t get warnings on any of those other options even though others like forceExit and silent are not in the configuration guide:

https://jestjs.io/docs/en/configuration

Meaning, I assumed that detectOpenHandles not being in the configuration guide was just a docs issue and that anything in the CLI guide can be used as config options but CLI overrides them as noted here:

https://jestjs.io/docs/en/cli#options

Note: CLI options take precedence over values from the Configuration.

Expected behavior

I expect to be able to specify the CLI options as config options. Note that the CLI docs say:

Every one of Jest’s Configuration options can also be specified through the CLI.

So I assumed that goes both ways.

Link to repl or repo (highly encouraged)

This should be pretty easy to reproduce assuming the warning isn’t due to some misconfiguration on my part.

envinfo

$ npx envinfo --preset jest
npx: installed 1 in 0.812s

  System:
    OS: Linux 5.3 Ubuntu 18.04.3 LTS (Bionic Beaver)
    CPU: (8) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  Binaries:
    Node: 13.5.0 - /usr/bin/node
    npm: 6.13.4 - /usr/bin/npm
  npmPackages:
    jest: ^24.9.0 => 24.9.0 

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:9
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
dav1appcommented, Aug 10, 2021

Same here

0reactions
jamesBennettcommented, Mar 10, 2021

Same issue with detectLeaks. Why would you put it in the import { config } = @types/jest/ if it’s not actually available…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Incorrect version of jest trying to run jest - Stack Overflow
I had a look at jest -h and found a flag which gives me the setup of the jest environment. jest --showConfig. This...
Read more >
Configuring package.json Ā· Jest
Jest's configuration can be defined in the package.json file of your project or through the --config <path/to/json> option.
Read more >
jest-validate | Yarn - Package Manager
Validation Warning: Unknown option transformx with value "<rootDir>/node_modules/babel-jest" was found. This is either a typing error or a user mistake.
Read more >
Configuring Jest
Setting bail to true is the same as setting bail to 1 . ... Note: Setting this option overwrites the default values.
Read more >
@nrwl/jest:jest | Nx
Options can be configured in project.json when defining the executor, ... The path to a Jest config file specifying how to find and...
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