Skip to content

test: enable typecheck for all spec files, not only types/* suites#5173

Open
rainerhahnekamp wants to merge 14 commits into
mainfrom
feat/vitest-typecheck-all-specs
Open

test: enable typecheck for all spec files, not only types/* suites#5173
rainerhahnekamp wants to merge 14 commits into
mainfrom
feat/vitest-typecheck-all-specs

Conversation

@rainerhahnekamp

Copy link
Copy Markdown
Contributor

Enable type-tests everywhere

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[x] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Closes #5172

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[x] No

@rainerhahnekamp rainerhahnekamp changed the title feat(vitest): enable typecheck for all spec files, not only types/ su… feat(ci): enable typecheck for all spec files, not only types/ su… Jun 17, 2026
@rainerhahnekamp rainerhahnekamp force-pushed the feat/vitest-typecheck-all-specs branch from ffa818c to c115594 Compare June 20, 2026 14:46
rainerhahnekamp and others added 11 commits July 2, 2026 01:01
Ensures Nx invalidates the test cache for all projects when the shared
root vitest.config.mts changes.

Closes #5172

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Projects that restrict test.include to a subfolder (effects, entity,
schematics) now also restrict typecheck.include to the same pattern,
so only files that are executed at runtime are also type-checked.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…, schematics

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ec files

- effects: cast MockInstance via unknown, fix Observable<string> effect
  return type, replace removed scheduler from RunHelpers with testScheduler
- store: use MockInstance type for vi.spyOn results, replace fail() with throw
- store-devtools: add non-null assertion on mock.lastCall
- router-store: replace fail() with throw
- component-store: add void type argument to Promise
- signals: cast union DeepSignal to any, cast Signal<unknown> to WritableSignal
- operators: fix vi.fn generic to match observable item type
- eslint-plugin: add readonly to valid/invalid array return types

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… tests

The type annotations on valid/invalid functions caused mismatches between
the local Options type and the readonly tuple RuleTester.run() expects.
Removing them lets TypeScript infer the return types directly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…constraint

RuleTester.run() expects readonly arrays; cast valid/invalid arrays
at call sites to avoid the mutable-to-readonly assignability error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The rule test files (valid/invalid arrays) have a structural type
incompatibility with RuleTester.run()'s readonly constraints that
requires a broader refactor. Limit typecheck to spec/types/ for now
and track the proper fix separately.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mergeConfig merges arrays so include alone isn't sufficient to scope
typecheck; add an explicit exclude for spec/rules/ to prevent the
base typecheck.include pattern from picking them up.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
These files are excluded from typecheck so they should not have been
modified as part of this PR.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…bals

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@rainerhahnekamp rainerhahnekamp force-pushed the feat/vitest-typecheck-all-specs branch from 8d92e85 to 09136eb Compare July 1, 2026 23:03
Comment thread modules/eslint-plugin/spec/rules/operators/prefer-concat-latest-from.spec.ts Outdated
Comment thread modules/eslint-plugin/spec/rules/operators/prefer-concat-latest-from.spec.ts Outdated
Comment thread modules/store-devtools/spec/extension.spec.ts Outdated
Comment thread modules/signals/spec/deep-signal.spec.ts Outdated
@rainerhahnekamp

Copy link
Copy Markdown
Contributor Author

@markostanimirovic, all tests except two signal tests pass. Since signals package is new and there are some issues with the types, could you please take a look? Not that we discovered two bugs or so...

@rainerhahnekamp rainerhahnekamp marked this pull request as ready for review July 2, 2026 00:41
@markostanimirovic markostanimirovic changed the title feat(ci): enable typecheck for all spec files, not only types/ su… test: enable typecheck for all spec files, not only types/* suites Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(signals): enable vitest typecheck for all spec files, not just spec/ subfolder and test-d.ts

2 participants