Conversation
|
PS: Aware of the CI failure, will follow up (just getting it out first for visibility) |
There was a problem hiding this comment.
Pull request overview
This PR migrates the project’s test runner from Mocha/Chai/Sinon + NYC to Vitest, aiming for faster test execution, simpler dependencies, and built-in coverage via V8.
Changes:
- Add Vitest configuration (globals, timeouts, coverage settings) and switch
npm test/npm run coverageto Vitest. - Update unit/integration tests to use Vitest/Jest-style matchers and
vimocks instead of Chai/Sinon. - Remove Mocha/NYC configuration files and update some regression/example package lockfiles accordingly.
Reviewed changes
Copilot reviewed 32 out of 44 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
vitest.config.ts |
Introduces Vitest runner + coverage configuration. |
src/xml/xmlElement.spec.ts |
Replaces Chai assertions with Vitest matchers. |
src/v4/http/responseWithPluginBuilder.spec.ts |
Replaces Sinon stubs with vi.fn() and Vitest mock assertions. |
src/v4/http/responseBuilder.spec.ts |
Migrates builder tests to vi mocks + Vitest assertions. |
src/v4/http/requestWithPluginBuilder.spec.ts |
Migrates request plugin builder tests to Vitest. |
src/v4/http/requestBuilder.spec.ts |
Migrates request builder tests to Vitest. |
src/v4/http/index.spec.ts |
Migrates V4 HTTP executeTest specs; switches stubs to vi.fn(). |
src/v3/pact.spec.ts |
Migrates PactV3 executeTest specs to Vitest mocks/assertions. |
src/v3/matchers.spec.ts |
Migrates matcher specs to Vitest toEqual/toThrow assertions. |
src/v3/ffi.spec.ts |
Migrates FFI spec assertions to Vitest matchers. |
src/pact.integration.spec.ts |
Migrates integration spec assertions away from Chai. |
src/messageProviderPact.spec.ts |
Migrates MessageProvider tests from chai-as-promised to async/await + Vitest assertions. |
src/messageConsumerPact.spec.ts |
Migrates MessageConsumer tests to async/await + Vitest assertions. |
src/httpPact/index.spec.ts |
Migrates HTTP Pact tests to Vitest and vi.fn() call assertions. |
src/httpPact/ffi.spec.ts |
Migrates HTTP FFI tests to Vitest and vi.fn() call assertions. |
src/dsl/verifier/verifier.spec.ts |
Replaces proxyquire/sinon with vi.mock and vi.spyOn patterns. |
src/dsl/verifier/proxy/stateHandler/stateHandler.spec.ts |
Migrates state handler proxy tests to Vitest spies/assertions. |
src/dsl/verifier/proxy/stateHandler/setupStates.spec.ts |
Migrates setupStates tests to Vitest spies/assertions. |
src/dsl/verifier/proxy/proxyRequest.spec.ts |
Migrates proxy request tests to Vitest matchers. |
src/dsl/verifier/proxy/proxy.spec.ts |
Migrates waitForServerReady tests to async/await + Vitest assertions. |
src/dsl/verifier/proxy/parseBody.spec.ts |
Migrates parseBody tests to Vitest matchers. |
src/dsl/verifier/proxy/hooks.spec.ts |
Migrates hook tests from sinon stubs to vi.fn() and Vitest assertions. |
src/dsl/matchers.spec.ts |
Migrates DSL matcher tests from Chai to Vitest matchers. |
src/dsl/interaction.spec.ts |
Migrates interaction tests to Vitest matchers and removes chai-as-promised. |
src/dsl/graphql.spec.ts |
Migrates GraphQL interaction tests to Vitest assertions. |
src/dsl/apolloGraphql.spec.ts |
Migrates Apollo GraphQL interaction tests to Vitest assertions. |
src/common/request.spec.ts |
Migrates request tests to async/await and Vitest assertions. |
src/common/net.spec.ts |
Migrates network/port availability tests to async/await and Vitest assertions. |
package.json |
Switches scripts/deps from Mocha/NYC to Vitest + V8 coverage. |
regression/v2/serverless/package.json |
Updates the local file dependency path for @pact-foundation/pact. |
regression/v2/serverless/package-lock.json |
Lockfile updates reflecting dependency + toolchain changes. |
examples/messages/package-lock.json |
Lockfile updates reflecting Vitest toolchain changes. |
.nycrc |
Removes NYC configuration (coverage handled by Vitest). |
.mocharc.json |
Removes Mocha configuration (runner replaced by Vitest). |
Files not reviewed (1)
- regression/v2/serverless/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cd901a5 to
c94b556
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1789 +/- ##
=========================================
Coverage ? 60.60%
=========================================
Files ? 67
Lines ? 4132
Branches ? 350
=========================================
Hits ? 2504
Misses ? 1626
Partials ? 2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
bb26941 to
8a2cff3
Compare
Replace mocha with vitest for faster test running, and native TS support. Also reduce the number of dependencies by switching to vitest's own assertion library. Signed-off-by: JP-Ellis <josh@jpellis.me>
Signed-off-by: JP-Ellis <josh@jpellis.me>
Not sure why this wasn't covered in CI before Signed-off-by: JP-Ellis <josh@jpellis.me>
8a2cff3 to
88bb951
Compare
In particular, consolidate the x86 and ARM tests into one job now that we have ARM runners available. Signed-off-by: JP-Ellis <josh@jpellis.me>
Helps with cross-platform support, in case `bash` is not available or easily invoked (e.g., CI in Windows running in pwsh). Signed-off-by: JP-Ellis <josh@jpellis.me>
Signed-off-by: JP-Ellis <josh@jpellis.me>
f5c137e to
0152e4e
Compare
Replace mocha with vitest for faster test running, and native TS support. Also reduce the number of dependencies by switching to vitest's own assertion library.