How to exclude a specific folder within an Nx monorepo library during 'nx affected:test' command

174 views Asked by At

Problem:

I work in an Nx monorepo with multiple apps and libraries. One of my libraries (lib-b) has an assets folder that contains non-testable resources. When I make changes inside the assets folder and run npx nx affected:test, it triggers tests for all apps and libraries instead of recognizing that no code changes were made.

Project Structure:

 Monorepo
|  apps
| |  app A,B,C
|  libs
| |  lib-a
| |  lib-b
| | |  assets

.nxignore Configuration:

libs/lib-b/assets

Expected Behaviour:

When adding something to lib-b/assets and running npx nx affected:test should not launch any tests since no code changes occurred.

Actual Result:

Tests are executed for all apps and libraries.

Notes:

If I modify from libs/lib-b/assets to libs/lib-b, then no tests run as expected. Any guidance on how to properly configure .nxignore or suggestions to achieve the desired behavior would be greatly appreciated. Thanks in advance!

0

There are 0 answers