Skip to content

feat(test-js): add Vitest runner support - #74

Open
Adi-ty wants to merge 1 commit into
mainfrom
feat/test-js-runner
Open

Adi-ty wants to merge 1 commit into
mainfrom
feat/test-js-runner

Conversation

@Adi-ty

@Adi-ty Adi-ty commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

What this PR does

Lets ci-test-js.yml run Vitest as well as Jest, so a project whose test:js script runs Vitest can use the shared workflow. Jest stays the default, so callers that don't set the new input see no change.

Closes

Part of #51: the ci-test-js gap "Jest hardcoded, while @wordpress/scripts 36 defaults to Vitest".

Changes

  • ci-test-js.yml gains test-runner: jest or vitest, default "" (Jest). A new Resolve test runner step fails the job with an error for any other value.
  • With vitest, the default command is npm run test:js --, without Jest's --ci (Vitest reads CI from the environment). The Jest cache steps are skipped and no --cacheDirectory is appended, so enable-cache is ignored.
  • With jest or empty, the command, cache and appended --cacheDirectory are the same as before.
  • The job name follows the runner: Jest by default, Vitest only when a caller sets vitest. The Run Jest step is now Run tests.
  • wp-ci.yml gains test-js-runner and forwards it to test-js. The test-js-command and test-js-cache descriptions now cover both runners.
  • examples/ci-test-js.yml shows test-runner. The README setup line and index row say "Jest or Vitest", and the README now says how to switch.

How I verified

$ pipx run yamllint .
./.github/workflows/ci-lint-php.yml
  23:201    warning  line too long (334 > 200 characters)  (line-length)
$ actionlint .github/workflows/*.yml examples/*.yml
$ bin/check-workflows.sh
Workflow/example contract check passed.

Acceptance criteria

Runtime behavior

  • test-runner empty: a consumer run uses the same command, cache and Jest check name as before
  • A consumer on Vitest passes with test-js-runner: vitest
  • An unknown test-runner value fails Resolve test runner

Code quality

  • Lint — zero errors
  • Static analysis — zero errors
  • Tests pass (n/a: no scripts changed)

Housekeeping

  • PR title is a Conventional Commit — release-please writes CHANGELOG.md from it
  • examples/<workflow>.yml added or updated to match any input change
  • yamllint, actionlint and bin/check-workflows.sh pass locally

Reviewer notes

  • The check name changes only for callers that opt in. A repository that requires the Jest check and switches to vitest has to require Vitest instead.
  • With Vitest, nothing is appended to test-command, so a custom command doesn't need to forward "$@".

Conventions: AGENTS.md · PR process: CONTRIBUTING.md

@Adi-ty
Adi-ty marked this pull request as ready for review November 20, 2026 12:23
Copilot AI balanced review requested due to automatic review settings November 20, 2026 12:23

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@Adi-ty
Adi-ty force-pushed the feat/test-js-runner branch from c2fd82a to 6202423 Compare November 20, 2026 15:27
Copilot AI balanced review requested due to automatic review settings November 20, 2026 15:27

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

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.

2 participants