jest: [Bug]: punycode deprecation warning on Node 22 LTS

Version

29.7.0

Steps to reproduce

Run any test suite with jest environment jsdom using Node 22.

Expected behavior

No deprecation warning is printed.

Actual behavior

The following warning is printed before tests run.

(node:57226) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

Additional context

This problem is also mentioned in https://github.com/jestjs/jest/issues/15148, but while upgrading jest-environment-jsdom is a possible solution, I’d like to specifically track the deprecation warning happening on the stable release (#15148 seems to be about the alpha release).

Environment

System: OS: macOS 15.0.1 CPU: (12) arm64 Apple M2 Pro Binaries: Node: 22.11.0 - ~/.local/state/fnm_multishells/98505_1730127764871/bin/node npm: 10.9.0 - ~/.local/state/fnm_multishells/98505_1730127764871/bin/npm npmPackages: jest: ^29.7.0 => 29.7.0

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 27
  • Comments: 29 (3 by maintainers)

Most upvoted comments

Fine that psl is solved, but I think psl is only one of punycode related problematic package in jest ecosystem @SimenB. after solving psl, my tests still complain about punycode and traces ends in tr46

(node:57226) [DEP0040] DeprecationWarning: The punycodemodule is deprecated. Please use a userland alternative instead. (Usenode --trace-deprecation … to show where the warning was created)

Problematic tr46 is dependency for whatwg-url@11.0.0 which is dependency for jsdom@20.0.3, which is dependency for jest-environment-jsdom@29.7.0

└─┬ jest-environment-jsdom@29.7.0
  └─┬ jsdom@20.0.3
    ├─┬ data-urls@3.0.2
    │ └─┬ whatwg-url@11.0.0
    │   └── tr46@3.0.0
    └─┬ whatwg-url@11.0.0
      └── tr46@3.0.0

So I think problem isn’t solved and issue needs to be reopen. Does anyone else still have the problem?

(no activity indeed)

some CSS parsing problems with jsdom<26.0.0 too because of not supporting @layer and so on…

Maybe there is something I don’t understand but why don’t we want to keep dependencies up to date? Is this version too invasive?

@LiviuSosu into package.json. Overrides are supported by npm itself https://docs.npmjs.com/cli/v10/configuring-npm/package-json#overrides other package managers have also this feature, maybe with another syntax …

NPM has also some bugs in overrides implementation, npm ls and google are your friends. Using overrides is always clumsy workaround 😃 (for me)

This clumsy npm overrides works for our app. It also fixes punycode problem in other our deps. packages. Because punycode problem is warning only and will be same for a long time, I hope it will be fixed in jest@next at least. 🙏

 "overrides": {
    "psl": "npm:@imput/psl@2.0.4",
    "data-urls@3.*": {
      "whatwg-url": "12.0.1"
    },
    "jest-environment-jsdom": {
      "jsdom": {
        "whatwg-url": "12.0.1"
      }
    }
  }