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

Test runner: errors are truncated in spec reporter when running with --test #46871

Closed
MoLow opened this issue Feb 27, 2023 · 0 comments · Fixed by #46872
Closed

Test runner: errors are truncated in spec reporter when running with --test #46871

MoLow opened this issue Feb 27, 2023 · 0 comments · Fixed by #46872
Labels
test_runner Issues and PRs related to the test runner subsystem.

Comments

@MoLow
Copy link
Member

MoLow commented Feb 27, 2023

Version

v19.7.0

Platform

Darwin Moshes-MBP.localdomain 21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:01 PDT 2021; root:xnu-8019.41.5~1/RELEASE_ARM64_T6000 arm64

Subsystem

Test runner

What steps will reproduce the bug?

create test file:

const test = require('node:test');

test('this should fail', () => {
  throw new Error('this should fail');
});
test('this should fail', () => {
  throw new TypeError('this should fail123123');
});

How often does it reproduce? Is there a required condition?

allwaysalways

What is the expected behavior?

when running without --test:

node --test-reporter spec a.js                                                                                                                 ✔  19.7.0  
✖ this should fail (0.749375ms)
  Error: this should fail
      at TestContext.<anonymous> (/Users/moshe/repos/node/a.js:4:9)
      at Test.runInAsyncScope (node:async_hooks:203:9)
      at Test.run (node:internal/test_runner/test:549:25)
      at Test.start (node:internal/test_runner/test:465:17)
      at test (node:internal/test_runner/harness:172:18)
      at Object.<anonymous> (/Users/moshe/repos/node/a.js:3:1)
      at Module._compile (node:internal/modules/cjs/loader:1275:14)
      at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
      at Module.load (node:internal/modules/cjs/loader:1133:32)
      at Module._load (node:internal/modules/cjs/loader:972:12)

✖ this should fail (1.003875ms)
  TypeError: this should fail123123
      at TestContext.<anonymous> (/Users/moshe/repos/node/a.js:7:9)
      at Test.runInAsyncScope (node:async_hooks:203:9)
      at Test.run (node:internal/test_runner/test:549:25)
      at Test.processPendingSubtests (node:internal/test_runner/test:304:27)
      at Test.postRun (node:internal/test_runner/test:634:19)
      at Test.run (node:internal/test_runner/test:577:10)

ℹ tests 2
ℹ pass 0
ℹ fail 2
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 6.028833

What do you see instead?

when running with --test

node --test --test-reporter spec a.js                                                                                                        1 ✘  19.7.0  
▶ /Users/moshe/repos/node/a.js
  ✖ this should fail (0.773875ms)
        at TestContext.<anonymous> (/Users/moshe/repos/node/a.js:4:9)
        at Test.runInAsyncScope (node:async_hooks:203:9)
        at Test.run (node:internal/test_runner/test:549:25)
        at Test.start (node:internal/test_runner/test:465:17)
        at test (node:internal/test_runner/harness:172:18)
        at Object.<anonymous> (/Users/moshe/repos/node/a.js:3:1)
        at Module._compile (node:internal/modules/cjs/loader:1275:14)
        at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
        at Module.load (node:internal/modules/cjs/loader:1133:32)
        at Module._load (node:internal/modules/cjs/loader:972:12) {
      code: 'ERR_TEST_FAILURE'
    }

  ✖ this should fail (1.427042ms)
        at TestContext.<anonymous> (/Users/moshe/repos/node/a.js:7:9)
        at Test.runInAsyncScope (node:async_hooks:203:9)
        at Test.run (node:internal/test_runner/test:549:25)
        at Test.processPendingSubtests (node:internal/test_runner/test:304:27)
        at Test.postRun (node:internal/test_runner/test:634:19)
        at Test.run (node:internal/test_runner/test:577:10) {
      code: 'ERR_TEST_FAILURE'
    }

▶ /Users/moshe/repos/node/a.js (55.624541ms)

ℹ tests 1
ℹ pass 0
ℹ fail 1
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 56.438083

Additional information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test_runner Issues and PRs related to the test runner subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant