You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Run the unchanged suite under Vitest on a throwaway branch and record what fails #287
With the smallest config the research ticket supports, run the existing JavaScript tests under Vitest on a throwaway branch that is never merged. Which files pass unchanged, which fail, and what are the distinct failure causes? The answer is the failure list grouped by cause, with a pointer to the branch.
Context from jsdom for every test, or a Node environment for main-process and shell-config tests: run every file under jsdom with one setup list, no projects. Check two things specifically, because Vitest's jsdom keeps Node's setImmediate visible: (1) do the React-rendering tests (src/app/App.test.js, ErrorDialog, droppedFile, unhandledError) race jsdom teardown, as docs/agents/checks.md warns; (2) does src/main/updates.test.js still need its setImmediate polyfill.
The spike is on the throwaway branch 287-vitest-spike (four commits, no PR, never merged). It installs vitest@5.1.1 and jsdom@29.1.1 with Yarn 1 and adds a 23-line vitest.config.js.
Baseline: Jest runs 66 files and 471 tests, all passing.
First run, tests unchanged (with globals: true and a one-line shim globalThis.jest = vi so the files load): 57 of 66 files pass. The 9 failing files have three causes.
vi.resetModules() then await import(). The tests and their loader helpers become async.
jest.mock followed by require of a TypeScript module
src/main/getActiveState.test.js
vi.mock with the mock functions in vi.hoisted, then await import().
After those fixes: 66 files and 471 tests pass, with the same test count per file as Jest. The diff outside yarn.lock is 13 files, +61 −41. Summed file time fell from about 41 s under Jest to about 14 s.
Checks the other tickets asked for
React teardown race: not seen. The four React-rendering files passed five runs in a row with no unhandled error.
setImmediate polyfill in src/main/updates.test.js: not needed under Vitest's jsdom. The file passes with both lines deleted.
Loading the CommonJS e2e helpers: a plain import { parseNewick } from './newick' works, and so does the existing require. createRequire is not needed.
Research risks that did not show
The electron alias not reaching electron-log and electron-store: updates.test.js passes.
mobxActionWarning as both setup file and import: its proof test passes.
jsdom 16 to 29: no test changed behaviour.
JSX runtime and define-semantics class fields: Vite reads them from tsconfig.json; @vitejs/plugin-react is not needed in the config.
clearMocks: the suite passes with clearMocks: false and with Vitest's default.
The two beforeEach( () => stubBridge() ) sites pass unchanged.
New facts
vitest.config.js with ESM syntax prints a Vite warning on every run, because package.json has no "type": "module". Naming the file vitest.config.mjs removes the warning.
yarn add adds 43 packages to yarn.lock.
Not covered: the spike kept the jest shim and ambient globals. It did not rename jest.* to vi.*, add the explicit vitest imports, convert anything to TypeScript, or remove Jest and Babel.
Activity
jtklein-agents commentedon Nov 22, 2026
Context from jsdom for every test, or a Node environment for main-process and shell-config tests: run every file under jsdom with one setup list, no projects. Check two things specifically, because Vitest's jsdom keeps Node's
setImmediatevisible: (1) do the React-rendering tests (src/app/App.test.js,ErrorDialog,droppedFile,unhandledError) race jsdom teardown, asdocs/agents/checks.mdwarns; (2) doessrc/main/updates.test.jsstill need itssetImmediatepolyfill.jtklein-agents commentedon Nov 22, 2026
Context from Where the test support files and the e2e helper tests live, and how they get typechecked: the 4
e2e/helperstests stay beside their CommonJS helpers. Also record which form loads those helpers under Vitest: a plainimport, orcreateRequire.jtklein-agents commentedon Nov 22, 2026
Resolution
The spike is on the throwaway branch
287-vitest-spike(four commits, no PR, never merged). It installsvitest@5.1.1andjsdom@29.1.1with Yarn 1 and adds a 23-linevitest.config.js.Baseline: Jest runs 66 files and 471 tests, all passing.
First run, tests unchanged (with
globals: trueand a one-line shimglobalThis.jest = viso the files load): 57 of 66 files pass. The 9 failing files have three causes..jsfile: Vite does not parse itsrc/app/App.test.js,droppedFile.test.js,unhandledError.test.js,components/ErrorDialog.test.js.jsx(in the real change,.tsx). No content change.jest.isolateModulesdoes not existsrc/app/bootstrap.test.js,store/alignmentStore.test.js(1 test),store/host.test.js,store/provideStateReport.test.jsvi.resetModules()thenawait import(). The tests and their loader helpers becomeasync.jest.mockfollowed byrequireof a TypeScript modulesrc/main/getActiveState.test.jsvi.mockwith the mock functions invi.hoisted, thenawait import().After those fixes: 66 files and 471 tests pass, with the same test count per file as Jest. The diff outside
yarn.lockis 13 files, +61 −41. Summed file time fell from about 41 s under Jest to about 14 s.Checks the other tickets asked for
setImmediatepolyfill insrc/main/updates.test.js: not needed under Vitest's jsdom. The file passes with both lines deleted.import { parseNewick } from './newick'works, and so does the existingrequire.createRequireis not needed.Research risks that did not show
electronalias not reachingelectron-logandelectron-store:updates.test.jspasses.mobxActionWarningas both setup file and import: its proof test passes.tsconfig.json;@vitejs/plugin-reactis not needed in the config.clearMocks: the suite passes withclearMocks: falseand with Vitest's default.beforeEach( () => stubBridge() )sites pass unchanged.New facts
vitest.config.jswith ESM syntax prints a Vite warning on every run, becausepackage.jsonhas no"type": "module". Naming the filevitest.config.mjsremoves the warning.yarn addadds 43 packages toyarn.lock.Not covered: the spike kept the
jestshim and ambient globals. It did not renamejest.*tovi.*, add the explicitvitestimports, convert anything to TypeScript, or remove Jest and Babel.