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

Better support for mono-repositories

Open mircoba opened this issue 3 years ago • 7 comments

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.

mircoba avatar Jun 10 '21 04:06 mircoba

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

firsttris avatar Jun 13 '21 08:06 firsttris

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

mircoba avatar Jun 13 '21 08:06 mircoba

👍 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.

jengel3 avatar Oct 21 '21 17:10 jengel3

thx for your feedback, will merge with next release.

firsttris avatar Oct 21 '21 18:10 firsttris

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

nicoabie avatar Jun 19 '22 16:06 nicoabie

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

firsttris avatar Aug 14 '22 08:08 firsttris

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

firsttris avatar Oct 14 '22 08:10 firsttris

@mirco-b where are you???

nicoabie avatar Oct 28 '22 15:10 nicoabie

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.

mircoba avatar Oct 28 '22 16:10 mircoba