Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Bug Report: SyntaxError: Cannot use import statement outside a module #81

Closed
1 task done
arimus opened this issue Nov 12, 2023 · 1 comment
Closed
1 task done

Comments

@arimus
Copy link

arimus commented Nov 12, 2023

📜 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

@arimus
Copy link
Author

arimus commented Nov 14, 2023

FYI, looks like this issue is related to issue #34. I was able to convert the remainder to typescript locally and rebuild and had no issues importing the environment after that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant