Is your feature request related to a problem? Please describe.
In a large monorepo where each package ("workspace" in npm/yarn/pnpm terms) has its own jest config, it's not desirable or feasible to have a hardcoded list of folders in virtualFolders. This makes the extension basically useless.
Describe the solution you'd like
Any of the following would work:
- A setting to read the
workspaces from the monorepo manager config (yarn/pnpm/npm) and automatically use those as virtual folders
- Support wildcards/globs in
virtualFolders (disadvantage: duplicating monorepo manager config)
- A setting to auto-discover the nearest jest config to the current file and use that
- Maybe look at what the eslint extension does for monorepos and copy that?
In any of those cases:
- I don't need/want a debug configuration for each package (there are too many). It's good enough to have debug configurations or other UI to run/debug the current file, current file's package, and maybe the whole repo.
- Only the current package (at most) should run on demand by default, at least above a certain number of packages. (In large repos, running tests for the whole repo will be too slow and CPU-intensive to run by default.)
Describe alternatives you've considered
Neither explicitly-enumerated virtual folders (added in response to #1044) nor a multi-root VS Code workspace are feasible due to the number of packages in the monorepo.
Currently in large repos, instead of using this extension, we have launch configurations (pointing to a wrapper script which finds the correct config and calls jest) for debug current open test and debug current package tests. Running tests for the whole repo is done via command line only. But it would be nice to have the option of using the extension.
It might be possible to point the extension at that wrapper script as jest.jestCommandLine, but it looks like currently the extension runs --listTests without any info about the current file, and it's probably not desirable or feasible to list tests for the whole repo in this scenario.
Additional context
I might be able to implement this, but would like feedback first on whether this is something you're open to and which approach might be best.
Is your feature request related to a problem? Please describe.
In a large monorepo where each package ("workspace" in npm/yarn/pnpm terms) has its own jest config, it's not desirable or feasible to have a hardcoded list of folders in
virtualFolders. This makes the extension basically useless.Describe the solution you'd like
Any of the following would work:
workspacesfrom the monorepo manager config (yarn/pnpm/npm) and automatically use those as virtual foldersvirtualFolders(disadvantage: duplicating monorepo manager config)In any of those cases:
Describe alternatives you've considered
Neither explicitly-enumerated virtual folders (added in response to #1044) nor a multi-root VS Code workspace are feasible due to the number of packages in the monorepo.
Currently in large repos, instead of using this extension, we have launch configurations (pointing to a wrapper script which finds the correct config and calls jest) for debug current open test and debug current package tests. Running tests for the whole repo is done via command line only. But it would be nice to have the option of using the extension.
It might be possible to point the extension at that wrapper script as
jest.jestCommandLine, but it looks like currently the extension runs--listTestswithout any info about the current file, and it's probably not desirable or feasible to list tests for the whole repo in this scenario.Additional context
I might be able to implement this, but would like feedback first on whether this is something you're open to and which approach might be best.