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 --silent --no-silent no longer negates silent flag

See original GitHub issue

💥 Regression Report

Our package.json script runs jest with the --silent flag. Previously I was able to override this by passing --no-silent flag when running the script.

npm run test -- --no-silent

Last working version

Worked up to version: ~24.8.0 (specifically 24.8.0 is installed)

Stopped working in version: ~25.1.0

To Reproduce

  1. Create package.json script:
"test:silent": "jest --silent --config jest.config.js",
"test:no-silent": "jest --no-silent --config jest.config.js",
"test:negate:silent": "npm run test:silent -- --no-silent",
  1. Add a console.log statement to a test
  2. Run npm run test:silent and observe log statement isn’t logged (expected)
  3. Run npm run test:no:silent and observe log statement is logged (expected)
  4. Run npm run test:silent -- --no-silent and observe log statement isn’t logged (regression, this used to work)

Expected behavior

Expect no-silent to negate --silent flag.

Link to repl or repo (highly encouraged)

https://repl.it/repls/DownrightTrivialCalculator

Switch to version 24 to see it work. Basically run the test:negate:silent script and it will work with version 24 but not with version 25.

Issues without a reproduction link are likely to stall.

Run npx envinfo --preset jest

Paste the results here:

  System:
    OS: macOS Mojave 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i7-7660U CPU @ 2.50GHz
  Binaries:
    Node: 8.17.0 - ~/local/n/n/versions/node/8.17.0/bin/node
    Yarn: 1.19.1 - /usr/local/bin/yarn
    npm: 6.13.4 - ~/local/n/n/versions/node/8.17.0/bin/npm
  npmPackages:
    jest: ~25.1.0 => 25.1.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
bcoecommented, Feb 5, 2020

@SimenB you should be able to address this by passing a configuration setting to yargs, we’ve made this behavior more explicit, see:

https://github.com/yargs/yargs-parser#duplicate-arguments-array

Set duplicate-arguments-array to false:

~yargs.parserOptions({‘duplicate-arguments-array’: false});~

Edit: yargs(process.argv.slice(2)).parserConfiguration({}), I should learn how to use yargs.

0reactions
github-actions[bot]commented, May 11, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Make certain test silent in Jest - Stack Overflow
Looks like jest --silent makes all tests silent, which is not desirable. I need to simulate an error and make sure it's correctly...
Read more >
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-cli | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
6 Ways to Run Jest Test Cases Silently - Medium
With a large amount of test cases, there might be a large amount of console information from the code, which you may not...
Read more >
是- 不沉默- 不再否定沉默国旗:jest-silent-no-silent no longer negates ...
jest -silent-no-silent no longer negates silent flag Regression Report Our package.json script runs jest with the-silent flag. Previously I was able ...
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