Skip to content

[Bug]: Cannot use with lit-element due to ESM errors, even with transformIgnorePatterns #11783

@cdrini

Description

@cdrini

Version

27.0.6

Steps to reproduce

  1. Clone my minimal reproducible repo: https://github.com/cdrini/lit-jest-babel-test
  2. Run npm install
  3. Run npx jest

Expected behavior

I expect to see the tests run

Actual behavior

The test is not run with this error:

    Details:

    C:\...\lit-jest-babel-test\node_modules\lit-element\lit-element.js:57
    import { render } from 'lit-html/lib/shady-render.js';
    ^^^^^^

    SyntaxError: Cannot use import statement outside a module

Despite the fact that this is file should be babel-ed by my jest.config.js

Additional context

No response

Environment

System:
    OS: Windows 10 10.0.19042
    CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
  Binaries:
    Node: 14.16.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.17.3 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.14.7 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    jest: ^27.0.6 => 27.0.6

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions