You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not using version 13.x of node (if so, please upgrade)
Description of the problem
Using jest 28.1.1, which does support ESM now, I'm not able to use this library. When I try and do a test I get this error:
SyntaxError: The requested module 'uuid' does not provide an export named 'v4'
at Runtime.linkAndEvaluateModule (node_modules/jest-runtime/build/index.js:828:5)
at TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:317:13)
at runJest (node_modules/@jest/core/build/runJest.js:407:19)
at _run10000 (node_modules/@jest/core/build/cli/index.js:339:7)
at runCLI (node_modules/@jest/core/build/cli/index.js:190:3)
Recipe for reproducing
In a spec file do this:
import {v4} from 'uuid'describe('Employee', () => {
let name: string
beforeEach(() => {
name = v4()
})
Additional information
I saw another issue on this from a couple years ago, but that essentially said "Jest doesn't support ESM" but you can do ESM modules now. This is my jest.config.mjs, where I've included uuid in the transformIgnorePatterns
Forgive me if I'm way off on this, I haven't dived too deep on this yet but I am running into this issue as well. I think the issue is with esm vs cjs resolution in the exports field in package.json. UUID doesn't have a type field in the package.json so Jest expects this to be a cjs package (absent an .mjs file extension). The "default" field in exports defaults to an esm file which causes Jest to choke when it sees the first export.
Probably the least invasive way to solve this would be for the esm-* folders to have a package.json file that just has
Before you begin...
Description of the problem
Using jest 28.1.1, which does support ESM now, I'm not able to use this library. When I try and do a test I get this error:
Recipe for reproducing
Additional information
I saw another issue on this from a couple years ago, but that essentially said "Jest doesn't support ESM" but you can do ESM modules now. This is my jest.config.mjs, where I've included uuid in the transformIgnorePatterns
Environment
System:
OS: macOS 12.4
CPU: (10) arm64 Apple M1 Pro
Memory: 212.77 MB / 16.00 GB
Shell: 6.21.00 - /bin/tcsh
Binaries:
Node: 18.4.0 - /opt/homebrew/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 8.12.1 - /opt/homebrew/bin/npm
Browsers:
Chrome: 102.0.5005.115
Safari: 15.5
npmPackages:
@angular-devkit/build-angular: ^14.0.2 => 14.0.2
@angular/animations: ^14.0.0 => 14.0.2
@angular/cli: ~14.0.2 => 14.0.2
@angular/common: ^14.0.0 => 14.0.2
@angular/compiler: ^14.0.0 => 14.0.2
@angular/compiler-cli: ^14.0.0 => 14.0.2
@angular/core: ^14.0.0 => 14.0.2
@angular/forms: ^14.0.0 => 14.0.2
@angular/localize: ^14.0.0 => 14.0.2
@angular/platform-browser: ^14.0.0 => 14.0.2
@angular/platform-browser-dynamic: ^14.0.0 => 14.0.2
@angular/router: ^14.0.0 => 14.0.2
@infragistics/igniteui-angular: 14 => 14.0.1
@ng-bootstrap/ng-bootstrap: ^13.0.0-beta.1 => 13.0.0-beta.1
@ngneat/spectator: ^11.0.1 => 11.0.1
@ngneat/until-destroy: ^9.2.0 => 9.2.0
@popperjs/core: ^2.10.2 => 2.11.5
@types/jest: ^28.1.2 => 28.1.2
@types/uuid: ^8.3.4 => 8.3.4
bootstrap: ^5.1.3 => 5.1.3
jest: ^28.1.1 => 28.1.1
jest-preset-angular: ^12.1.0 => 12.1.0
ng-mocks: ^14.0.1 => 14.0.1
ngx-ui-loader: ^13.0.0 => 13.0.0
rxjs: ~7.5.0 => 7.5.5
tslib: ^2.3.0 => 2.4.0
typescript: ~4.7.2 => 4.7.4
uuid: ^8.3.2 => 8.3.2
zone.js: ~0.11.4 => 0.11.6
The text was updated successfully, but these errors were encountered: