Skip to content

chore(tests): add Vitest unit tests and coverage - #1331

Merged
ghiscoding merged 6 commits into
masterfrom
feat/vitest
Nov 2, 2026
Merged

ghiscoding merged 6 commits into
masterfrom
feat/vitest

Conversation

@ghiscoding

@ghiscoding ghiscoding commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Add Vitest unit testing and coverage reporting to the project. It also removes the super old tests that were tested via Qunit from jQuery I think, we never ran them anyway.

Why

Provide unit test coverage for plugin behavior and run unit tests independently from the longer Cypress suite.

Changes

  • Configure Vitest with a jsdom environment.
  • Add unit tests for AutoTooltips and CellExternalCopyManager.
  • Add a separate CI job to run unit tests and upload coverage to Codecov.
  • Ignore coverage output in Git and npm packages.
  • drop legacy tests\ folder that required Qunit

Validation

  • npm run test
  • npm run build --workspace=vite-demo

Comments

None.

AI / LLM assistance

  • AI / LLM assistance used:
    • No
    • Yes
  • If Yes:
    • which tool/model: OpenAI ChatGPT 6.1 Luna
    • how was it used: Assisted with Vitest configuration, unit test porting, and CI setup.

Checklist

  • The changes are limited to only one scope (testing infrastructure).
  • Tests were added or updated where appropriate.
  • Documentation was updated where appropriate.

@ghiscoding
ghiscoding marked this pull request as draft October 30, 2026 20:10
@ghiscoding ghiscoding changed the title chore(tests): add Vitest unit tests chore(tests): add Vitest unit tests and coverage Oct 30, 2026
@ghiscoding
ghiscoding marked this pull request as ready for review October 31, 2026 00:37
@ghiscoding

ghiscoding commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator Author

@6pac hi there, I copied a few of my unit tests (using Vitest) into the project with help from AI of course...

Another thing you could do is to register on Codecov at https://app.codecov.io/login it's free for Open Source project and this will allow you to show a badge of unit test coverage (%) and show it on the readme page. The other advantage is that you can see exactly the coverage on a website. Note that Codecov is totally optional, the PR works already and it shows coverage inside the CI workflow. Current coverage is 82.61% which is pretty good already and we should be able to reach 100% easily

I'll let you merge the PR if you're interested in unit tests, which is probably better than Cypress quirks tests that Claude added.

@ghiscoding
ghiscoding requested a review from 6pac October 31, 2026 01:10
@6pac

6pac commented Nov 1, 2026

Copy link
Copy Markdown
Owner

More test are always good! I've been looking into testing framwworks lately because the AI tool are so Test-driven (TDD). Have added CodeCov as per instructions, I guess we'll see if I got it right next PR!

@ghiscoding

ghiscoding commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator Author

@6pac the next step is to add the CODECOV_TOKEN into the project setting, the 2 steps below, have you done that too? If so, I can uncomment codecov in the CI workflow. A few years ago it used to be Jest that was popular but now it's Vitest which is equivalent but for ESM and created by the Vite team, it's the most popular now

I guess you did the steps because we received the "Welcome to Codecov" after I uncommented codecov upload in CI... if so go ahead and merge, we should see the Codecov badge of coverage % on readme page

@codecov-commenter

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@6pac

6pac commented Nov 2, 2026

Copy link
Copy Markdown
Owner

@ghiscoding yes, I followed all the instructions on the CodeCov site, added the secret value and actually even added the line to the CI yaml file. Hence my comment about seeing if I got it right in the next release.

@ghiscoding
ghiscoding merged commit 79c3bcf into master Nov 2, 2026
6 checks passed
@ghiscoding
ghiscoding deleted the feat/vitest branch November 2, 2026 04:50
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.

3 participants