Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to cheerio exports has broken enzyme #2609

Closed
carystanley opened this issue Aug 13, 2024 · 1 comment
Closed

Changes to cheerio exports has broken enzyme #2609

carystanley opened this issue Aug 13, 2024 · 1 comment

Comments

@carystanley
Copy link

enzyme has started breaking, likely due to recent changes in cheerio

Current behavior

Using enzyme gives the following error because of changes made in cheerio:

20:52:44 ✖ ERROR: Error: Package subpath './lib/utils' is not defined by "exports" in /sd/workspace/src/git/project/node_modules/cheerio/package.json
20:52:44     at new NodeError (node:internal/errors:405:5)
20:52:44     at exportsNotFound (node:internal/modules/esm/resolve:366:10)
20:52:44     at packageExportsResolve (node:internal/modules/esm/resolve:713:9)
20:52:44     at resolveExports (node:internal/modules/cjs/loader:590:36)
20:52:44     at Function.Module._findPath (node:internal/modules/cjs/loader:664:31)
20:52:44     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1126:27)
20:52:44     at Function.Module._load (node:internal/modules/cjs/loader:981:27)
20:52:44     at Module.require (node:internal/modules/cjs/loader:1231:19)
20:52:44     at require (node:internal/modules/helpers:177:18)
20:52:44     at Object.<anonymous> (/sd/workspace/src/git/project/node_modules/enzyme/src/Utils.js:10:1)
20:52:44     at Module._compile (node:internal/modules/cjs/loader:1364:14)
20:52:44     at Module.replacementCompile (/sd/workspace/src/git/project/node_modules/append-transform/index.js:60:13)
20:52:44     at Module._compile (/sd/workspace/src/git/project/node_modules/pirates/lib/index.js:117:24)
20:52:44     at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
20:52:44     at /sd/workspace/src/git/project/node_modules/append-transform/index.js:64:4
20:52:44     at newLoader (/sd/workspace/src/git/project/node_modules/pirates/lib/index.js:121:7)
20:52:44     at Object.<anonymous> (/sd/workspace/src/git/project/node_modules/append-transform/index.js:64:4)
20:52:44     at Module.load (node:internal/modules/cjs/loader:1203:32)
20:52:44     at Function.Module._load (node:internal/modules/cjs/loader:1019:12)
20:52:44     at Module.require (node:internal/modules/cjs/loader:1231:19)
20:52:44     at require (node:internal/modules/helpers:177:18)
20:52:44     at Object.<anonymous> (/sd/workspace/src/git/project/node_modules/enzyme/src/ReactWrapper.js:4:1)
20:52:44     at Module._compile (node:internal/modules/cjs/loader:1364:14)
20:52:44     at Module.replacementCompile (/sd/workspace/src/git/project/node_modules/append-transform/index.js:60:13)
20:52:44     at Module._compile (/sd/workspace/src/git/project/node_modules/pirates/lib/index.js:117:24)
20:52:44     at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
20:52:44     at /sd/workspace/src/git/project/node_modules/append-transform/index.js:64:4
20:52:44     at newLoader (/sd/workspace/src/git/project/node_modules/pirates/lib/index.js:121:7)
20:52:44     at Object.<anonymous> (/sd/workspace/src/git/project/node_modules/append-transform/index.js:64:4)
20:52:44     at Module.load (node:internal/modules/cjs/loader:1203:32)
20:52:44     at Function.Module._load (node:internal/modules/cjs/loader:1019:12)
20:52:44     at Module.require (node:internal/modules/cjs/loader:1231:19)
20:52:44     at require (node:internal/modules/helpers:177:18)
20:52:44     at Object.<anonymous> (/sd/workspace/src/git/project/node_modules/enzyme/src/index.js:1:1)
20:52:44     at Module._compile (node:internal/modules/cjs/loader:1364:14)
20:52:44     at Module.replacementCompile (/sd/workspace/src/git/project/node_modules/append-transform/index.js:60:13)
20:52:44     at Module._compile (/sd/workspace/src/git/project/node_modules/pirates/lib/index.js:117:24)
20:52:44     at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
20:52:44     at /sd/workspace/src/git/project/node_modules/append-transform/index.js:64:4
20:52:44     at newLoader (/sd/workspace/src/git/project/node_modules/pirates/lib/index.js:121:7)
20:52:44     at Object.<anonymous> (/sd/workspace/src/git/project/node_modules/append-transform/index.js:64:4)
20:52:44     at Module.load (node:internal/modules/cjs/loader:1203:32)
20:52:44     at Function.Module._load (node:internal/modules/cjs/loader:1019:12)
20:52:44     at Module.require (node:internal/modules/cjs/loader:1231:19)
20:52:44     at require (node:internal/modules/helpers:177:18)
20:52:44     at Object.<anonymous> (/sd/workspace/src/git/project/tests/lib/enzyme.js:1:16)
20:52:44     at Module._compile (node:internal/modules/cjs/loader:1364:14)
20:52:44     at Module.replacementCompile (/sd/workspace/src/git/project/node_modules/append-transform/index.js:60:13)
20:52:44     at Module._compile (/sd/workspace/src/git/project/node_modules/pirates/lib/index.js:117:24)
20:52:44     at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
20:52:44     at /sd/workspace/src/git/project/node_modules/append-transform/index.js:64:4
20:52:44     at newLoader (/sd/workspace/src/git/project/node_modules/pirates/lib/index.js:121:7)
20:52:44     at Object.<anonymous> (/sd/workspace/src/git/project/node_modules/append-transform/index.js:64:4)
20:52:44     at Module.load (node:internal/modules/cjs/loader:1203:32)
20:52:44     at Function.Module._load (node:internal/modules/cjs/loader:1019:12)
20:52:44     at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:203:29)
20:52:44     at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
20:52:44     at ModuleLoader.import (node:internal/modules/esm/loader:337:24)
20:52:44     at importModuleDynamicallyWrapper (node:internal/vm/module:432:15)
20:52:44     at formattedImport (/sd/workspace/src/git/project/node_modules/mocha/lib/nodejs/esm-utils.js:7:14)
20:52:44     at exports.requireOrImport (/sd/workspace/src/git/project/node_modules/mocha/lib/nodejs/esm-utils.js:48:32)
20:52:44     at exports.handleRequires (/sd/workspace/src/git/project/node_modules/mocha/lib/cli/run-helpers.js:94:28)
20:52:44     at /sd/workspace/src/git/project/node_modules/mocha/lib/cli/run.js:353:25 {
20:52:44   code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
20:52:44 }

