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

Created on 19 Nov 2019  ·  8Comments  ·  Source: facebook/jest

🐛 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
Bug Report Needs Repro Needs Triage

All 8 comments

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.

Could point it out in the docs

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

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

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

@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.

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

Was this page helpful?
0 / 5 - 0 ratings