π Bug Report: SyntaxError: Cannot use import statement outside a module
arimus opened this issue Β· comments
π Description
It appears that jest can not properly interpret the index.js file, since it is using imports and is not in commonjs format unlike the compiled TS portions of the code base.
π Reproduction steps
Use jest to run *.js files instead of using ts-jest, etc. Useful, because there are some challenges with ts-jest and we can run tests on *.js after TS files are compiled down to commonjs.
π Expected behavior
It should not have a syntax error when parsing.
π Actual Behavior with Screenshots
@appbloks/storage:test: β Test suite failed to run
@appbloks/storage:test:
@appbloks/storage:test: test/node_modules/.pnpm/@traceloop+jest-environment-otel@0.8.0/node_modules/@traceloop/jest-environment-otel/index.js:1
@appbloks/storage:test: import { teardown, setup } from './dist/global';
@appbloks/storage:test: ^^^^^^
@appbloks/storage:test:
@appbloks/storage:test: SyntaxError: Cannot use import statement outside a module
π€ Node Version
v18.10.0
π Provide any additional context for the Bug.
No response
π Have you spent some time to check if this bug has been raised before?
- I checked and didn't find similar issue
Are you willing to submit PR?
None