I started working on a PR to add support for affected:test. It is getting a bit bigger than I expected and I might be over my head now. But what has happened is I have run into this:
Command failed: npm run affected:test -- --files="libs/mylib/index.ts"
Nx only supports running unit tests for all apps and libs.
You cannot use -a or --app.
Use fdescribe or fit to select a subset of tests to run.
child_process.js:615
throw err;
This leads me to believe the lack of support for this feature was intentional. Is that true? If so, why? We are building out a monorepo with several apps in it and we wanted to setup our CI process to only run the tests for the app affected by the commit. We already do this nicely for the e2e tests.
Should I just abandon this idea?
I pushed my WIP so you can see the direction I was going with this. It seemed like a simple change at first but then led me down a rabbit hole of small changes I had to make for the tests until finally running into the mentioned message that made me stop and rethink it entirely. I am assuming you left this feature out for a philosophical reason of some kind?
It's tricky to make this functionality work in CLI 1.x, which is what the current version of Nx is using.
It's easier to make it work with CLI6, which provides more extension points. We are currently working on changing Nx to use CLI6, which should fix this issue.
This functionality has been implemented in Nx 6.
Most helpful comment
I pushed my WIP so you can see the direction I was going with this. It seemed like a simple change at first but then led me down a rabbit hole of small changes I had to make for the tests until finally running into the mentioned message that made me stop and rethink it entirely. I am assuming you left this feature out for a philosophical reason of some kind?