Migrate from Karma/Chai/Mocha to Vitest with Playwright browser mode #40
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR modernizes the testing infrastructure by migrating from Karma/Chai/Mocha to Vitest with Playwright browser mode, and updates the CI workflows to use Node.js 24 by default with Node.js 22 in the test matrix.
Changes
Testing Framework Migration
karma,karma-chai,karma-chrome-launcher,karma-mocha,karma-mocha-reporter,mocha,chai, andchromiumvitest@^3.2.4,@vitest/browser, and@playwright/testTest Updates
assert()→expect().toBe(true)assert.equal()→expect().toBe()assert.deepEqual()→expect().toEqual()assert.fail()→expect.fail()assert.isOk()→ Removed or simplifieddescribe,it, andexpectfromvitestdist/files as beforeConfiguration
vitest.config.jswith Playwright browser configurationstart-test-server.jsto manage the WebSocket test servertest/.eslintrc.jsonto remove Mocha environment and globalspretestbuild script since tests still use compiled dist filesCI/CD Updates
.github/workflows/nodejs.ymlto use Node.js 24 by default with a matrix including Node.js 22.github/workflows/publish.ymlto use Node.js 24actions/checkout@v4andactions/setup-node@v4Browser Installation
Created
install-browsers.shscript for installing Playwright browsers in environments where they're needed. The script downloads and installs Chromium and Chromium Headless Shell to~/.cache/ms-playwright/.Testing
All 20 tests pass successfully:
The migration maintains the same test coverage while providing a more modern and maintainable testing infrastructure with faster execution and better developer experience.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
esm.ubuntu.com/usr/lib/apt/methods/https(dns block)www.googleapis.comnode install.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.