GLSP-1635: Migrate spec assertions to native Vitest matchers#1708
Merged
Conversation
- Convert all Chai-style BDD assertions (`.to.be.true`, `.to.deep.equal`, `.to.include.members`, ...) across the CLI specs to native Vitest matchers; they previously passed only via Vitest's bundled Chai-compatible API - Drop the now-redundant eslint-plugin-chai-friendly and restore the plain no-unused-expressions rule, since the converted assertions are method calls rather than bare expression statements - Remove the stale mocha global from the shared eslint base config Also: - Add a root test:coverage script - Drop dead ctrf/ and .nyc_output/ entries from .gitignore Part of: #1635
There was a problem hiding this comment.
Pull request overview
This PR completes the Vitest migration by converting the remaining chai-style assertions in CLI unit/e2e specs to native Vitest matchers, and cleans up the now-obsolete ESLint/ignore tooling that supported chai’s property-based assertions.
Changes:
- Migrate chai-style assertions to Vitest matchers across CLI unit and e2e spec files.
- Remove
eslint-plugin-chai-friendly, re-enable coreno-unused-expressions, and drop obsoleteglobals.mochafrom the shared ESLint config. - Minor repo hygiene: remove stale ignore entries and add a root
test:coveragepassthrough script.
Reviewed changes
Copilot reviewed 37 out of 39 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Removes eslint-plugin-chai-friendly from the lockfile/importers. |
| package.json | Adds root test:coverage script forwarding to dev-packages/cli. |
| dev-packages/eslint-config/package.json | Drops eslint-plugin-chai-friendly peer dependency. |
| dev-packages/eslint-config/configs/errors.js | Re-enables core no-unused-expressions with appropriate options. |
| dev-packages/eslint-config/configs/base.js | Removes chai-friendly plugin wiring and obsolete globals.mocha. |
| dev-packages/config/package.json | Drops eslint-plugin-chai-friendly dependency. |
| dev-packages/cli/tests/e2e/update-next.e2e.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/tests/e2e/repo/repo-vscode.e2e.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/tests/e2e/repo/repo-theia.e2e.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/tests/e2e/repo/repo-eclipse.e2e.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/tests/e2e/repo/repo-core-clone.e2e.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/tests/e2e/repo/repo-core-build.e2e.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/tests/e2e/releng/version.e2e.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/tests/e2e/releng/prepare.e2e.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/tests/e2e/generate-index.e2e.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/tests/e2e/check-header.e2e.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/src/util/validation-util.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/src/util/process-util.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/src/util/package-util.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/src/util/glsp-repo-util.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/src/util/git-util.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/src/util/file-util.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/src/commands/update-next.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/src/commands/repo/workspace.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/src/commands/repo/switch.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/src/commands/repo/start.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/src/commands/repo/server-node.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/src/commands/repo/run.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/src/commands/repo/repo.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/src/commands/repo/link.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/src/commands/repo/fork.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/src/commands/repo/common/utils.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/src/commands/repo/clone.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/src/commands/repo/build.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/src/commands/releng/version.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/src/commands/releng/publish.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/src/commands/releng/common.spec.ts | Converts assertions to Vitest matchers. |
| dev-packages/cli/src/cli.spec.ts | Converts assertions to Vitest matchers (CLI shape/option tests). |
| .gitignore | Removes stale ctrf/ and .nyc_output/ ignore entries. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What it does
Follow-up to the Vitest migration (#1705): converts the remaining chai-style
BDD assertions in all spec files to native Vitest matchers and drops the
now-unused chai tooling.
.to.equal→toBe,.to.deep.equal→toEqual,.to.include.members([...])→toEqual(expect.arrayContaining([...])),.to.throw→toThrow, etc.)eslint-plugin-chai-friendlyfrom theconfigandeslint-configpackages and re-enable the core
no-unused-expressionsrule, which is correctagain now that assertions are function calls rather than property accesses
globals.mochaentry from the base ESLint configctrf/and.nyc_output/entries from.gitignoretest:coveragepassthrough script to the rootpackage.jsonPart of: #1635
How to test
dev-packages/cli/srcortestsFollow-ups
Changelog