Skip to content

Unexpected removal of function name from node:internal frame in stack trace #1589

@Krinkle

Description

@Krinkle
console.log(new Error('Boo').stack);

Node.js v23.6.0

$ node example.js
Error: boo
    at Object.<anonymous> (/Users/krinkle/Development/qunit/example.js:1:13)
    at Module._compile (node:internal/modules/cjs/loader:1739:14)
    at Object..js (node:internal/modules/cjs/loader:1904:10)
    at Module.load (node:internal/modules/cjs/loader:1473:32)
    at Function._load (node:internal/modules/cjs/loader:1285:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:234:24)

nyc 17.1.0

$ npx nyc node example.js 
Error: boo
    at Object.<anonymous> (/Users/krinkle/Development/qunit/example.js:1:13)
    at Module._compile (node:internal/modules/cjs/loader:1739:14)
    at Module.replacementCompile (/Users/krinkle/Development/qunit/node_modules/append-transform/index.js:60:13)
    at node:internal/modules/cjs/loader:1904:10
    at Object.<anonymous> (/Users/krinkle/Development/qunit/node_modules/append-transform/index.js:64:4)
    at Module.load (node:internal/modules/cjs/loader:1473:32)
    at Function._load (node:internal/modules/cjs/loader:1285:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:234:24)

The corrupted line in question is:

at Object..js (node:internal/modules/cjs/loader)

which nyc turns into

at node:internal/modules/cjs/loader

thus the at functionName (path/file) formatting structure, and becoming at path/file instead.

This caused a very minor issue in a project with strict output fixtures that, despite various normalization layers, failed to match with NYC enabled because it was unable to parse those lines correctly.

https://github.com/qunitjs/qunit/blob/3.0.0-alpha.4/test/cli/helpers/execute.js#L35-L53

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