Skip to content

PER-10670: Switch to vitest#789

Open
liam-lloyd wants to merge 1 commit into
mainfrom
noissue_switch_to_vitest
Open

PER-10670: Switch to vitest#789
liam-lloyd wants to merge 1 commit into
mainfrom
noissue_switch_to_vitest

Conversation

@liam-lloyd

@liam-lloyd liam-lloyd commented Jun 26, 2026

Copy link
Copy Markdown
Member

Jest doesn't officially support ESM. We'd like to move this repo to ESM,
as that appears to be the way of the future (and we have some
dependencies that in their latest releases only offer ESM support). To
that end, this commit replaces Jest with Vitest.

@liam-lloyd liam-lloyd marked this pull request as draft June 26, 2026 22:01
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.86%. Comparing base (fdbdc9a) to head (03b784a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #789      +/-   ##
==========================================
- Coverage   98.56%   97.86%   -0.70%     
==========================================
  Files         109      124      +15     
  Lines        2783     5583    +2800     
  Branches      462     1059     +597     
==========================================
+ Hits         2743     5464    +2721     
- Misses         36      117      +81     
+ Partials        4        2       -2     
Flag Coverage Δ
api 97.86% <ø> (-0.70%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@liam-lloyd liam-lloyd force-pushed the noissue_switch_to_vitest branch 6 times, most recently from 58d42f9 to d9ddc4a Compare July 7, 2026 17:53
@liam-lloyd liam-lloyd marked this pull request as ready for review July 7, 2026 17:59
@liam-lloyd liam-lloyd changed the title Switch to vitest - WIP PER-10670: Switch to vitest Jul 7, 2026
@liam-lloyd

Copy link
Copy Markdown
Member Author

The codecov difference here seems to come from differences in how jest and vitest count coverage, not from any actual reduction in coverage.

@liam-lloyd liam-lloyd force-pushed the noissue_switch_to_vitest branch 2 times, most recently from b5ba73c to 03b784a Compare July 7, 2026 21:16

@cecilia-donnelly cecilia-donnelly left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks straightforward and the tests are passing. I have a question about the import setup inline.

@@ -1,5 +1,6 @@
import request from "supertest";
import { when } from "jest-when";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It looks like we imported these from jest in some central location and have to import them in each file from vitest -- is that expected?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, this is a difference in philosophy between jest and vitest. Jest imported a bunch of stuff automatically, vitest wants you to be explicit

@cecilia-donnelly

Copy link
Copy Markdown
Member

Some Claude review comments:

- packages/event_utils lost its jest.config.js with no vitest.config.ts replacement — dormant since it has no tests yet, but will break  path-alias resolution the moment one is added.
- AGENTS.md still tells contributors to use jest-when, which was removed from package.json in favor of vitest-when.
-  a duplicated hand-rolled @stela/logger mock in trigger_archivematica instead of the new shared mock, vitest-mock-extended added  separately in 6 package.json files instead of hoisted at root, coverage.clean: false risking stale coverage output, and the old silent:   true Jest option having no Vitest equivalent (noisier CI logs).

@liam-lloyd

Copy link
Copy Markdown
Member Author

Some Claude review comments:

- packages/event_utils lost its jest.config.js with no vitest.config.ts replacement — dormant since it has no tests yet, but will break  path-alias resolution the moment one is added.
- AGENTS.md still tells contributors to use jest-when, which was removed from package.json in favor of vitest-when.
-  a duplicated hand-rolled @stela/logger mock in trigger_archivematica instead of the new shared mock, vitest-mock-extended added  separately in 6 package.json files instead of hoisted at root, coverage.clean: false risking stale coverage output, and the old silent:   true Jest option having no Vitest equivalent (noisier CI logs).

I think it's correct for event_utils to not have a vitest config if it doesn't have tests. I've fixed the other things noted here (except the last one, which doesn't have a fix)

@liam-lloyd liam-lloyd force-pushed the noissue_switch_to_vitest branch 3 times, most recently from 7d57868 to a5f2a86 Compare July 13, 2026 23:38
Jest doesn't officially support ESM. We'd like to move this repo to ESM,
as that appears to be the way of the future (and we have some
dependencies that in their latest releases only offer ESM support). To
that end, this commit replaces Jest with Vitest.
@liam-lloyd liam-lloyd force-pushed the noissue_switch_to_vitest branch from a5f2a86 to 1980c41 Compare July 13, 2026 23:50
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