Running jest with ace

I’m trying to run jest in an ACE project. I keep getting:

SyntaxError: Cannot use import statement outside a module

it works if I do this:
“test”: “node --experimental-vm-modules ./node_modules/jest/bin/jest.js”
and this:
“type”: “module”

in package.json but then ACE won’t run (on npm start):
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /app/app.js

Any thoughts on this please?

Hey there,

have you tried just calling jest directly in your package.json?

    "test": "jest"

You should just be able to call yarn test or node test, then.


Thanks, but it didn’t make it work.
What eventually worked was this:
in package.json:
in “scripts” - “test”: “node --experimental-vm-modules ./node_modules/jest/bin/jest.js”
Add this as a section:
“jest”: {
“testMatch”: [
“moduleFileExtensions”: [

and change the type of my files from js to mjs.


You can also call node -r esm to enable (E)cma (S)cript (M)odules, i.e. use ‘import’ for dependencies.