Skip to content

GLSP-1635: Migrate test stack to Vitest - #1705

Merged
tortmayr merged 2 commits into
masterfrom
GLSP-1635-vitest-migration
Jun 22, 2026
Merged

GLSP-1635: Migrate test stack to Vitest#1705
tortmayr merged 2 commits into
masterfrom
GLSP-1635-vitest-migration

Conversation

@tortmayr

@tortmayr tortmayr commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

What it does

Migrates the shared test stack from Mocha/nyc/chai/sinon to Vitest.

  • Replace the Mocha/nyc/chai/sinon stack with Vitest and its v8 coverage
    provider across the monorepo
  • Add the @eclipse-glsp/vitest-config package providing a ready-to-use
    shared flat config (explicit test API imports, mock auto-restore, v8
    coverage, per-file DOM opt-in, CI annotations), mirroring the sprotty
    test setup; drop the now-obsolete mocha-config and nyc-config packages
  • Rework the config-test meta package to bundle the Vitest config and
    test dependencies in place of Mocha and nyc
  • Port all CLI specs to the Vitest API (chai expect, sinon sandboxes/stubs
    → vitest expect/vi) and add vite.config.ts / vite.config.e2e.ts
  • Update CLI and root scripts/dependencies accordingly and drop the bespoke
    coverage-report command in favor of vitest --coverage

Also:

  • Switch the CI test workflow to Vitest

Part of: #1635

How to test

  • Covered by CI workflows
  • If you want to test locally
pnpm install
pnpm build
pnpm test       # unit specs via vitest run
pnpm test:e2e   # e2e specs via vitest run --config vite.config.e2e.ts
  • Verified locally via pnpm test

Follow-ups

Consuming GLSP repos (glsp-client, glsp-server-node, etc.) need to migrate
their own test setup to @eclipse-glsp/vitest-config separately.

Changelog

  • This PR should be mentioned in the changelog
  • This PR introduces a breaking change (if yes, provide more details below for the changelog and the migration guide)

- Replace the Mocha/nyc/chai/sinon stack with Vitest and its v8
  coverage provider across the monorepo
- Add the @eclipse-glsp/vitest-config package providing a ready-to-use
  shared flat config; drop the now-obsolete mocha-config and
  nyc-config packages
- Rework the config-test meta package to bundle the Vitest config and
  test dependencies in place of Mocha and nyc
- Port all CLI specs to the Vitest API (chai expect, sinon sandboxes/
  stubs → vitest expect/vi) and add vite.config.ts/vite.config.e2e.ts
- Update CLI and root scripts/dependencies accordingly and drop the
  bespoke coverage-report command in favor of vitest --coverage

Also:
- Switch the CI test workflow to Vitest

Part of: #1635

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Migrates the monorepo’s shared test tooling from the Mocha/nyc/chai/sinon stack to Vitest, introducing a reusable @eclipse-glsp/vitest-config package and updating CLI tests/configuration and CI accordingly.

Changes:

  • Replace Mocha/nyc-based test + coverage setup with Vitest + @vitest/coverage-v8, including new shared Vitest flat config.
  • Update CLI unit/e2e tests from chai/sinon to Vitest APIs and add vite.config.ts / vite.config.e2e.ts.
  • Remove obsolete Mocha/nyc config packages and adjust workspace hoisting/scripts and the GitHub Actions test workflow.

Reviewed changes

