testing-library / jest-dom

:owl: Custom jest matchers to test the state of the DOM

Home Page:https://testing-library.com/docs/ecosystem-jest-dom

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

6.1.0 @adobe/css-tools crashing

wojtekmaj opened this issue · comments

  • @testing-library/jest-dom version: 6.1.0
  • node version: 18
  • npm (or yarn) version: yarn 3.6.0

Relevant code or config:

n/a

What you did:

Ran basic React tests, working fine with jest-dom@5, after updating to jest-dom@6 (this is important - NOT a clear install).

What happened:

SyntaxError: Named export 'parse' not found. The requested module '@adobe/css-tools' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@adobe/css-tools';
const { parse } = pkg;

Problem description:

The required version of @adobe/css-tools jest-dom declares, ^4.0.1, is NOT correct. In my lockfile, it has already been resolved to 4.2.0. This hasn't changed with jest-dom@6 update, because ^4.0.1 is still the desired version range. This produced the error above.

After investigation, it turned out @adobe/css-tools 4.3.0 is the first release with ESM support.

Suggested solution:

Bump minimum @adobe/css-tools dependency to ^4.3.0.

PR #523 solves this, too.

Related to #522?

I updated from 5.17.0 and it is still present in 6.1.1. I still have @adobe/css-tools with 4.2.0.
Although a fresh install installs @adobe/css-tools with 4.3.1 and it does not report the bug anymore.

I can't reproduce this issue. Can someone please either explain the environment they're using or link to a reproduction?

Facing same error for @testing-library/jest-dom: v6.1.1

SyntaxError: Named export 'parse' not found. The requested module '@adobe/css-tools' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@adobe/css-tools';
const { parse } = pkg;

@nickmccurdy I also had a really hard time reproducing this, but I was able to get the same error message with the following setup:

  1. Jest in ESM mode
  2. Pin @adobe/css-tools at 4.0.x

https://github.com/jgoz/jest-dom-524

Similarly, I was running Vitest (so, obviously ESM) and @adobe/css-tools was at 4.2.0 in my lockfile. Letting @adobe/css-tools bump to 4.3.1 immediately fixed the issue.

+1

yarn add @adobe/css-tools@4.3.1
npx yarn-deduplicate
yarn remove @adobe/css-tools

This fixed the issue.

+1
this should be fixed asap in order to aovid crashing in existing project

🎉 This issue has been resolved in version 6.1.2 🎉

The release is available on:

Your semantic-release bot 📦🚀