Possible to do project specific run/debug configurations templates?

Hi,

I work on multiple React apps that have different Jest package locations (for example, some projects use /node_modules/react-scripts, and others use /node_modules/@craco/craco.) Is there a way to create run/debug configuration templates per project? If I update the Jest template to point to either react-scripts or craco, that means half my projects' configs won't work unless I manually fix the Jest package for each one.

If per-project config templates aren't possible, how else can I set the Jest package per project?

4 comments
Comment actions Permalink

Changes in run configuration template are saved per project, in .idea/workspace.xml.

Note that in the upcoming WebStorm 2020.3 it will be possible to store run configuration templates as xml files in .idea/runConfigurations/ folder or in any folder within project content roots, see https://youtrack.jetbrains.com/issue/IDEA-65915#focus=Comments-27-4403191.0-0

0
Comment actions Permalink

Thanks Elena. I'm using WebStorm 2020.2.3 and it appears that if multiple projects are attached within the same window the Jest template is shared between them all. For example, I start work on Project A and change the Jest template, then work on Project B and change the template again, new configurations for Project A will use the changes made from Project B.

Opening projects in new windows does not seem to have the same issue.

0
Comment actions Permalink

this is a known limitation unfortunately - attached projects are not treated as separate projects actually, attaching a project is more or less equal to adding one more content root to the main project - so the IDE behaves as if there is a single project opened, not multiple ones.
Please follow the tickets linked to https://youtrack.jetbrains.com/issue/WEB-7968 for updates

0
Comment actions Permalink

Sorry for the necro but I've spent the better part of the last three hours dorking around with this. I finally realized that setting the root folder for the project as the test sources directory will resolve the issue and figured I would leave that tidbit here in posterity for the next person.

Right Click on Project Root Folder > Mark Directory As > Test Sources

0

Please sign in to leave a comment.