cannot use import statement outside a module mocha typescript code example
Example 1: cannot use import statement outside a module typescript
// Fix 1
Change .js files to .cjs
// Fix 2
Add "type": "module" to package.json
Example 2: typescript mocha Cannot use import statement outside a module
"test": "env TS_NODE_PROJECT=\"tsconfig.testing.json\" mocha --require ts-node/register 'src/test/**/*.ts'",