Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nx affected command doesn't ignore test files #30169

Open
1 of 4 tasks
AndreiRosu opened this issue Feb 25, 2025 · 0 comments
Open
1 of 4 tasks

Nx affected command doesn't ignore test files #30169

AndreiRosu opened this issue Feb 25, 2025 · 0 comments

Comments

@AndreiRosu
Copy link

AndreiRosu commented Feb 25, 2025

Current Behavior

After modifying only a .spec.ts file, the nx affected -t build command, returns the following:

 NX   Affected criteria defaulted to --base=main --head=HEAD

   ✔  nx run inventory:build:production  [local cache]
   ✔  nx run angular-monorepo:build:production  [local cache]

 NX   Successfully ran target build for 2 projects

Expected Behavior

No project should be affected (nx.json is configured to ignore .spec.ts files, as in: !{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)).

GitHub Repo

https://github.com/AndreiRosu/angular-monorepo

Steps to Reproduce

  1. Clone the default angular-monorepo repository from https://github.com/AndreiRosu/angular-monorepo (It is exactly the same as in tutorial: https://nx.dev/getting-started/tutorials/angular-monorepo-tutorial).
    Another option is to use it directly in stackblitz: https://stackblitz.com/~/github.com/AndreiRosu/angular-monorepo
  2. Modify libs/products/src/lib/products/products.component.spec.ts (Add a console.log in the test)
  3. Run command nx affected -t build

Nx Report

Node           : 21.7.3
OS             : darwin-arm64
Native Target  : aarch64-macos
npm            : 10.9.0

nx                     : 20.4.6
@nx/js                 : 20.4.6
@nx/jest               : 20.4.6
@nx/eslint             : 20.4.6
@nx/workspace          : 20.4.6
@nx/angular            : 20.4.6
@nx/devkit             : 20.4.6
@nx/eslint-plugin      : 20.4.6
@nx/module-federation  : 20.4.6
@nx/playwright         : 20.4.6
@nx/web                : 20.4.6
@nx/webpack            : 20.4.6
typescript             : 5.7.3
---------------------------------------
Registered Plugins:
@nx/playwright/plugin
@nx/eslint/plugin
---------------------------------------
Community plugins:
angular-eslint : 19.1.0

Failure Logs

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

Running nx show projects --affected --target=build returns a different result than nx affected -t build:

products
angular-monorepo
angular-monorepo-e2e
inventory
inventory-e2e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant