Skip to content

ESM Problems with Jest@26 and Node.js 14.x #451

@ctavan

Description

@ctavan

Hi, I'm using jest to test my project.
Trying to test a file where I import uuid results with an error:

 ● Test suite failed to run

    SyntaxError: The requested module 'uuid' does not provide an export named 'v1'

          at async Promise.all (index 0)
      at jasmine2 (node_modules/jest-jasmine2/build/index.js:228:5)

I saw @Dps910 comment and I guess it's something similar.
I'm using UUID@8, node@14 and Jest@26 (and it's freshly-supported esm modules implementation).

Jest command:
node --experimental-vm-modules .\node_modules\jest\bin\jest.js
The file that I'm testing imports uuid like you suggested:

import { v1 as uuidv1 } from 'uuid';
uuidv1();

It fails only when I'm testing though.

Originally posted by @Tzahile in #245 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions