vscode-jest-runner icon indicating copy to clipboard operation
vscode-jest-runner copied to clipboard

Cannot use import satement outside a module

Open cesar-rl opened this issue 1 year ago • 1 comments

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?

cesar-rl avatar Mar 25 '24 20:03 cesar-rl

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.

firsttris avatar Mar 26 '24 06:03 firsttris

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 avatar Mar 26 '24 11:03 cesar-rl

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?

cesar-rl avatar Mar 26 '24 11:03 cesar-rl

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

there is a extension setting for this jestrunner.configPath

firsttris avatar Mar 26 '24 12:03 firsttris

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

cesar-rl avatar Mar 26 '24 23:03 cesar-rl