Skip to content

[Bug]: Symbol.dispose and Symbol.asyncDispose are undefined #14874

@notaphplover

Description

@notaphplover

Version

29.7.0

Steps to reproduce

  1. Clone the minimal reproduction repository
  2. Follow the steps in the README.md file.

Expected behavior

As described in the readme, I expect Symbol.dispose and Symbol.asyncDispose to be exposed when targeting a node env.

Actual behavior

Symbol.dispose and Symbol.asyncDispose are not defined in the jest node env.

Additional context

Since typescript 5.2, Explicit Resource Management is being supported in Typescript. Latest stable NodeJS versions include Symbol.dispose and Symbol.asyncDispose, essential to pollyfill this feature. Exposing them in the jest node env would allow to properly test modules using this feature.

Environment

System:
    OS: Linux 6.5 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
    CPU: (8) x64 Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
  Binaries:
    Node: 20.9.0 - ~/.nvm/versions/node/v20.9.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v20.9.0/bin/yarn
    npm: 10.3.0 - ~/.nvm/versions/node/v20.9.0/bin/npm
    pnpm: 8.15.1 - ~/.nvm/versions/node/v20.9.0/bin/pnpm
  npmPackages:
    jest: 29.7.0 => 29.7.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions