Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: verbose's default is "true" and not "false" #9205

Closed
thernstig opened this issue Nov 19, 2019 · 9 comments · Fixed by #9279
Closed

Docs: verbose's default is "true" and not "false" #9205

thernstig opened this issue Nov 19, 2019 · 9 comments · Fixed by #9279

Comments

@thernstig
Copy link
Contributor

🐛 Bug Report

When there is no 'verbose' property defined in jest.config.js, it defaults to true and not false as per https://jestjs.io/docs/en/configuration#verbose-boolean

To Reproduce

Add this code to a project and place a test in the server/ directory:

module.exports = {
  testEnvironment: 'node',
  rootDir: 'server/',
};

Expected behavior

The test case names should not be displayed in the console.

envinfo

npx: installed 1 in 0.566s

  System:
    OS: Linux 4.4 Ubuntu 16.04.5 LTS (Xenial Xerus)
    CPU: (4) x64 Intel(R) Xeon(R) Gold 6132 CPU @ 2.60GHz
  Binaries:
    Node: 12.13.0 - ~/.config/nvm/12.13.0/bin/node
    npm: 6.12.0 - ~/.config/nvm/12.13.0/bin/npm
  npmPackages:
    jest: ^24.9.0 => 24.9.0
@thymikee
Copy link
Collaborator

thymikee commented Nov 19, 2019

The verbose reporter is the default if there's only one test (edit: one test suite/file) running, so I assume that's your case. It's an intended behavior.

@SimenB
Copy link
Member

SimenB commented Nov 19, 2019

Could point it out in the docs

@thymikee
Copy link
Collaborator

Fair point. @thernstig would you feel like contributing this bit?

@thernstig
Copy link
Contributor Author

thernstig commented Nov 19, 2019

The verbose reporter is the default if there's only one test running, so I assume that's your case. It's an intended behavior.

There are two tests running, like this:

// beverage.test.js

const myBeverage = {
  delicious: true,
  sour: false,
};

describe('my beverage', () => {
  it('is delicious', () => {
    expect(myBeverage.delicious).toBeTruthy();
  });

  it('is not sour', () => {
    expect(myBeverage.sour).toBeFalsy();
  });
});

Result

~/test (jest)> jest
 PASS  server/config.unit.test.js
  my beverage
     is delicious (1ms)
     is not sour (1ms)

Test Suites: 1 passed, 1 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        0.528s
Ran all test suites.

edit: Did you mean just one test suite

@thymikee
Copy link
Collaborator

By a "one test" I mean "one file with test cases" or "one test suite". If you add another file, it will be gone

@thernstig
Copy link
Contributor Author

@thymikee Yes, edited my last comment suspecting this was the case. I have verified you are correct. Maybe a small doc update would highlight this, let me see if I can get time to send a MR soon.

@SimenB
Copy link
Member

SimenB commented Nov 19, 2019

Code:
https://github.com/facebook/jest/blob/efb311d5440d40806a73003c252ab0a326cd0fc6/packages/jest-core/src/runJest.ts#L226-L233

@thernstig
Copy link
Contributor Author

Appreciate the great support and issue tracking from both of you :)

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants