When a file is changed files dependent on that file are marked for recompile. This doesn't seem to work when the changed file is not in the directory which is passed to build and the directory where dependent namespace is.
Looks like this caused by how build and compile-file work:
- Build calls -compile -> compile-dir -> compile-root which sorts the files in dependency order and calls -compile for the files in dependency order
- core ns is compiled
- Build calls add-depedencies -> add-dependencies -> get-compiled-cljs -> -compile -> compile-file
- test ns is compiled, core ns is marked as dependent on test ns but as core ns is already compiled this doesn't matter
I believe this effectively breaks :recompile-dependents in cases all cases but one where all the sources are inside one directory. In multiple directory case order of directories passed to cljs.build.api/inputs affects the order on which compile is called so it's possible that some dependent namespaces are compiled before namespaces they depend on are compiled.
Original problem was that added tests were not picked up by run-tests but I have since reproduced this without cljs.test.
The minimal way to reproduce this needs two namespaces, where one depends on another. To display that the dependent namespace is not recompiled, it will print some compile time metadata from the another namespace.
To trigger the problem, the metadata needs to be changed after running the build once. Changing test ns doesn't cause core ns to recompiled and changing the metadata doesn't have any effect to println on core ns.