Skip to content

Jest swallows console output with --bail #3755

@taion

Description

@taion

Jest v20.0.4
Node v8.0.0

$ cat test.js
test('foo', () => {
  console.log('this is the expected log statement');
  expect().toBeDefined();
});
$ jest test.js
 FAIL  ./test.js
  ● foo

    expect(received).toBeDefined()

    Expected value to be defined, instead received
      undefined

      at Object.<anonymous>.test (test.js:3:12)
          at Promise (<anonymous>)
          at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:169:7)

  ✕ foo (5ms)

Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 total
Snapshots:   0 total
Time:        0.808s, estimated 1s
Ran all test suites matching "test.js".
  console.log test.js:2
    this is the expected log statement

$ jest -b test.js
 FAIL  ./test.js
  ● foo

    expect(received).toBeDefined()

    Expected value to be defined, instead received
      undefined

      at Object.<anonymous>.test (test.js:3:12)
          at Promise (<anonymous>)
          at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:169:7)

  ✕ foo (5ms)

Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 total
Snapshots:   0 total
Time:        0.55s, estimated 1s
Ran all test suites matching "test.js".
$

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions