Skip to content

test-runner: Assert stack trace is stripped when used within test #48840

@Ethan-Arrowood

Description

@Ethan-Arrowood

Version

20.3.1

Platform

Darwin Ethans-MBP 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000 arm64

Subsystem

test-runner

What steps will reproduce the bug?

Clone: https://github.com/Ethan-Arrowood/node-test-runner-assert-stack-trace-issue

Run: npm run expected

Then: npm run actual

See difference.

Expected:

❯ npm run expected

> expected
> node expected.js

AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

0 !== 1

    at err (file:///Users/ethanarrowood/Documents/github/node-test-runner-assert-stack-trace/expected.js:5:16)
    at file:///Users/ethanarrowood/Documents/github/node-test-runner-assert-stack-trace/expected.js:11:9
    at ModuleJob.run (node:internal/modules/esm/module_job:192:25)
    at async DefaultModuleLoader.import (node:internal/modules/esm/loader:246:24)
    at async loadESM (node:internal/process/esm_loader:40:7)
    at async handleMainPromise (node:internal/modules/run_main:66:12)

Actual:

❯ npm run actual

> actual
> node --test --test-reporter=./reporter.cjs test.js

Error [ERR_TEST_FAILURE]: Expected values to be strictly equal:

0 !== 1

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

Any assert failure within a test block causes issue.

What is the expected behavior? Why is that the expected behavior?

I expect to get the complete stack trace from assert in my test reporter

What do you see instead?

Incomplete stack trace

Additional information

No response

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