"SyntaxError: Cannot use import statement outside a module" running jest
wuifdesign opened this issue · 3 comments
wuifdesign commented
@testing-library/preact
version:3.2.3
preact
version:10.13.2
node
version:18.14.0
npm
version:9.3.1
What happened:
Starting with v3.1.0
i have problems running my tests with jest.
When running jest i get following error:
.../node_modules/@testing-library/preact/dist/esm/index.mjs:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import { cleanup } from "./pure.mjs";
^^^^^^
SyntaxError: Cannot use import statement outside a module
// jest.config.js
const config = {
testEnvironment: 'jsdom',
transform: {
'\\.[jt]sx?$': ['@swc/jest']
}
}
akselinurmio commented
We’re getting this same error while running our tests. Tests pass when using version 2.0.1 of this package, but fail in 3.0.0.