Skip to content

Fake Timer implementation does not have unref method in Node environment #4559

Description

@vkrol

Do you want to request a feature or report a bug?
Bug.

What is the current behavior?
The fake Timer implementation does not have unref method in Node environment.

If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can yarn install and yarn test.

test("fake Time implementation does not have unref method", () => {
    const realTimer = setTimeout(() => {});
    expect(typeof realTimer.unref).toEqual("function");

    jest.useFakeTimers();

    const fakeTimer = setTimeout(() => {});
    expect(typeof fakeTimer.unref).toEqual("undefined");
});

https://repl.it/Lm5x

What is the expected behavior?
Fake Timer implementation should have unref method in Node environment.

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
Node - 8.5.0
Yarn - 1.1.0
Jest - 21.2.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions