Update:
We have to re-evaluate the issue after #1142 is merged
What happened?
If I change something in a testing lib the packages using them over setupFiles or globalSetup in vitest.config.ts have a false cache hit.
The problem:
Project models als all other projects miss the dependencies to testing files referenced in vitest.config.ts.
What would you expect to happen?
If I change something in a testing lib the packages using them over setupFiles or globalSetup in vitest.config.ts do not have a cache hit.
Possible Solutions:
- add
implicitDependencies to all relevant testing targets - quick but not fine-grained also the biggest downside is our build and any other target in the project would be affected. ⚠️
- add the used files from
vitest.config.ts as target inputs/namedInputs - fine-grained but only maintainable over custom plugin that adds the inputs. But as the used filse in setupFiles or globalSetup change it has to be dynamically detected.
- create a config project handling the setupFiles and is directly depending on
testing-setup (best)
What steps did you take?
- ✅ Test the project
modles in packages/models and verify cache hit
# [existing outputs match the cache, left as is] <= ✅ this is correct. It should have a cache hit
nx run models:unit-test
- ✅ Apply any code change in the project
testing-setup in folder testing/setup and save the change to your filesystem
- ❌ Test the project
modles in packages/models and verify NO cache hit - nx unit-test models
# [existing outputs match the cache, left as is] <= ❌ this is not correct. It should not have a cache hit
nx run models:unit-test
Code PushUp package version
No response
What operation system are you on?
MacOS
Node version
24
Relevant log output
Related information
Update:
We have to re-evaluate the issue after #1142 is merged
What happened?
If I change something in a testing lib the packages using them over
setupFilesorglobalSetupinvitest.config.tshave a false cache hit.The problem:
Project
modelsals all other projects miss the dependencies to testing files referenced invitest.config.ts.What would you expect to happen?
If I change something in a testing lib the packages using them over
setupFilesorglobalSetupinvitest.config.tsdo not have a cache hit.Possible Solutions:
implicitDependenciesto all relevant testing targets - quick but not fine-grained also the biggest downside is our build and any other target in the project would be affected.vitest.config.tsas targetinputs/namedInputs- fine-grained but only maintainable over custom plugin that adds the inputs. But as the used filse insetupFilesorglobalSetupchange it has to be dynamically detected.testing-setup(best)test-vitest-setupproject to handle test setup for vite tests #1065What steps did you take?
modlesinpackages/modelsand verify cache hit# [existing outputs match the cache, left as is] <= ✅ this is correct. It should have a cache hit nx run models:unit-testtesting-setupin foldertesting/setupand save the change to your filesystemmodlesinpackages/modelsand verify NO cache hit -nx unit-test models# [existing outputs match the cache, left as is] <= ❌ this is not correct. It should not have a cache hit nx run models:unit-testCode PushUp package version
No response
What operation system are you on?
MacOS
Node version
24
Relevant log output
Related information