This is because it is using ES modules (export and import). ECMAScript Modules · Jest On the other side, when you run the test with react-scripts it uses babel behind the scene to Transpile the code. //Installing dependencies for jest and vue js npm i -D @vue/test-utils jest vue-jest @vue/babel-preset-app [email protected]^7.0.0-bridge.0 SyntaxError: Cannot use import statement outside a module when following vue-test-utils official tutorial I can't get vue testing to work with vue-test-utils and jest. React: SyntaxError: Cannot use import statement outside a module ... So, you have just learned that it is better to use specific imports instead of the { destruct } syntatx. Jest Autoconfiguration: [Error] SyntaxError: Cannot use import ... SyntaxError: Cannot use 'import.meta' outside a module appears in any test touching the file. Conclusion. By default, if Jest sees a Babel config, it will use that to transform your . How to fix the 'SyntaxError: Cannot use import statement outside a ... Jest calls these values a "path to transformer". モジュール外でimportステートメントを使用できない問題を修正 Uncaught SyntaxError: Cannot use import statement outside a module" when importing ECMAScript 6 Common Cases of "SyntaxError: Cannot use import statement outside a module" This can happen in different cases depending on whether you're working with JavaScript on the server-side with Node.js, or client-side in the browser. import {jest} from '@jest/globals'; jest.useFakeTimers(); Then Jest will transform the modules into something it can use. The "explanation" it gives seems a little contradictory given that I am using import instead of require, and it says that it's an ES module yet above it tells me it isn't. Jest - SyntaxError: Cannot use import statement outside a module - NewbeDEV