Skip to content

Conversation

azu
Copy link
Member

@azu azu commented Aug 12, 2025

Summary

  • Migrated from tsd to vitest for type testing to reduce tooling complexity
  • Followed vitest's type testing conventions
  • Ensured all existing type tests continue to pass

Changes

  • Updated type test file to use vitest's expectTypeOf API
  • Renamed test file from .type-test.ts to .test-d.ts (vitest convention)
  • Added vitest.config.ts for @secretlint/types package
  • Removed exclusion of type tests from root vitest config
  • Updated package.json to use vitest instead of tsd

Test plan

  • Ran pnpm test in @secretlint/types package - passes
  • Ran pnpm test --filter @secretlint/types from root - passes
  • Built the package successfully

Fixes #1168

🤖 Generated with Claude Code

Replace tsd with vitest for type checking to reduce tooling complexity.
- Update type test file to use vitest's expectTypeOf API
- Rename test file from .type-test.ts to .test-d.ts (vitest convention)
- Add vitest.config.ts for @secretlint/types package
- Remove exclusion of type tests from root vitest config
- Update package.json to use vitest instead of tsd

Fixes #1168

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@azu azu added the Type: Refactoring A code change that neither fixes a bug nor adds a feature label Aug 12, 2025
@azu azu marked this pull request as ready for review August 12, 2025 22:51
@azu azu merged commit 19812c7 into master Aug 12, 2025
16 checks passed
@azu azu deleted the 1168 branch August 12, 2025 22:54
test: {
typecheck: {
enabled: true,
include: ["test/**/*.test-d.ts"],
Copy link

@mrazauskas mrazauskas Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To draw your attention, current setup does not work. Try this:

Suggested change
include: ["test/**/*.test-d.ts"],
include: ["test/**/*.test-d.ts"],
tsconfig: "./tsconfig.test.json"

Or open the test file in IDE and you will see an error:

Image

Vitest does not see this problem, because of instead tsconfig.test.json it uses tsconfig.json that does not include the test files. In other words, it runs tsc --noEmit -p tsconfig.json instead of tsc --noEmit -p tsconfig.test.json.

The alarming part for me is that a test file name is actually included in the report of the test run.

@azu azu mentioned this pull request Aug 15, 2025
@github-actions github-actions bot mentioned this pull request Aug 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Refactoring A code change that neither fixes a bug nor adds a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tsd to vitest
2 participants