Skip to content

Conversation

@sarahdayan
Copy link
Member

@sarahdayan sarahdayan commented Feb 3, 2026

Summary

  • 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

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:

  • chalk v5+
  • globby v12+
  • inquirer v9+
  • open v9+
  • temp-write v5+
  • tempfile v4+

Why Vitest over other solutions:

  1. Native ESM support - Vitest runs tests in native ESM mode, so ESM-only packages work out of the box
  2. Jest-compatible API - The migration is straightforward: jest.fn()vi.fn(), jest.mock()vi.mock()
  3. Faster - Vitest leverages Vite's transform pipeline and is generally faster than Jest
  4. Active maintenance - Vitest is actively maintained and designed for modern JavaScript

This PR completes the dependency updates started in PR #1023 by enabling the latest versions of ESM-only packages.

Changes

New dependencies

  • vitest 3.0.5
  • @vitest/coverage-v8 3.0.5

Removed dependencies

  • jest 29.x
  • babel-jest
  • @babel/core
  • @babel/preset-env
  • @babel/plugin-transform-runtime
  • jest-watch-typeahead
  • eslint-plugin-jest
  • @babel/eslint-parser

Updated dependencies (now using latest ESM-only versions)

  • chalk ^5.4.1
  • globby ^14.1.0
  • inquirer ^12.5.0
  • open ^10.1.2
  • temp-write ^6.0.0
  • tempfile ^5.0.0
  • eslint-plugin-prettier 5.2.3
  • eslint-config-prettier 9.1.0

@sarahdayan sarahdayan requested review from a team, aymeric-giraudet and shaejaz and removed request for a team February 3, 2026 13:09
@sarahdayan sarahdayan changed the base branch from main to chore/update-runtime-deps February 3, 2026 13:17
@sarahdayan sarahdayan requested a review from dhayab February 3, 2026 14:52
@sarahdayan sarahdayan force-pushed the chore/update-runtime-deps branch from db72cce to 77c276b Compare February 3, 2026 14:55
@sarahdayan sarahdayan force-pushed the chore/migrate-to-vitest branch from c7e24d9 to 40341a0 Compare February 3, 2026 14:56
@sarahdayan sarahdayan force-pushed the chore/update-runtime-deps branch from 77c276b to 5faff09 Compare February 3, 2026 16:56
@sarahdayan sarahdayan force-pushed the chore/migrate-to-vitest branch from 40341a0 to 6190e7d Compare February 3, 2026 17:01
@sarahdayan sarahdayan requested a review from Haroenv February 3, 2026 17:03
Base automatically changed from chore/update-runtime-deps to main February 3, 2026 17:07
Sarah Dayan and others added 9 commits February 3, 2026 18:14
- 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]>
@sarahdayan sarahdayan force-pushed the chore/migrate-to-vitest branch from 6190e7d to 4a53f13 Compare February 3, 2026 17:14
Copy link
Member

@dhayab dhayab left a 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.

@sarahdayan sarahdayan merged commit 909f43a into main Feb 3, 2026
2 checks passed
@sarahdayan sarahdayan deleted the chore/migrate-to-vitest branch February 3, 2026 18:57
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