node/test/fixtures/test-runner/output/output.snapshot
Chengzhong Wu cff8bfd865
test: unify assertSnapshot stacktrace transform
The snapshotted stack frames should hide node internal stack frames so
that general node core development does not need updating the snapshot.

For userland stack frames, they are highly fixture related and any
fixture change should reflect in a change of the snapshot. Additionally,
the line and column number are highly relevant to the correctness of the
snapshot, these should not be redacted. A change in node core that
affects userland stack frames should be alarming and be reflected in the
snapshots.

Features like test runner and source map support both should snapshot
userland stack frames to ensure that userland code locations are
computed correctly.

PR-URL: https://github.com/nodejs/node/pull/61665
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
2026-02-11 14:36:49 +00:00

760 lines
21 KiB
Text

TAP version 13
# Subtest: sync expect fail (method)
ok 1 - sync expect fail (method) # EXPECTED FAILURE
---
duration_ms: *
type: 'test'
...
# Subtest: sync expect fail (options)
ok 2 - sync expect fail (options) # EXPECTED FAILURE
---
duration_ms: *
type: 'test'
...
# Subtest: async expect fail (method)
ok 3 - async expect fail (method) # EXPECTED FAILURE
---
duration_ms: *
type: 'test'
...
# Subtest: async expect fail (options)
ok 4 - async expect fail (options) # EXPECTED FAILURE
---
duration_ms: *
type: 'test'
...
# Subtest: sync todo with expect fail
ok 5 - sync todo with expect fail # TODO
---
duration_ms: *
type: 'test'
...
# Subtest: sync skip expect fail
ok 6 - sync skip expect fail # SKIP
---
duration_ms: *
type: 'test'
...
# Subtest: sync pass todo
ok 7 - sync pass todo # TODO
---
duration_ms: *
type: 'test'
...
# Subtest: sync pass todo with message
ok 8 - sync pass todo with message # TODO this is a passing todo
---
duration_ms: *
type: 'test'
...
# Subtest: sync fail todo
not ok 9 - sync fail todo # TODO
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:40:1'
failureType: 'testCodeFailure'
error: 'thrown from sync fail todo'
code: 'ERR_TEST_FAILURE'
stack: |-
TestContext.<anonymous> (<project-root>/test/fixtures/test-runner/output/output.js:42:9)
<node-internal-frames>
...
# Subtest: sync fail todo with message
not ok 10 - sync fail todo with message # TODO this is a failing todo
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:45:1'
failureType: 'testCodeFailure'
error: 'thrown from sync fail todo with message'
code: 'ERR_TEST_FAILURE'
stack: |-
TestContext.<anonymous> (<project-root>/test/fixtures/test-runner/output/output.js:47:9)
<node-internal-frames>
...
# Subtest: sync skip pass
ok 11 - sync skip pass # SKIP
---
duration_ms: *
type: 'test'
...
# Subtest: sync skip pass with message
ok 12 - sync skip pass with message # SKIP this is skipped
---
duration_ms: *
type: 'test'
...
# Subtest: sync pass
ok 13 - sync pass
---
duration_ms: *
type: 'test'
...
# this test should pass
# Subtest: sync throw fail
not ok 14 - sync throw fail
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:62:1'
failureType: 'testCodeFailure'
error: 'thrown from sync throw fail'
code: 'ERR_TEST_FAILURE'
stack: |-
TestContext.<anonymous> (<project-root>/test/fixtures/test-runner/output/output.js:63:9)
<node-internal-frames>
...
# Subtest: async skip pass
ok 15 - async skip pass # SKIP
---
duration_ms: *
type: 'test'
...
# Subtest: async pass
ok 16 - async pass
---
duration_ms: *
type: 'test'
...
# Subtest: async throw fail
not ok 17 - async throw fail
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:74:1'
failureType: 'testCodeFailure'
error: 'thrown from async throw fail'
code: 'ERR_TEST_FAILURE'
stack: |-
TestContext.<anonymous> (<project-root>/test/fixtures/test-runner/output/output.js:75:9)
<node-internal-frames>
...
# Subtest: async skip fail
not ok 18 - async skip fail # SKIP
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:78:1'
failureType: 'testCodeFailure'
error: 'thrown from async throw fail'
code: 'ERR_TEST_FAILURE'
stack: |-
TestContext.<anonymous> (<project-root>/test/fixtures/test-runner/output/output.js:80:9)
<node-internal-frames>
...
# Subtest: async assertion fail
not ok 19 - async assertion fail
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:83:1'
failureType: 'testCodeFailure'
error: |-
Expected values to be strictly equal:
true !== false
code: 'ERR_ASSERTION'
name: 'AssertionError'
expected: false
actual: true
operator: 'strictEqual'
stack: |-
TestContext.<anonymous> (<project-root>/test/fixtures/test-runner/output/output.js:85:10)
<node-internal-frames>
...
# Subtest: resolve pass
ok 20 - resolve pass
---
duration_ms: *
type: 'test'
...
# Subtest: reject fail
not ok 21 - reject fail
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:92:1'
failureType: 'testCodeFailure'
error: 'rejected from reject fail'
code: 'ERR_TEST_FAILURE'
stack: |-
TestContext.<anonymous> (<project-root>/test/fixtures/test-runner/output/output.js:93:25)
<node-internal-frames>
...
# Subtest: unhandled rejection - passes but warns
ok 22 - unhandled rejection - passes but warns
---
duration_ms: *
type: 'test'
...
# Subtest: async unhandled rejection - passes but warns
ok 23 - async unhandled rejection - passes but warns
---
duration_ms: *
type: 'test'
...
# Subtest: immediate throw - passes but warns
ok 24 - immediate throw - passes but warns
---
duration_ms: *
type: 'test'
...
# Subtest: immediate reject - passes but warns
ok 25 - immediate reject - passes but warns
---
duration_ms: *
type: 'test'
...
# Subtest: immediate resolve pass
ok 26 - immediate resolve pass
---
duration_ms: *
type: 'test'
...
# Subtest: subtest sync throw fail
# Subtest: +sync throw fail
not ok 1 - +sync throw fail
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:125:11'
failureType: 'testCodeFailure'
error: 'thrown from subtest sync throw fail'
code: 'ERR_TEST_FAILURE'
stack: |-
TestContext.<anonymous> (<project-root>/test/fixtures/test-runner/output/output.js:127:11)
<node-internal-frames>
TestContext.<anonymous> (<project-root>/test/fixtures/test-runner/output/output.js:125:11)
<node-internal-frames>
...
# this subtest should make its parent test fail
1..1
not ok 27 - subtest sync throw fail
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:124:1'
failureType: 'subtestsFailed'
error: '1 subtest failed'
code: 'ERR_TEST_FAILURE'
...
# Subtest: sync throw non-error fail
not ok 28 - sync throw non-error fail
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:131:1'
failureType: 'testCodeFailure'
error: 'Symbol(thrown symbol from sync throw non-error fail)'
code: 'ERR_TEST_FAILURE'
...
# Subtest: level 0a
# Subtest: level 1a
ok 1 - level 1a
---
duration_ms: *
type: 'test'
...
# Subtest: level 1b
ok 2 - level 1b
---
duration_ms: *
type: 'test'
...
# Subtest: level 1c
ok 3 - level 1c
---
duration_ms: *
type: 'test'
...
# Subtest: level 1d
ok 4 - level 1d
---
duration_ms: *
type: 'test'
...
1..4
ok 29 - level 0a
---
duration_ms: *
type: 'test'
...
# Subtest: top level
# Subtest: +long running
ok 1 - +long running
---
duration_ms: *
type: 'test'
...
# Subtest: +short running
# Subtest: ++short running
ok 1 - ++short running
---
duration_ms: *
type: 'test'
...
1..1
ok 2 - +short running
---
duration_ms: *
type: 'test'
...
1..2
ok 30 - top level
---
duration_ms: *
type: 'test'
...
# Subtest: invalid subtest - pass but subtest fails
ok 31 - invalid subtest - pass but subtest fails
---
duration_ms: *
type: 'test'
...
# Subtest: sync skip option
ok 32 - sync skip option # SKIP
---
duration_ms: *
type: 'test'
...
# Subtest: sync skip option with message
ok 33 - sync skip option with message # SKIP this is skipped
---
duration_ms: *
type: 'test'
...
# Subtest: sync skip option is false fail
not ok 34 - sync skip option is false fail
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:211:1'
failureType: 'testCodeFailure'
error: 'this should be executed'
code: 'ERR_TEST_FAILURE'
stack: |-
TestContext.<anonymous> (<project-root>/test/fixtures/test-runner/output/output.js:212:9)
<node-internal-frames>
...
# Subtest: <anonymous>
ok 35 - <anonymous>
---
duration_ms: *
type: 'test'
...
# Subtest: functionOnly
ok 36 - functionOnly
---
duration_ms: *
type: 'test'
...
# Subtest: <anonymous>
ok 37 - <anonymous>
---
duration_ms: *
type: 'test'
...
# Subtest: test with only a name provided
ok 38 - test with only a name provided
---
duration_ms: *
type: 'test'
...
# Subtest: <anonymous>
ok 39 - <anonymous>
---
duration_ms: *
type: 'test'
...
# Subtest: <anonymous>
ok 40 - <anonymous> # SKIP
---
duration_ms: *
type: 'test'
...
# Subtest: test with a name and options provided
ok 41 - test with a name and options provided # SKIP
---
duration_ms: *
type: 'test'
...
# Subtest: functionAndOptions
ok 42 - functionAndOptions # SKIP
---
duration_ms: *
type: 'test'
...
# Subtest: callback pass
ok 43 - callback pass
---
duration_ms: *
type: 'test'
...
# Subtest: callback fail
not ok 44 - callback fail
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:243:1'
failureType: 'testCodeFailure'
error: 'callback failure'
code: 'ERR_TEST_FAILURE'
stack: |-
Immediate.<anonymous> (<project-root>/test/fixtures/test-runner/output/output.js:245:10)
<node-internal-frames>
...
# Subtest: sync t is this in test
ok 45 - sync t is this in test
---
duration_ms: *
type: 'test'
...
# Subtest: async t is this in test
ok 46 - async t is this in test
---
duration_ms: *
type: 'test'
...
# Subtest: callback t is this in test
ok 47 - callback t is this in test
---
duration_ms: *
type: 'test'
...
# Subtest: callback also returns a Promise
not ok 48 - callback also returns a Promise
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:262:1'
failureType: 'callbackAndPromisePresent'
error: 'passed a callback but also returned a Promise'
code: 'ERR_TEST_FAILURE'
...
# Subtest: callback throw
not ok 49 - callback throw
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:266:1'
failureType: 'testCodeFailure'
error: 'thrown from callback throw'
code: 'ERR_TEST_FAILURE'
stack: |-
TestContext.<anonymous> (<project-root>/test/fixtures/test-runner/output/output.js:267:9)
<node-internal-frames>
...
# Subtest: callback called twice
not ok 50 - callback called twice
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:270:1'
failureType: 'multipleCallbackInvocations'
error: 'callback invoked multiple times'
code: 'ERR_TEST_FAILURE'
stack: |-
TestContext.<anonymous> (<project-root>/test/fixtures/test-runner/output/output.js:272:3)
<node-internal-frames>
...
# Subtest: callback called twice in different ticks
ok 51 - callback called twice in different ticks
---
duration_ms: *
type: 'test'
...
# Subtest: callback called twice in future tick
not ok 52 - callback called twice in future tick
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:280:1'
failureType: 'uncaughtException'
error: 'callback invoked multiple times'
code: 'ERR_TEST_FAILURE'
stack: |-
Immediate.<anonymous> (<project-root>/test/fixtures/test-runner/output/output.js:283:5)
...
# Subtest: callback async throw
not ok 53 - callback async throw
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:287:1'
failureType: 'uncaughtException'
error: 'thrown from callback async throw'
code: 'ERR_TEST_FAILURE'
stack: |-
Immediate.<anonymous> (<project-root>/test/fixtures/test-runner/output/output.js:289:11)
<node-internal-frames>
...
# Subtest: callback async throw after done
ok 54 - callback async throw after done
---
duration_ms: *
type: 'test'
...
# Subtest: only is set on subtests but not in only mode
# Subtest: running subtest 1
ok 1 - running subtest 1
---
duration_ms: *
type: 'test'
...
# Subtest: running subtest 3
ok 2 - running subtest 3
---
duration_ms: *
type: 'test'
...
# Subtest: running subtest 4
ok 3 - running subtest 4
---
duration_ms: *
type: 'test'
...
1..3
ok 55 - only is set on subtests but not in only mode
---
duration_ms: *
type: 'test'
...
# Subtest: custom inspect symbol fail
not ok 56 - custom inspect symbol fail
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:311:1'
failureType: 'testCodeFailure'
error: 'customized'
code: 'ERR_TEST_FAILURE'
...
# Subtest: custom inspect symbol that throws fail
not ok 57 - custom inspect symbol that throws fail
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:322:1'
failureType: 'testCodeFailure'
error: |-
{
foo: 1,
Symbol(nodejs.util.inspect.custom): [Function: [nodejs.util.inspect.custom]]
}
code: 'ERR_TEST_FAILURE'
...
# Subtest: subtest sync throw fails
# Subtest: sync throw fails at first
not ok 1 - sync throw fails at first
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:334:11'
failureType: 'testCodeFailure'
error: 'thrown from subtest sync throw fails at first'
code: 'ERR_TEST_FAILURE'
stack: |-
TestContext.<anonymous> (<project-root>/test/fixtures/test-runner/output/output.js:335:11)
<node-internal-frames>
TestContext.<anonymous> (<project-root>/test/fixtures/test-runner/output/output.js:334:11)
<node-internal-frames>
...
# Subtest: sync throw fails at second
not ok 2 - sync throw fails at second
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:337:11'
failureType: 'testCodeFailure'
error: 'thrown from subtest sync throw fails at second'
code: 'ERR_TEST_FAILURE'
stack: |-
TestContext.<anonymous> (<project-root>/test/fixtures/test-runner/output/output.js:338:11)
<node-internal-frames>
TestContext.<anonymous> (<project-root>/test/fixtures/test-runner/output/output.js:337:11)
<node-internal-frames>
...
1..2
not ok 58 - subtest sync throw fails
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:333:1'
failureType: 'subtestsFailed'
error: '2 subtests failed'
code: 'ERR_TEST_FAILURE'
...
# Subtest: timed out async test
not ok 59 - timed out async test
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:342:1'
failureType: 'testTimeoutFailure'
error: 'test timed out after 5ms'
code: 'ERR_TEST_FAILURE'
...
# Subtest: timed out callback test
not ok 60 - timed out callback test
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:351:1'
failureType: 'testTimeoutFailure'
error: 'test timed out after 5ms'
code: 'ERR_TEST_FAILURE'
...
# Subtest: large timeout async test is ok
ok 61 - large timeout async test is ok
---
duration_ms: *
type: 'test'
...
# Subtest: large timeout callback test is ok
ok 62 - large timeout callback test is ok
---
duration_ms: *
type: 'test'
...
# Subtest: successful thenable
ok 63 - successful thenable
---
duration_ms: *
type: 'test'
...
# Subtest: rejected thenable
not ok 64 - rejected thenable
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:380:1'
failureType: 'testCodeFailure'
error: 'custom error'
code: 'ERR_TEST_FAILURE'
...
# Subtest: unfinished test with uncaughtException
not ok 65 - unfinished test with uncaughtException
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:391:1'
failureType: 'uncaughtException'
error: 'foo'
code: 'ERR_TEST_FAILURE'
stack: |-
Timeout._onTimeout (<project-root>/test/fixtures/test-runner/output/output.js:393:30)
<node-internal-frames>
...
# Subtest: unfinished test with unhandledRejection
not ok 66 - unfinished test with unhandledRejection
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:397:1'
failureType: 'unhandledRejection'
error: 'bar'
code: 'ERR_TEST_FAILURE'
stack: |-
Timeout._onTimeout (<project-root>/test/fixtures/test-runner/output/output.js:399:37)
<node-internal-frames>
...
# Subtest: assertion errors display actual and expected properly
not ok 67 - assertion errors display actual and expected properly
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:409:1'
failureType: 'testCodeFailure'
error: |-
Expected values to be loosely deep-equal:
{
bar: 1,
baz: {
date: 1970-01-01T00:00:00.000Z,
null: null,
number: 1,
string: 'Hello',
undefined: undefined
},
boo: [
1
],
foo: 1
}
should loosely deep-equal
{
baz: {
date: 1970-01-01T00:00:00.000Z,
null: null,
number: 1,
string: 'Hello',
undefined: undefined
},
boo: [
1
],
circular: <ref *1> {
bar: 2,
c: [Circular *1]
}
}
code: 'ERR_ASSERTION'
name: 'AssertionError'
expected:
boo:
0: 1
baz:
date: 1970-01-01T00:00:00.000Z
null: ~
number: 1
string: 'Hello'
circular:
bar: 2
c: <Circular>
actual:
foo: 1
bar: 1
boo:
0: 1
baz:
date: 1970-01-01T00:00:00.000Z
null: ~
number: 1
string: 'Hello'
operator: 'deepEqual'
stack: |-
TestContext.<anonymous> (<project-root>/test/fixtures/test-runner/output/output.js:425:12)
...
# Subtest: invalid subtest fail
not ok 68 - invalid subtest fail
---
duration_ms: *
type: 'test'
location: '<project-root>/test/fixtures/test-runner/output/output.js:197:7'
failureType: 'parentAlreadyFinished'
error: 'test could not be started because its parent finished'
code: 'ERR_TEST_FAILURE'
stack: |-
Immediate.<anonymous> (<project-root>/test/fixtures/test-runner/output/output.js:197:7)
...
1..68
# Error: Test "unhandled rejection - passes but warns" at test/fixtures/test-runner/output/output.js:96:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event.
# Error: Test "async unhandled rejection - passes but warns" at test/fixtures/test-runner/output/output.js:100:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from async unhandled rejection fail" and would have caused the test to fail, but instead triggered an unhandledRejection event.
# Error: A resource generated asynchronous activity after the test ended. This activity created the error "Error: uncaught from outside of a test" which triggered an uncaughtException event, caught by the test runner.
# Error: Test "immediate throw - passes but warns" at test/fixtures/test-runner/output/output.js:104:1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from immediate throw fail" and would have caused the test to fail, but instead triggered an uncaughtException event.
# Error: Test "immediate reject - passes but warns" at test/fixtures/test-runner/output/output.js:110:1 generated asynchronous activity after the test ended. This activity created the error "Error: rejected from immediate reject fail" and would have caused the test to fail, but instead triggered an unhandledRejection event.
# Error: Test "callback called twice in different ticks" at test/fixtures/test-runner/output/output.js:275:1 generated asynchronous activity after the test ended. This activity created the error "Error [ERR_TEST_FAILURE]: callback invoked multiple times" and would have caused the test to fail, but instead triggered an uncaughtException event.
# Error: Test "callback async throw after done" at test/fixtures/test-runner/output/output.js:293:1 generated asynchronous activity after the test ended. This activity created the error "Error: thrown from callback async throw after done" and would have caused the test to fail, but instead triggered an uncaughtException event.
# tests 81
# suites 0
# pass 40
# fail 24
# cancelled 2
# skipped 10
# todo 5
# duration_ms *