-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Labels
Description
Each test target - unit-test, int-test, e2e-test - should be invalidated whenever the tested code changes, or the tests themselves change. Currently, the cache isn't being invalidated when fixtures change - i.e. files which aren't imported in code, but are read from file system with node:fs module (usually copied to a temporary test folder in beforeEach/beforeAll).
Because of this, we run the risk of merging broken tests, which will be hard to track down.
Steps to reproduce
- Run
npx nx int-test plugin-eslint. Tests will pass and Nx will save cache. - Change any file under
packages/plugin-eslint/mocks/fixturesin a way that should break some test (e.g. deletenx-monorepo/nx.json). - Re-run
npx nx int-test plugin-eslint. Tests will pass instantly, Nx logs that cache was used. - Run
npx nx int-test plugin-eslint --skipNxCache. Observe that tests fail.
This is repeatable for any other type of test that relies on file system - i.e. some integration tests, most E2E tests.
Proposed solution
See discussion, mainly this comment
Acceptance criteria
- Any change to files under
{projectRoot}should invalidate test targets in Nx cache.