-
Notifications
You must be signed in to change notification settings - Fork 29
test: migrate from Jest to Vitest #1024
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
db72cce to
77c276b
Compare
c7e24d9 to
40341a0
Compare
77c276b to
5faff09
Compare
40341a0 to
6190e7d
Compare
- Update .nvmrc and .node-version to Node 20 - Update engines field in root and shipjs package.json to >=20 - Update CircleCI config to use cimg/node:20.18 Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Update Node version to 20.19 (required by @vitejs/[email protected]) - Add sass-embedded dependency (required by VuePress default theme) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Modernize monorepo tooling by upgrading Lerna to v8. This update: - Updates lerna.json configuration format for Lerna 8 compatibility - Removes deprecated useWorkspaces option (Lerna 8 auto-detects workspaces) - Adds $schema reference for better IDE support Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Update vuepress from 1.9.10 to 2.0.0-rc.26 - Add @vuepress/bundler-vite, @vuepress/theme-default - Replace @vuepress/plugin-google-analytics v1 with v2 - Add @vuepress/plugin-docsearch for Algolia search - Rewrite config.js for VuePress 2 ESM format - Update homepage frontmatter (actionText → actions array) - Convert deploy script to ESM - Remove NODE_OPTIONS=--openssl-legacy-provider hack VuePress 2 requires Node.js 20+. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Modernize monorepo tooling by upgrading Lerna to v8. This update: - Updates lerna.json configuration format for Lerna 8 compatibility - Removes deprecated useWorkspaces option (Lerna 8 auto-detects workspaces) - Adds $schema reference for better IDE support Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Update vuepress from 1.9.10 to 2.0.0-rc.26 - Add @vuepress/bundler-vite, @vuepress/theme-default - Replace @vuepress/plugin-google-analytics v1 with v2 - Add @vuepress/plugin-docsearch for Algolia search - Rewrite config.js for VuePress 2 ESM format - Update homepage frontmatter (actionText → actions array) - Convert deploy script to ESM - Remove NODE_OPTIONS=--openssl-legacy-provider hack VuePress 2 requires Node.js 20+. Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Replace Jest 29 with Vitest 3.0.5 for native ESM support - Update test files to use `vi` instead of `jest` for mocking - Update vi.mock factories to use proper default export syntax - Replace vi.requireActual with await vi.importActual for ESM - Update globby import to use named export (v14 is ESM-only) - Update chalk color API for v5 (hex() instead of keyword()) - Update ESLint configs to remove Babel parser and Jest plugin - Add Vitest globals to ESLint overrides for test files - Update eslint-plugin-prettier to v5 and eslint-config-prettier to v9 This migration enables use of latest ESM-only package versions: - chalk v5.4.1 - globby v14.1.0 - inquirer v12.5.0 - open v10.1.2 - temp-write v6.0.0 - tempfile v5.0.0 Co-Authored-By: Claude Opus 4.5 <[email protected]>
Vitest doesn't use --maxWorkers. It auto-detects CI environments and handles parallelism appropriately. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Ship.js is a CLI tool that intentionally works with user-provided directories and file paths. The 'path traversal' warnings for helper and step modules are false positives for this use case. Co-Authored-By: Claude Opus 4.5 <[email protected]>
6190e7d to
4a53f13
Compare
dhayab
approved these changes
Feb 3, 2026
Member
dhayab
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat migration! Just left a question out of curiosity.
packages/shipjs-lib/src/lib/git/__tests__/hasRemoteBranch.spec.js
Outdated
Show resolved
Hide resolved
Co-Authored-By: Claude Opus 4.5 <[email protected]>
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.
Summary
viinstead ofjestfor mockingvi.requireActualwithawait vi.importActualfor ESMhex()instead ofkeyword())Why Vitest?
This PR migrates from Jest to Vitest to unblock the use of modern ESM-only packages.
The problem: Jest with babel-jest transforms ES modules to CommonJS at test time. This breaks packages that are published as ESM-only (no CommonJS fallback), because the transformed code can't properly import them.
Packages affected: Many popular packages have moved to ESM-only in recent versions:
chalkv5+globbyv12+inquirerv9+openv9+temp-writev5+tempfilev4+Why Vitest over other solutions:
jest.fn()→vi.fn(),jest.mock()→vi.mock()This PR completes the dependency updates started in PR #1023 by enabling the latest versions of ESM-only packages.
Changes
New dependencies
vitest3.0.5@vitest/coverage-v83.0.5Removed dependencies
jest29.xbabel-jest@babel/core@babel/preset-env@babel/plugin-transform-runtimejest-watch-typeaheadeslint-plugin-jest@babel/eslint-parserUpdated dependencies (now using latest ESM-only versions)
chalk^5.4.1globby^14.1.0inquirer^12.5.0open^10.1.2temp-write^6.0.0tempfile^5.0.0eslint-plugin-prettier5.2.3eslint-config-prettier9.1.0