How to provide 2 directory paths to AER from IC2?

21 views
Skip to first unread message

Kris Goncalves

unread,
Mar 13, 2026, 11:42:03 AM (6 days ago) Mar 13
to Illuminated Cloud General Discussion
Testing out the new "run with AER" - I get an error that 

"Failed to determine modules for test declarations."

Looking into the errors (had to run it locally to get that information) - it couldn't resolve some cmdt records that were in a 2nd package directory defined in sfdx-project.json. Passing in both directories to aer directly solved that problem running it locally

aer test --dry-run force-app custom-metadata

Then identified another issue - we're a managed package team so it seemed it couldn't resolve our namespace - passing that in resolved it

  aer test --default-namespace mynamespace force-app custom-metadata

So for getting it to work in IntelliJ - it seems I can pass in aer options - but, I can't seem to provide the 2 directories I need to get it to work? They're defined in my sfdx-project.json. Is it possible or just a misconfiguration on my project?

Here's some digging which makes me think it's on my config

 
 - Both directories are mapped as source folders
 - moduleToTestClassNames map in workspace.xml is empty
  - Log shows ApexUnitTestRunProfileState - Executing unit tests for run configuration 'All Tests' but no subsequent aer process

Scott Wells

unread,
Mar 13, 2026, 11:45:23 AM (6 days ago) Mar 13
to Illuminated Cloud General Discussion, Kris Goncalves

Make sure that all directories that are in sfdx-project.json are also under configured source roots in the IDE. IC adds the configured source roots as the path arguments when it builds the aer command-line, so it sounds like at least one is not configured for the IDE. Let me know if you’re not sure how to check/configure the source roots.

Regards,
Scott Wells

Kris Goncalves

unread,
Mar 13, 2026, 11:57:21 AM (6 days ago) Mar 13
to Illuminated Cloud General Discussion, sc...@illuminatedcloud.com, Kris Goncalves
Got it - also the empty map was because I used the "all tests" checkbox in run config. When I switched to actually checking all tests it populated in the test classes window - that populated - but, still failed for same error

Both directories are configured as sources but please let me know if I'm looking in the wrong place - I see it in UI under Project Structure --> Modules

Then - I see, in my .iml file

 <option name="defaultSourceRootUrl" value="file://$MODULE_DIR$/force-app" />

and then

<sourceFolder url="file://$MODULE_DIR$/custom-metadata" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/force-app" isTestSource="false" />

Scott Wells

unread,
Mar 13, 2026, 12:14:26 PM (6 days ago) Mar 13
to Illuminated Cloud General Discussion, Kris Goncalves, Scott Wells

It should work fine with All Tests. IC will scan the source roots for all test classes and add them explicitly to the command-line via -f arguments.

Are you still getting “Failed to determine modules for test declarations”? If so, that means there’s still some kind of configuration issue. Can you share your entire .iml file so I can see if it’s in there?

Regards,
Scott Wells

Kris Goncalves

unread,
Mar 13, 2026, 12:46:18 PM (6 days ago) Mar 13
to Illuminated Cloud General Discussion, sc...@illuminatedcloud.com, Kris Goncalves
Yes - sorry should've been clearer on errors


"Failed to determine modules for test declarations."


<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
  <component name="FacetManager">
    <facet type="IlluminatedCloud" name="Illuminated Cloud">
      <configuration>
        <option name="connectionName" value="BulkLicensing2" />
        <option name="connectionType" value="SFDX" />
      </configuration>
    </facet>
  </component>
  <component name="NewModuleRootManager" inherit-compiler-output="true">
    <exclude-output />
    <content url="file://$MODULE_DIR$">
      <sourceFolder url="file://$MODULE_DIR$/config" type="java-resource" />
      <sourceFolder url="file://$MODULE_DIR$/custom-metadata" isTestSource="true" />
      <sourceFolder url="file://$MODULE_DIR$/force-app" isTestSource="true" />
      <excludeFolder url="file://$MODULE_DIR$/.sf" />
      <excludeFolder url="file://$MODULE_DIR$/.sfdx" />
      <excludeFolder url="file://$MODULE_DIR$/.vnx-data" />
      <excludeFolder url="file://$MODULE_DIR$/.claude" />
      <excludeFolder url="file://$MODULE_DIR$/.gemini" />
      <excludeFolder url="file://$MODULE_DIR$/node_modules" />
      <excludeFolder url="file://$MODULE_DIR$/venv" />
      <excludeFolder url="file://$MODULE_DIR$/robot/automation/output" />
      <excludeFolder url="file://$MODULE_DIR$/IlluminatedCloud" />
      <excludeFolder url="file://$MODULE_DIR$/.illuminatedCloud" />
      <excludeFolder url="file://$MODULE_DIR$/coverage" />
      <excludeFolder url="file://$MODULE_DIR$/results" />
    </content>
    <orderEntry type="jdk" jdkName="IlluminatedCloud (manage/BulkLicensing2)" jdkType="IlluminatedCloud" />
    <orderEntry type="sourceFolder" forTests="false" />
    <orderEntry type="library" name="@types/jest" level="application" />
    <orderEntry type="library" name="@types/node" level="application" />
    <orderEntry type="library" name="manage/lwc_types" level="project" />
  </component>
</module>

Scott Wells

unread,
Mar 13, 2026, 1:02:45 PM (6 days ago) Mar 13
to Illuminated Cloud General Discussion, Kris Goncalves, Scott Wells

I think this may be the issue:

<sourceFolder url="file://$MODULE_DIR$/custom-metadata" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/force-app" isTestSource="true" />

Notice that those are marked as test source roots. Can you try changing them to be standard source roots instead? That may not help, but let’s see. If it doesn’t, I may need to instrument this a bit with debug logging — which will help me troubleshoot stuff in this area better anyway — and give you a pre-release build that with that enabled so I can see better what’s going on as it’s translating the unit test run config into the actual tests to be executed.

Regards,
Scott Wells

Scott Wells

unread,
Mar 13, 2026, 2:46:53 PM (6 days ago) Mar 13
to Illuminated Cloud General Discussion, Scott Wells, Kris Goncalves
Reply all
Reply to author
Forward
0 new messages