Skip to content

chore: remove cross-env, move env vars to vitest config#4684

Merged
escapedcat merged 1 commit into
masterfrom
chore/remove-cross-env
Apr 30, 2026
Merged

chore: remove cross-env, move env vars to vitest config#4684
escapedcat merged 1 commit into
masterfrom
chore/remove-cross-env

Conversation

@escapedcat

@escapedcat escapedcat commented Apr 3, 2026

Copy link
Copy Markdown
Member

cross-env was archived by Kent C. Dodds in November 2025, and the
project recommends migrating to native solutions where possible. This
repo only used it in one place — the root test script — to set
HOME, LANG, and NO_COLOR for the vitest run.

Changes

  • package.json
    • Remove cross-env ^7.0.3 from devDependencies.
    • Simplify test script: cross-env HOME=$PWD LANG=en_US.UTF-8 NO_COLOR=1 vitest run --coveragevitest run --coverage.
  • vitest.config.ts
    • Add test.env: { HOME: process.cwd(), LANG: "en_US.UTF-8", NO_COLOR: "1" }.
  • yarn.lock
    • Pruned (cross-env and unused transitive entries).

Equivalence

Vitest's test.env injects values into process.env for the test
run, matching the previous behaviour:

Var Before (cross-env) After (vitest env)
HOME $PWD (shell-evaluated at run time) process.cwd() (resolved at config load)
LANG en_US.UTF-8 en_US.UTF-8
NO_COLOR 1 "1"

HOME is the only nuance: $PWD and process.cwd() resolve to the
same value when yarn test is invoked from the repo root (as it
always is in CI and the only documented workflow), so behaviour is
unchanged.

@escapedcat escapedcat force-pushed the chore/node22-dep-cleanup branch from 9c07126 to 2799909 Compare April 30, 2026 08:57
Base automatically changed from chore/node22-dep-cleanup to master April 30, 2026 09:11
cross-env is archived (Nov 2025). Move HOME, LANG, and NO_COLOR
env vars into vitest.config.ts instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@escapedcat escapedcat force-pushed the chore/remove-cross-env branch from c455cc2 to fc785d5 Compare April 30, 2026 09:13
@escapedcat escapedcat changed the title chore: remove cross-env, move env vars to vitest config chore: remove cross-env, move env vars to vitest config Apr 30, 2026
@escapedcat escapedcat requested a review from Copilot April 30, 2026 09:14
@escapedcat escapedcat marked this pull request as ready for review April 30, 2026 09:14
@qodo-code-review

Copy link
Copy Markdown
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Removes the archived cross-env dependency and moves the test-time environment variable setup into Vitest configuration so tests run with consistent HOME, LANG, and NO_COLOR without relying on shell-specific env var syntax.

Changes:

  • Drop cross-env from devDependencies and simplify the root test script to run Vitest directly.
  • Configure test.env in vitest.config.ts to inject HOME, LANG, and NO_COLOR during test runs.
  • Prune yarn.lock accordingly.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
package.json Removes cross-env usage/dependency and simplifies yarn test.
vitest.config.ts Adds test.env values to replace prior cross-env-provided environment variables.
yarn.lock Removes cross-env lock entry and updates related resolution entries.

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

@escapedcat escapedcat merged commit 43f05f4 into master Apr 30, 2026
19 checks passed
@escapedcat escapedcat deleted the chore/remove-cross-env branch April 30, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants