Unit tests from node_modules not found

Issue #2359 open
Luke Kozakewycz created an issue

We have a node_modules directory in our sfdx project. This allows us to use the same libraries across multiple projects easily.

I can’t seem to mark node_modules as Not Excluded, so not only can I not index them, I can't run the tests within them either.

If I pull the files out of the node_modules and place them elsewhere, they get recognized as expected.

Do you know of any solution to get them recognized without having to get our C/D to extract them from the node_modules directory? It used to work but I’ve had to build a completely fresh machine and has since stopped.

node_modules is marked as a Sources Root.

Comments (8)

  1. Scott Wells repo owner

    Got it. Unfortunately the behavior of the node_modules stuff is coming straight from JetBrains. They automatically treat that as a module library dependency. My guess is that it would likely take some nasty hacks to include files from there in the unit test run, or minimally it could be quite slow scanning for tests since the contents of node_modules directories can get quite extensive.

  2. Luke Kozakewycz reporter

    since the contents of node_modules directories can get quite extensive.

    Not in our case. It’s only as much as you would expect in the main project - it just allows us to manage our codebase across projects better.

    I thought this might be the case (an IntelliJ issue) in which case I don’t have high hopes on this. I’m guessing we will have to pull our code out.

  3. Scott Wells repo owner

    I’ll certainly be happy to keep this open and take a look at what I can do (if anything), though to set expectations properly, it will likely be a while as I’m currently working through changes for both Salesforce and JetBrains upcoming releases.

  4. Log in to comment