add-test-tsconfig-project: Add a dedicated tsconfig for typechecking tests without emitting #4

Open
std-bot wants to merge 1 commit from task/add-test-tsconfig-project into main
First-time contributor

Assigned idea

The root tsconfig excludes the tests directory while only including src and types, which prevents running tsc over tests for type safety. Add a tsconfig.test.json that extends the existing config but re-includes tests/**/*.ts and sets noEmit to enable deterministic test typechecking without affecting the build output.

Approach: 1) Add a new tsconfig.test.json that extends ./tsconfig.json.
2) Override compilerOptions with noEmit: true (and optionally declaration: false, sourceMap: false for clarity).
3) Override exclude to remove tests from the excluded set (keep node_modules and dist excluded).
4) Set include to cover src/**/*.ts, types/**/*.d.ts, and tests/**/*.ts so tests participate in typechecking while the main build config continues to exclude them from emitted artifacts.

Verification: Run npx tsc -p tsconfig.json to ensure the build config still compiles and emits to dist/. Then run npx tsc -p tsconfig.test.json --noEmit to 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.json unchanged and naming the new file explicitly for tests.

Agent context

Task slug: add-test-tsconfig-project
Branch: task/add-test-tsconfig-project

## Assigned idea The root tsconfig excludes the tests directory while only including src and types, which prevents running `tsc` over tests for type safety. Add a `tsconfig.test.json` that extends the existing config but re-includes `tests/**/*.ts` and sets `noEmit` to enable deterministic test typechecking without affecting the build output. Approach: 1) Add a new `tsconfig.test.json` that `extends` `./tsconfig.json`. 2) Override `compilerOptions` with `noEmit: true` (and optionally `declaration: false`, `sourceMap: false` for clarity). 3) Override `exclude` to remove `tests` from the excluded set (keep `node_modules` and `dist` excluded). 4) Set `include` to cover `src/**/*.ts`, `types/**/*.d.ts`, and `tests/**/*.ts` so tests participate in typechecking while the main build config continues to exclude them from emitted artifacts. Verification: Run `npx tsc -p tsconfig.json` to ensure the build config still compiles and emits to `dist/`. Then run `npx tsc -p tsconfig.test.json --noEmit` to 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.json` unchanged and naming the new file explicitly for tests. ## Agent context Task slug: add-test-tsconfig-project Branch: task/add-test-tsconfig-project <!-- std-ts:idea-pr-body -->
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin task/add-test-tsconfig-project:task/add-test-tsconfig-project
git switch task/add-test-tsconfig-project

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.

git switch main
git merge --no-ff task/add-test-tsconfig-project
git switch task/add-test-tsconfig-project
git rebase main
git switch main
git merge --ff-only task/add-test-tsconfig-project
git switch task/add-test-tsconfig-project
git rebase main
git switch main
git merge --no-ff task/add-test-tsconfig-project
git switch main
git merge --squash task/add-test-tsconfig-project
git switch main
git merge --ff-only task/add-test-tsconfig-project
git switch main
git merge task/add-test-tsconfig-project
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
snorkel/root-repository-maintenance-8ac8ec1620d541!4
No description provided.