Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Comma: "No test source roots in the project: is it properly configured?"

Tags:

Comma 2020.07 (community edition) has changed the test configuration, and now you can test different things: module, project and so on. However, I can't simply get it to run the usual tests. When I use "All in project" testing, I get this error:

No test source roots in the project: is it properly configured?

I have no idea where to set the source roots, or how to configure it properly. Tests are in the usual place, t/.

like image 507
jjmerelo Avatar asked Aug 08 '20 07:08

jjmerelo


1 Answers

When a new project is created or imported, the lib directory should get marked as a source root (where modules live) and the t directory as a test root (where the tests live). Previously, Comma paid no attention to these markings and just hard-coded looking in the t directory for tests, but ongoing work is aiming to support a wider range of project structures, and thus as of a recent release the concept of test root started to matter.

Somehow, you've ended up with a project where the t folder is not marked as a test root. I'm not sure how that happened, but there are ways to try to fix this situation.

One is to re-import the project from source, which should set it up correctly, but will lose run configurations.

An alternative is to open the .iml file in the root directory of the project. In a correctly configured project there will be an entry like this:

    <content url="file://$MODULE_DIR$">
      <sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
      <sourceFolder url="file://$MODULE_DIR$/t" isTestSource="true" />
    </content>

Yours is probably missing the entry for the t directory with isTestSource set to true.

Future Comma versions will provide a way on the UI to do this, so that one can set up multiple test roots if needed (t and xt for example).

like image 156
Jonathan Worthington Avatar answered Sep 18 '22 11:09

Jonathan Worthington