I am using elm-explorations/test with rtfeldman/node-test-runner to run tests within my elm project.
I have my tests within a custom directory so I attempt to use the glob option within the node-test-runner for elm to find and execute the tests. I receive this error every time I attempt to execute the tests:
My run command: elm-test "custom_name_example/*.elm"
Error: I couldn't find any exposed values of type Test in files matching "/[abs_path]/custom_name_example/Example.elm"
I replicated this issue with a new elm project. To replicate:
Create a new elm project (elm init)
Init elm test (elm-test init)
Move the elm tests folder and call it something custom.
Attempt to run the tests from the custom folder (elm-test “[custom_name]/*.elm”)
I am unsure what the problem is as there are many examples of people using globs in custom directories for their elm tests.
Hi, the issue is that module names have to match with their paths. When you use globs, instead of the tests/ folder, the module names inside those files must match with the path from an elm source directory. I don’t think elm-test is able to guess which source directories exist if you don’t specify them somewhere. If you add custom_name_example to the list of source directories in your elm.json file, elm-test should work I think.
(Also note that some information in that link might not be 100% accurate currently – some details might depend on fixed bugs that haven’t been released to npm yet.)
Also @lydell, as I tried to solve this problem myself I saw your recent activity on improving the node-test-runner package, excellent work on making the open source world better!