enzyme uses cheerio =1.0.0-rc.3 published 5 years ago
https://github.com/enzymejs/enzyme/blob/master/packages/enzyme/package.json#L44

enzyme recently finally released 1.0.0 published 4 days ago

I assume that changes to how enzyme handles exports has caused issues with the release of cheerio 1.0.0

@ljharb
Copy link
Member

ljharb commented Aug 13, 2024

Duplicate of #2558. The next release will fix it.

@ljharb ljharb closed this as not planned Won't fix, can't repro, duplicate, stale Aug 13, 2024
glepretre added a commit to Kozea/formol that referenced this issue Sep 3, 2024
cheerio (https://github.com/cheeriojs/cheerio) has release an official 1.0.0
version after years of Release Candidate ones.

cheeriojs/cheerio#4044
cheeriojs/cheerio#4032
cheeriojs/cheerio#3987

We depend on enzyme (https://github.com/enzymejs/enzyme) which depends
on cheerio.

Enzyme has not correctly locked cheerio RC version:
enzymejs/enzyme@cafdb2b

They're working on it...
enzymejs/enzyme#2558
enzymejs/enzyme#2606
enzymejs/enzyme#2607
enzymejs/enzyme#2608
enzymejs/enzyme#2609

Meanwhile, locking cheerio here allow us to update our dependencies.

According to enzyme, Cheerio RC was the last one supported by enzyme,
even though RC12 seems to work for us.
glepretre added a commit to Kozea/formol that referenced this issue Sep 3, 2024
cheerio (https://github.com/cheeriojs/cheerio) has released an official 1.0.0
version after years of Release Candidate ones.

cheeriojs/cheerio#4044
cheeriojs/cheerio#4032
cheeriojs/cheerio#3987

We depend on enzyme (https://github.com/enzymejs/enzyme) which depends
on cheerio.

Enzyme has not correctly locked cheerio RC version:
enzymejs/enzyme@cafdb2b

They're working on it...
enzymejs/enzyme#2558
enzymejs/enzyme#2606
enzymejs/enzyme#2607
enzymejs/enzyme#2608
enzymejs/enzyme#2609

Meanwhile, locking cheerio here allow us to update our dependencies.

According to enzyme, Cheerio RC was the last one supported by enzyme,
even though RC12 seems to work for us.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants