Skip to content

stdout and stderr are written to console out of sync #6718

@medikoo

Description

@medikoo

🐛 Bug Report

data streamed to process.stdout and process.stderr does not appear in sync.

It makes debugging in some cases difficult and very confusing
e.g. I work with application where some parts, rely on console.log (so propagate debug logs to stdout) while some app dependencies output debug logs via popular debug library (which propagates logs to stderr)

Logs from both sources appear out of sync, which makes reliable debugging quite difficult.

To Reproduce

In empty project create some.test.js:

process.stdout.write("1\n");
process.stderr.write("2\n");
process.stdout.write("3\n");

After running jest output is as follows:

2
 FAIL  ./some.test.js
  ● Test suite failed to run

    Your test suite must contain at least one test.

      at node_modules/jest/node_modules/jest-cli/build/test_scheduler.js:256:22

1
3
Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        1.489s
Ran all test suites.

Expected behavior

Output as:

1
2
3
 FAIL  ./some.test.js
  ● Test suite failed to run

    Your test suite must contain at least one test.

      at node_modules/jest/node_modules/jest-cli/build/test_scheduler.js:256:22

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        1.489s
Ran all test suites.

Env info

  System:
    OS: macOS High Sierra 10.13.5
    CPU: x64 Intel(R) Core(TM) i7-2760QM CPU @ 2.40GHz
  Binaries:
    Node: 10.7.0 - /usr/local/bin/node
    Yarn: 1.7.0 - /usr/local/bin/yarn
    npm: 6.1.0 - /usr/local/bin/npm
  npmPackages:
    jest: ^23.4.1 => 23.4.1 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions