-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Labels
Description
Introduce test-vitest-setup project to handle test setup for vite tests
PR1
- Introduce project
test-vitest-setupunder thetestingfolder and add configuration. Copy the example linked below and add potential improvements.- adjust
coverage.reportDirectoryto be at project root (packages/<name>/.coverage) - add unit tests
- use existing types see this comment
- add minimal docs to the
test-vitest-setupproject on how to use
- adjust
Example implementation:
PR1.2
- Extend
vitest.{targetName}.config.tsfromtest-vitest-setupconfiguration. (consider the changedreportDirectorymay be a breaking change for the CI pipeline)- unit tests
- int tests
- e2e tests
PR2.x - Cleanup and cosmetic cahnges
Preconditions: #1142
Mocks folder
- Rename
nx-plugin/mocktomodels/mocks - Rename
examples/plugins/src/lighthouse/mocktoexamples/plugins/src/lighthouse/mocks - After all folders are renamed to
mocksadjust inputs innx.json"!{projectRoot}/@(test|mocks|mock)/**/*""!{projectRoot}/**/?(*.)mock.[jt]s?(x)"
Mocks creation
- unify test folder setup and document it. Use the creation from static files instead of generator
- e2e/ci-e2e/setup.ts#setupTestReop
- e2e/ci-e2e/test-folder-setup.ts#restoreNxIgnoredFiles
Test Coverage
- improve test coverage config to exclude as much noise as possible and increase coverage
src/lib/index.ts- exclude files that only maintain exports e.g.index.ts(in some places index.ts files also contain actual logic. here I would suggest we discuss per case if we can refactor to have allindex.tsused for barrel export only)- exclude other files that are not relevant for test coverage
Caching
- Move
zod2md.tsunder{projectRoot}/toolsand make sure"!{projectRoot}/tools/**/*"is added undernx.json#namedInputs.production - To verify: We might have a caching issue with models build.
To Verify
- remove vitest executor defaults from
nx.jsonTBD
"@nx/vite:test": {
"cache": true,
"inputs": ["default", "test-vitest-inputs"],
"options": {
"passWithNoTests": true,
"watch": false
}
},