Skip to content

Move commented tests from resolveMdxUrl.ts to vitest#516

Merged
abernier merged 4 commits intomainfrom
copilot/move-complemented-tests-to-vitest
Jan 28, 2026
Merged

Move commented tests from resolveMdxUrl.ts to vitest#516
abernier merged 4 commits intomainfrom
copilot/move-complemented-tests-to-vitest

Conversation

Copy link
Contributor

Copilot AI commented Jan 28, 2026

Plan: Move Commented Tests to Vitest

  • Set up vitest infrastructure
    • Install vitest as devDependency
    • Create minimal vitest configuration file (vitest.config.ts)
    • Merge vitest into main test script
    • Configure vitest to exclude Playwright tests
  • Create test file for resolveMdxUrl
    • Create src/utils/resolveMdxUrl.test.ts
    • Convert all commented tests to proper vitest tests (20 tests)
    • Organize tests into logical groups (absolute paths, relative paths, edge cases, etc.)
  • Validate tests
    • Run vitest to ensure all tests pass (20/20 passing)
    • Remove commented tests from source file
  • Address review feedback
    • Removed unnecessary @vitest/ui package
    • Merged test:unit into test script
    • Simplified vitest.config.ts (removed defaults)
  • CI validation
    • Verified CI workflow with act (dry run successful)
    • Linting passed for changed files
  • Final validation
    • Code review completed - no issues
    • CodeQL security check passed - no vulnerabilities

Summary

Successfully moved all commented tests from resolveMdxUrl.ts to a proper vitest test suite. All 20 tests are passing. Addressed reviewer feedback to minimize dependencies and configuration.

Original prompt

On resolveMdxUrl.ts, https://github.com/pmndrs/docs/blob/main/src/utils/resolveMdxUrl.ts can you move the commented tests as vitest, so we effectively test this


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: abernier <76580+abernier@users.noreply.github.com>
Copy link
Member

@abernier abernier left a comment

Choose a reason for hiding this comment

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

package.json Outdated
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@types/sanitize-html": "^2.16.0",
"@vitest/ui": "^4.0.18",
Copy link
Member

Choose a reason for hiding this comment

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

@copilot why this package, necessary ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, it wasn't necessary. Removed in 5109941.

package.json Outdated
"release": "changeset publish",
"changeset": "changeset",
"test": "playwright test",
"test:unit": "vitest",
Copy link
Member

Choose a reason for hiding this comment

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

@copilot no ditectly into "test"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! Merged into the main "test" script in 5109941. Now runs vitest && playwright test.

Copilot AI changed the title [WIP] Move commented tests to Vitest for effective testing Move commented tests from resolveMdxUrl.ts to vitest Jan 28, 2026
Copilot AI requested a review from abernier January 28, 2026 13:40
…lify config

Co-authored-by: abernier <76580+abernier@users.noreply.github.com>
@abernier abernier marked this pull request as ready for review January 28, 2026 18:26
@abernier abernier merged commit 7d2b549 into main Jan 28, 2026
9 checks passed
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.

2 participants