-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Support having multiple test configs #428
Comments
Seems like we can achieve this after this #129 issue is closed. But i don't see any action on it. |
I have the exact same setup and would love being able to configure that. |
Any news about this feature? |
I have a very similar problem. In my opinion, the best way to solve this would be to take the config file closest to the current test file as the responsible config file. |
I think this could potentially help with monorepo projects where the CLI is configured to run jest using See nrwl/nx#2803 and nrwl/nx#2344 |
Done with https://jestjs.io/docs/en/configuration#projects-arraystring--projectconfig like 3+ years ago |
#129 basically supports vscode's multiroot workspaces, which can be used for monorepo project (each package can be configured as a folder). I can see a few possible ways to do this today:
Please let us know if any of the above works for you. |
@connectdotz I have some issues settings 'propagation' in multiroot mode. But additional thing to check for 1st point - in launch options use some vscode path variable that points to current (sub) workspace, not root/main |
If jest config is not common for all subprojects, then their all other configs should be different - extensions, settings, launches. So rather natural to supply them own 'scope' with workspace |
Following (as @askirmas suggested) works out of the box with jest. I adapted everything according to @yatki's needs: const createProject = (type) => ({
transform: {
'^.+\\.(t|j)sx?$': 'ts-jest',
},
globals: {
'ts-jest': {
isolatedModules: true,
},
},
displayName: type,
preset: 'ts-jest',
globalSetup: `./__setup__/${type}/jest.global-setup.ts`,
setupFilesAfterEnv: [`./__setup__/${type}/jest.setup-after-env.ts`],
testRegex: `(/test/${type}/.*| (\\.| /)(test|spec))\\.[jt]sx?$`,
});
module.exports = {
projects: [
createProject('unit'),
createProject('integration'),
createProject('functional'),
],
}; With that config debug works just as expected on each folder. |
Is there a documented way in which to configure this; if the projects differ? @JPeer264's projects are all the same but there could be a situation in which your project setup (unit/integration etc) are different? |
Expected Behavior
I have a project that in test folder I have unit, integration and functional tests. Each test folder has its own configuration and setup files.
It would be great to have possibility to map different configuration for different test folders.
Example:
So this way, for the test files under
test/unit
folder, extension will execute the corresponding command.Actual Behavior
It doesn't support this at the moment.
The text was updated successfully, but these errors were encountered: