vscode-jest-runner
vscode-jest-runner copied to clipboard
Better support for mono-repositories
With this PR the configuration will be located as close as possible to the test file.
- Replace the usage of vscode.workspace configuration with new implementation
- Introduce Interface to define which methods should be exposed by the Configuration
- Implement method to travel up the directory tree to find a
.vscode/settings.json
as close as possible to the active test file.
This will allow to specify multiple configurations (e.g. per package) in a Workspace that contains multiple packages/projects while also preserving the mechanism to have one central per workspace configuraiton.
hey @mirco312312
can you make an example why you need a seperate jest-runner settings.json for each of you package?
i just want to understand why this is needed.
best regards Tristan
hey @firsttris,
Thanks for looking into this!
I work on multiple workspaces where there is a need to adapt jestrunner.configPath
, jestrunner.debugOptions
and jestrunner.runOptions
based on the needs of the individual packages.
-> example would be: any workspace with multiple packages where each package provides its own jest.config
.
Best Mirco
👍 Very much support this idea. We have projects with isolated test suites (i.e. unit vs integration tests) and each have their own jest config file, but vscode-jest-runner only finds the default jest config and doesn't recognize multiple. With this, we could add a separate settings.json file within our integration tests folder which would point to the correct jest config for those tests.
thx for your feedback, will merge with next release.
Hey @firsttris @mirco-b is this something you guys can merge? I have the exact same scenario. I need to run jest in the folder that has the jest config.
We are using monorepo and have subapps So if I run a test from a subapp I would need to scope that to that folder
hey @mirco-b sorry for not merging so long, i had some private issues and was in the hospital for some time.
also i was a bit scared to introduce new bugs.
but if you are happy with your PR we can merge & test it this week and see if someone complains.
best regards Tristan
hey @mirco-b i tested this PR but somehow the CodeLensProvider stopps working.
i did some debugging but did not find the issue.
somehow the codeLens array here is empty: https://github.com/firsttris/vscode-jest-runner/blob/master/src/JestRunnerCodeLensProvider.ts#L63
@mirco-b where are you???
Hey @nicoabie thanks for looking into this but currently I don’t have any capacity to polish this. Also it’s no immediate need for me anymore, the issues I experienced before are gone.