Context
I'm using Sublime Text 2 as an editor for Erlang programming and the SublimeErl Plugin for some additional features like compile on save, running EUnit tests and Dializer.
I've started with a directory layout like this:
├── src
├── test
├── rel
└── rebar.config
I could open a test file in ./test and run it pressing ALT+SHIFT+F7
.
Then I started some big refactoring splitting up source files to different apps:
├── src
├── test
├── rel
├── apps
│ ├── app1
│ └── app2
└── rebar.config
However, I kept a root app (the one that start the supervisor hierarchy and all the other apps.
The Problem
The problem was, I wasn't able to run the tests anymore. SublimeErl actually opened the test pane and printed Starting tests (SublimErl v0.5.1).
but then no output was shown. No errors, no results. Just nothing. Then I tried it from the command line but with the same result. Using verbose output, I got the following:
$ rebar -vv eunit skip_deps=true apps=app1
DEBUG: Consult config file "/Users/myuser/Development/erlang/rootapp/rebar.config"
DEBUG: Rebar location: "/usr/local/bin/rebar"
DEBUG: Consult config file "/Users/myuser/Development/erlang/erlactive/src/rootapp.app.src"
DEBUG: Skipping app: rootapp
Resolution
So, it was somehow assuming that the rootapp (the one in ./src) should be run but it was not in the apps arguments and is skipping the whole test. I'm not sure about the reason for that but I know how to resolve it: Put the root app to the apps directory as well:
├── rel
├── apps
│ ├── rootapp
│ ├── app1
│ └── app2
└── rebar.config
Ans add it to sub_dirs
in rebar.config
:
{sub_dirs, ["apps/app1",
"apps/app2",
"apps/rootapp"]}.
I actually have a separate rebar.config
in each app dir so a can cd
into the apps directory and run rebar (tests) in it.