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

Cannot use import satement outside a module #359

Closed
cesar-rl opened this issue Mar 25, 2024 · 5 comments
Closed

Cannot use import satement outside a module #359

cesar-rl opened this issue Mar 25, 2024 · 5 comments

Comments

@cesar-rl
Copy link

I'm using Typescript and I'm getting this error just out of the box. When I run from the CLI, jest runs ok.

Does someone knows how to allow imports using this extension?

@firsttris
Copy link
Owner

Hey the extension is simply generating a command which is executed from CLI.
So it should be pretty much the same as when you execute Jest from CLI.

there is nothing which prevents you from using import statements.

@cesar-rl
Copy link
Author

I think I got the problem.

In my project, config files are not in the root folder, so I need to pass the --config <PATH> to Jest in the CLI. Is there a way to inform the extension the path to the config file? Or to add the --config <PATH> to the Jest CLI calls?

In the CLI:
image

Using the extension:
image

@cesar-rl
Copy link
Author

I saw on this issue that the extension looks all the way up from the current folder, buit in my case it is in a way down, so it would need to be informed as a configuration.
Could I contribute in this? Or is it already done?

@firsttris
Copy link
Owner

https://github.com/firsttris/vscode-jest-runner?tab=readme-ov-file#extension-settings

there is a extension setting for this jestrunner.configPath

@cesar-rl
Copy link
Author

Thanks, it did the job. Now I have a problem with the reporter, I'll search for any issues about the subject.

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

2 participants