Skip to content

NODE_V8_COVERAGE leads to different behavior, dispatcher.on is not a function #2328

@loynoir

Description

@loynoir

Version

v20.8.0

Platform

Docker ArchLinux 6.1.55-1-lts

Subsystem

No response

What steps will reproduce the bug?

$ cat reproduce.mjs 
import { fetch as $fetch, Agent } from "undici";

const controller = new AbortController();

await $fetch("http://127.0.0.1:1234", {
  signal: controller.signal,
});
$ 
$ node reproduce.mjs 
$ 
$ env NODE_V8_COVERAGE='./coverage/tmp' node ./reproduce.mjs
/tmp/tmp.UqQMFN5Qmf/node_modules/undici/index.js:110
        Error.captureStackTrace(err, this)
              ^

TypeError: dispatcher.on is not a function
    at fetch (/tmp/tmp.UqQMFN5Qmf/node_modules/undici/index.js:110:15)
    at async file:///tmp/tmp.UqQMFN5Qmf/reproduce.mjs:5:1

Node.js v20.8.0

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

No response

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

NODE_V8_COVERAGE does not leads to different behavior.

$ node reproduce.mjs 
$ 
$ env NODE_V8_COVERAGE='./coverage/tmp' node ./reproduce.mjs
$

What do you see instead?

NODE_V8_COVERAGE leads to different behavior.

$ node reproduce.mjs 
$ 
$ env NODE_V8_COVERAGE='./coverage/tmp' node ./reproduce.mjs
/tmp/tmp.UqQMFN5Qmf/node_modules/undici/index.js:110
        Error.captureStackTrace(err, this)
              ^

TypeError: dispatcher.on is not a function
    at fetch (/tmp/tmp.UqQMFN5Qmf/node_modules/undici/index.js:110:15)
    at async file:///tmp/tmp.UqQMFN5Qmf/reproduce.mjs:5:1

Node.js v20.8.0

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