add-test-tsconfig-project: Add a dedicated tsconfig for typechecking tests without emitting #4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "task/add-test-tsconfig-project"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Assigned idea
The root tsconfig excludes the tests directory while only including src and types, which prevents running
tscover tests for type safety. Add atsconfig.test.jsonthat extends the existing config but re-includestests/**/*.tsand setsnoEmitto enable deterministic test typechecking without affecting the build output.Approach: 1) Add a new
tsconfig.test.jsonthatextends./tsconfig.json.2) Override
compilerOptionswithnoEmit: true(and optionallydeclaration: false,sourceMap: falsefor clarity).3) Override
excludeto removetestsfrom the excluded set (keepnode_modulesanddistexcluded).4) Set
includeto coversrc/**/*.ts,types/**/*.d.ts, andtests/**/*.tsso tests participate in typechecking while the main build config continues to exclude them from emitted artifacts.Verification: Run
npx tsc -p tsconfig.jsonto ensure the build config still compiles and emits todist/. Then runnpx tsc -p tsconfig.test.json --noEmitto confirm tests (and src/types) typecheck successfully without producing output.Risk: Low risk: adds a new configuration file without changing the existing build config behavior. Potential minor risk is confusion if tooling assumes only a single tsconfig; mitigate by keeping the existing
tsconfig.jsonunchanged and naming the new file explicitly for tests.Agent context
Task slug: add-test-tsconfig-project
Branch: task/add-test-tsconfig-project
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.