'How can I avoid "not in ecosystem" errors thrown by comma IDE?
I have a test file in my module's t/ directory that does a use on a TestUtils files which has some variables and routines:
use Test;
use TestUtils;
plan 4;
check_cmd_output('No arguments');
check_cmd_output('Successfully ingested', test_md_file);
check_cmd_output('Successfully ingested', test_md_file, 1);
check_cmd_output('Successfully ingested', vimwiki_arg_sim());
It works fine. However, Comma was complaining about TestUtils not being found "in the ecosystem" as well as throwing errors with identifiers from the TestUtils module that it was not loading:
I was able to stop Comma from complaining by:
- Exporting the identifiers in the
TestUtilsfile - Fully qualifying the identifiers in my test file with something like:
TestUtils::check_cmd_output(...) - Adding
TestUtilsto theprovideshash in the META6.json file.
I'm thinking there is probably a better way. I tried doing stuff like use lib 't' and use lib '.' but that did not help. Thanks.
Solution 1:[1]
Comma doesn't handle this situation perfectly; it understands (following the IntelliJ platform naming conventions):
- Source roots, which are used as roots for resolving
usestatements within the project (anything not resolved is assumed to be from the module ecosystem) - Test roots, where test files are found (used for, for example, being able to run tests in an
xtdirectory)
These are, however, mutually exclusive. If the TestUtils module were to be placed in a lib directory inside of t, then that lib directory could be marked as a source root, and the symbols should be resolved.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jonathan Worthington |

