testify
testify copied to clipboard
Monorepo support
Neat plugin, running tests from codelens is super useful! -- Maybe this is already possible, but I'm not sure how
Is your feature request related to a problem? Please describe.
Test runner not detected in monorepo
For example
project
- modules
- moduleA
- node_modules
- testA.spec.ts
- moduleB
- node_modules
- testB.spec.ts
Describe the solution you'd like
I'd like to use run testA.spec.ts with a test runner from moduleA/node_modules
Hello @calebboyd !
This feature would really be a great addition to the project. The way it works today is:
- the extension looks for the test ruuner in the node_modules directory in the root of the workspace; or
- the extension looks for the test ruuner at the path you specified in the configurations;
I am trying to figure out a new method write a factory for this so it can be a little more flexible but couldn't find a way yet. I'll make this issue with help wanted
Hey @felixjb I'm looking into this a bit and am working on the following approach
(pseudo code)
const { runnerHints, testNames } = parse(testFile)
const runner = findRunnerUp(testFile, runnerHints)
const testRoot = findPkgUp(testFile, runner.name)
runner.runTest({ cwd: testRoot, testFile, testNames })
The big difference being, the cwd of the runner command is set to the nearest package.json directory to the test file, that contains that runner. I can also work on moving runner command generation to a factory function and generalize the runTest,debugTest implementation.
Hey @calebboyd , thank you for picking this up.
That package.json idea is pretty cool. Maybe you could also base your implementation on how Git handles the commits in a repository, which seems similar
Should this not work out of the box when using workspaces?
@roggenbrot I don't know, maybe not. Some projects use a monorepo structure, some even use a framework called lerna which makes one repo have multiple package.json files