Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Convert test framework from Mocha/Chai to Vitest and update CI workflows#35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
Copilot wants to merge4 commits intomain
base:main
Choose a base branch
Loading
fromcopilot/convert-tests-to-vitest

Conversation

Copilot
Copy link

@CopilotCopilotAI commentedOct 7, 2025
edited
Loading

This PR modernizes the testing infrastructure by migrating from Mocha/Chai to Vitest v3.2.4, and updates GitHub Actions workflows to use the latest Node.js versions.

Test Framework Migration

Removed dependencies:

  • mocha,chai,chai-spies,ts-node and related@types packages

Added:

  • vitest@^3.2.4 with proper TypeScript support

Test files updated:
All test files (test/index.ts,test/decorator.ts) have been converted from Chai assertions to Vitest:

// Before (Chai)importchaifrom'chai'importspiesfrom'chai-spies'const{expect, spy}=chaiconstfn=spy(incr(1))expect([result]).to.eql([1,1,1,1])expect(fn).to.have.been.called.exactly(1)// After (Vitest)import{describe,it,expect,vi}from'vitest'constfn=vi.fn(incr(1))expect([result]).toEqual([1,1,1,1])expect(fn).toHaveBeenCalledTimes(1)

Configuration changes:

  • Createdvitest.config.ts for Vitest configuration
  • Updated test script fromnode --loader ts-node/esm.mjs node_modules/mocha/lib/cli/cli.js tovitest run
  • Removed mocha configuration section frompackage.json
  • Vitest runs TypeScript directly without needing a separate build step

Dependency Updates

  • Updatedtypescript from^4.6.4 to^5.9.3 for better compatibility
  • Updated@types/node from^14.0.19 to^22.18.8 to match Node.js 24 requirements
  • AddedskipLibCheck: true totsconfig.json to handle type definitions in node_modules

GitHub Actions Workflows

nodejs.yml:

  • Updated to use Node.js 24
  • Addednpx playwright install chromium step before running tests

publish.yml:

  • Updated default Node.js version from 22 to 24
  • Addednpx playwright install chromium step before running tests

Both workflows already used the latest versions ofactions/checkout@v4 andactions/setup-node@v4.

Validation

All existing tests pass successfully:

  • ✅ 11 tests across 2 test files
  • ✅ Lint passes without errors
  • ✅ Build completes successfully (ESM + CJS outputs)
  • ✅ No breaking changes to the public API
Original prompt

This package currently uses chai and mocha to run tests. Convert it to use Vitest. Install vitest version^3.2.4. Update test files to import describe/it/etc from vitest and use assertion helpers from vitest. Remove thepretest build script since vitest can run TypeScript directly. Run the tests withnpm test and verify they pass. Remove all references to karma/chai/mocha.

Also update all github workflows to run with Node 24 by default, and include Node 22 in matrix runs (only if matrix is already configured, don't add it). Drop older versions. Update actions to use the latest version ofactions/setup-node andactions/checkout. Add a step before running tests in CI which runsnpx playwright install chromium.

Ensure lint and tests both pass. Remove any references to karma/mocha/chai from the lint config.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Clickhere to start the survey.

CopilotAIand others added2 commitsOctober 7, 2025 20:19
Co-authored-by: dgreif <3026298+dgreif@users.noreply.github.com>
Co-authored-by: dgreif <3026298+dgreif@users.noreply.github.com>
@CopilotCopilotAI changed the title[WIP] Update testing framework to use Vitest and remove deprecated packagesConvert test framework from Mocha/Chai to Vitest and update CI workflowsOct 7, 2025
@CopilotCopilotAI requested a review fromdgreifOctober 7, 2025 20:28
Copilot finished work on behalf ofdgreifOctober 7, 2025 20:28
Co-authored-by: dgreif <3026298+dgreif@users.noreply.github.com>
@CopilotCopilotAI requested a review fromdgreifOctober 8, 2025 02:31
Copilot finished work on behalf ofdgreifOctober 8, 2025 02:31
@dgreifdgreif marked this pull request as ready for reviewOctober 8, 2025 02:31
@dgreifdgreif requested a review froma team as acode ownerOctober 8, 2025 02:31
@CopilotCopilotAI review requested due to automatic review settingsOctober 8, 2025 02:31
Copy link

@CopilotCopilotAI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates the testing infrastructure from Mocha/Chai to Vitest v3.2.4 and updates CI workflows to use Node.js 24.

  • Replaces Mocha/Chai test framework with Vitest for modern TypeScript testing
  • Updates Node.js version to 24 in GitHub Actions workflows
  • Removes outdated dependencies and configurations while adding Playwright support

Reviewed Changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
FileDescription
vitest.config.tsAdds Vitest configuration for TypeScript test execution
test/index.tsConverts Chai assertions to Vitest syntax and spy functions
test/decorator.tsUpdates test assertions from Chai to Vitest format
package.jsonRemoves Mocha/Chai dependencies, adds Vitest, updates TypeScript and Node types
.github/workflows/publish.ymlUpdates Node.js to v24 and adds Playwright installation
.github/workflows/nodejs.ymlUpdates Node.js to v24 and adds Playwright installation

Tip: Customize your code reviews with copilot-instructions.md.Create the file orlearn how to get started.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

Copilot code reviewCopilotCopilot left review comments

@dgreifdgreifAwaiting requested review from dgreif

At least 1 approving review is required to merge this pull request.

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@Copilot@dgreif

[8]ページ先頭

©2009-2025 Movatter.jp