Copilot reviewed 62 out of 65 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tsconfig.eslint.json Extend ESLint TS coverage to include vite.config*.ts files.
pnpm-workspace.yaml Update workspace hoisting patterns and add peer-install setting; keep security overrides.
package.json Simplify root devDependencies and align root test scripts with Vitest-based CLI tests.
dev-packages/vitest-config/README.md New documentation for the shared Vitest config package.
dev-packages/vitest-config/package.json Define the new @eclipse-glsp/vitest-config package metadata/exports/peers.
dev-packages/vitest-config/LICENSE Add license file for the new package.
dev-packages/vitest-config/index.js Implement the shared Vitest config (restoreMocks, include globs, v8 coverage, CI reporter).
dev-packages/vitest-config/index.d.ts Provide types for the shared Vitest config package exports.
dev-packages/ts-config/tsconfig.json Remove reflect-metadata from default types.
dev-packages/ts-config/package.json Stop publishing the removed Mocha-specific tsconfig variant.
dev-packages/ts-config/mocha.json Remove Mocha-specific tsconfig variant.
dev-packages/nyc-config/README.md Remove obsolete nyc shared config documentation.
dev-packages/nyc-config/package.json Remove obsolete nyc shared config package.
dev-packages/nyc-config/LICENSE Remove obsolete nyc shared config license file.
dev-packages/nyc-config/index.json Remove obsolete nyc shared config payload.
dev-packages/mocha-config/README.md Remove obsolete Mocha shared config documentation.
dev-packages/mocha-config/.mocharc.json Remove obsolete Mocha shared config payload.
dev-packages/config/package.json Drop reflect-metadata from shared dev config dependencies.
dev-packages/config-test/README.md Update meta test package docs to reference Vitest config usage.
dev-packages/config-test/package.json Switch meta test package deps from Mocha/nyc/chai/sinon to Vitest + coverage-v8 + vitest-config.
dev-packages/cli/vite.config.ts Add repo-root Vitest config entrypoint for CLI unit tests.
dev-packages/cli/vite.config.e2e.ts Add CLI e2e Vitest config with extended timeouts and different include globs.
dev-packages/cli/tsconfig.json Switch CLI TS config base from removed Mocha variant to the shared base config.
dev-packages/cli/tests/e2e/update-next.e2e.spec.ts Port e2e test to Vitest imports.
dev-packages/cli/tests/e2e/repo/repo-vscode.e2e.spec.ts Port e2e test to Vitest lifecycle APIs.
dev-packages/cli/tests/e2e/repo/repo-theia.e2e.spec.ts Port e2e test to Vitest lifecycle APIs.
dev-packages/cli/tests/e2e/repo/repo-eclipse.e2e.spec.ts Port e2e test to Vitest and use conditional skipping via skipIf.
dev-packages/cli/tests/e2e/repo/repo-core-clone.e2e.spec.ts Port e2e test to Vitest and use it.skipIf.
dev-packages/cli/tests/e2e/repo/repo-core-build.e2e.spec.ts Port e2e test to Vitest lifecycle APIs.
dev-packages/cli/tests/e2e/releng/version.e2e.spec.ts Port releng e2e tests to Vitest and use conditional suite skipping via skipIf.
dev-packages/cli/tests/e2e/releng/prepare.e2e.spec.ts Port releng e2e tests to Vitest and use conditional suite skipping via skipIf.
dev-packages/cli/tests/e2e/generate-index.e2e.spec.ts Port e2e test to Vitest imports.
dev-packages/cli/tests/e2e/coverage-report.e2e.spec.ts Remove e2e tests for the removed coverageReport command.
dev-packages/cli/tests/e2e/check-header.e2e.spec.ts Port e2e test to Vitest imports.
dev-packages/cli/src/util/validation-util.spec.ts Port unit tests from sinon sandboxes to vi.spyOn.
dev-packages/cli/src/util/process-util.spec.ts Port unit tests to Vitest imports.
dev-packages/cli/src/util/package-util.spec.ts Port unit tests from sinon to vi.spyOn and vi.restoreAllMocks.
dev-packages/cli/src/util/glsp-repo-util.spec.ts Port unit tests to Vitest imports.
dev-packages/cli/src/util/git-util.spec.ts Port unit tests from sinon to vi.spyOn and Vitest mock call assertions.
dev-packages/cli/src/util/file-util.spec.ts Port unit tests to Vitest imports.
dev-packages/cli/src/commands/update-next.spec.ts Port unit tests from sinon to Vitest spies/mocks.
dev-packages/cli/src/commands/repo/workspace.spec.ts Port unit tests to Vitest imports.
dev-packages/cli/src/commands/repo/switch.spec.ts Port unit tests from sinon to Vitest spies/mocks.
dev-packages/cli/src/commands/repo/start.spec.ts Port unit tests to Vitest imports.
dev-packages/cli/src/commands/repo/server-node.spec.ts Port unit tests to Vitest imports.
dev-packages/cli/src/commands/repo/run.spec.ts Port unit tests to Vitest imports.
dev-packages/cli/src/commands/repo/repo.spec.ts Port unit tests to Vitest imports.
dev-packages/cli/src/commands/repo/link.spec.ts Port unit tests from sinon to Vitest spies/mocks and mock call assertions.
dev-packages/cli/src/commands/repo/fork.spec.ts Port unit tests from sinon to Vitest spies/mocks and mock call assertions.
dev-packages/cli/src/commands/repo/common/utils.spec.ts Port unit tests to Vitest imports.
dev-packages/cli/src/commands/repo/clone.spec.ts Port unit tests from sinon to Vitest spies/mocks and mock call assertions.
dev-packages/cli/src/commands/repo/build.spec.ts Port unit tests from sinon to Vitest spies/mocks and mock call assertions.
dev-packages/cli/src/commands/releng/version.spec.ts Port unit tests to Vitest imports.
dev-packages/cli/src/commands/releng/publish.spec.ts Port unit tests from sinon to Vitest spies/mocks and mock call assertions.
dev-packages/cli/src/commands/releng/common.spec.ts Port unit tests from sinon to Vitest spies/mocks.
dev-packages/cli/src/commands/coverage-report.ts Remove the bespoke nyc-based coverage report command.
dev-packages/cli/src/cli.ts Remove registration of the removed coverageReport command.
dev-packages/cli/src/cli.spec.ts Remove CLI tests for the removed coverageReport command and port remaining tests to Vitest.
dev-packages/cli/README.md Remove CLI documentation for the removed coverageReport command.
dev-packages/cli/package.json Switch test scripts to Vitest and add config-test dependency.
dev-packages/cli/.nycrc Remove nyc configuration (no longer used).
dev-packages/cli/.mocharc.json Remove Mocha configuration (no longer used).
dev-packages/cli/.mocharc.e2e.json Remove Mocha e2e configuration (no longer used).
.github/workflows/test.yml Switch CI test step from pnpm test:ci + CTRF report publishing to Vitest-based reporting/annotations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread dev-packages/config-test/README.md Outdated
Comment thread dev-packages/config-test/README.md Outdated
Comment thread dev-packages/vitest-config/README.md Outdated
@tortmayr
tortmayr merged commit 3f77454 into master Jun 22, 2026
4 checks passed
@tortmayr
tortmayr deleted the GLSP-1635-vitest-migration branch June 22, 2026 09:20
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