From 5e5d9f53873bb96548374b426628c02172c4fbaf Mon Sep 17 00:00:00 2001 From: Brian Donovan <1938+eventualbuddha@users.noreply.github.com> Date: Tue, 10 Dec 2024 12:09:33 -0800 Subject: [PATCH] test(ballot-interpreter): switch from `jest` to `vitest` (#5705) --- libs/ballot-interpreter/.eslintignore | 2 +- libs/ballot-interpreter/Cargo.toml | 2 +- libs/ballot-interpreter/README.md | 3 +- .../{benchmarking.ts => benchmarking.mts} | 3 +- ...t_bmd.bench.ts => interpret_bmd.bench.mts} | 9 +- ...hmpb.bench.ts => interpret_hmpb.bench.mts} | 9 +- .../benchmarks/jest.config.js | 13 - .../benchmarks/vitest.config.mts | 9 + libs/ballot-interpreter/bin/diagnostic | 4 +- libs/ballot-interpreter/bin/interpret | 4 +- libs/ballot-interpreter/bin/scoring-report | 4 +- libs/ballot-interpreter/jest.config.js | 23 -- libs/ballot-interpreter/package.json | 19 +- ...n-marked-ballot-interpretation-1-snap.png} | Bin ...ap => interpret_bmd_ballots.test.mts.snap} | 12 +- ...s.snap => interpret_nh_hmpb.test.mts.snap} | 156 ++++++------ ....test.ts => adjudication_reasons.test.mts} | 3 +- ...py-path-back-front-upside-down-2-snap.png} | Bin ...py-path-front-upside-down-back-2-snap.png} | Bin ....test.tsx.snap => interpret.test.mts.snap} | 2 +- ...{interpret.test.tsx => interpret.test.mts} | 5 +- .../utils/{qrcode.test.ts => qrcode.test.mts} | 5 +- .../utils/{rotate.test.ts => rotate.test.mts} | 3 +- ...t.test.ts.snap => interpret.test.mts.snap} | 2 +- .../src/hmpb-ts/{rust_addon.d.ts => addon.ts} | 37 ++- .../src/hmpb-ts/{cli.test.ts => cli.test.mts} | 5 +- .../hmpb-ts/{debug.test.ts => debug.test.mts} | 12 +- ...diagnostic.test.ts => diagnostic.test.mts} | 3 +- .../src/hmpb-ts/diagnostic.ts | 2 +- ...> find_template_grid_and_bubbles.test.mts} | 5 +- .../hmpb-ts/find_template_grid_and_bubbles.ts | 2 +- .../{interpret.test.ts => interpret.test.mts} | 3 +- .../src/hmpb-ts/interpret.ts | 2 +- .../src/hmpb-ts/rust_addon.node | 1 - .../hmpb-ts/{types.test.ts => types.test.mts} | 3 +- ...s => interpret_all_bubble_ballot.test.mts} | 8 +- ...t.ts => interpret_and_save_files.test.mts} | 7 +- ...=> interpret_bmd_and_hmp_ballots.test.mts} | 5 +- ...test.ts => interpret_bmd_ballots.test.mts} | 13 +- ...mpb.test.ts => interpret_nh_hmpb.test.mts} | 11 +- ...mpb.test.ts => interpret_vx_hmpb.test.mts} | 13 +- ...ve_images.test.ts => save_images.test.mts} | 5 +- libs/ballot-interpreter/src/setupTests.ts | 1 + ...validation.test.ts => validation.test.mts} | 5 +- .../ballot-interpreter/test/fixtures/index.ts | 0 .../{interpretation.ts => interpretation.mts} | 0 .../test/helpers/{tmp.ts => tmp.mts} | 1 + libs/ballot-interpreter/tsconfig.build.json | 8 +- libs/ballot-interpreter/tsconfig.json | 1 + libs/ballot-interpreter/vitest.config.mts | 13 + .../src/configs/recommended.ts | 28 ++- libs/test-utils-vitest/.eslintignore | 2 +- libs/test-utils-vitest/package.json | 5 +- .../src/child_process.test.ts | 6 +- libs/test-utils-vitest/src/console.test.ts | 2 +- libs/test-utils-vitest/src/index.ts | 12 +- .../src/mock_function.test.ts | 2 +- .../{vitest.config.ts => vitest.config.mts} | 4 +- package.json | 3 +- pnpm-lock.yaml | 236 +++--------------- vitest.config.shared.mts | 49 ++++ 61 files changed, 382 insertions(+), 425 deletions(-) rename libs/ballot-interpreter/benchmarks/{benchmarking.ts => benchmarking.mts} (98%) rename libs/ballot-interpreter/benchmarks/{interpret_bmd.bench.ts => interpret_bmd.bench.mts} (88%) rename libs/ballot-interpreter/benchmarks/{interpret_hmpb.bench.ts => interpret_hmpb.bench.mts} (88%) delete mode 100644 libs/ballot-interpreter/benchmarks/jest.config.js create mode 100644 libs/ballot-interpreter/benchmarks/vitest.config.mts delete mode 100644 libs/ballot-interpreter/jest.config.js rename libs/ballot-interpreter/src/__image_snapshots__/{interpret-vx-hmpb-test-ts-hmpb-general-election-letter-paper-language-en-marked-ballot-interpretation-1-snap.png => interpret-vx-hmpb-test-mts-hmpb-general-election-letter-paper-language-en-marked-ballot-interpretation-1-snap.png} (100%) rename libs/ballot-interpreter/src/__snapshots__/{interpret_bmd_ballots.test.ts.snap => interpret_bmd_ballots.test.mts.snap} (96%) rename libs/ballot-interpreter/src/__snapshots__/{interpret_nh_hmpb.test.ts.snap => interpret_nh_hmpb.test.mts.snap} (96%) rename libs/ballot-interpreter/src/{adjudication_reasons.test.ts => adjudication_reasons.test.mts} (99%) rename libs/ballot-interpreter/src/bmd/__image_snapshots__/{interpret-test-tsx-happy-path-back-front-upside-down-2-snap.png => interpret-test-mts-happy-path-back-front-upside-down-2-snap.png} (100%) rename libs/ballot-interpreter/src/bmd/__image_snapshots__/{interpret-test-tsx-happy-path-front-upside-down-back-2-snap.png => interpret-test-mts-happy-path-front-upside-down-back-2-snap.png} (100%) rename libs/ballot-interpreter/src/bmd/__snapshots__/{interpret.test.tsx.snap => interpret.test.mts.snap} (99%) rename libs/ballot-interpreter/src/bmd/{interpret.test.tsx => interpret.test.mts} (98%) rename libs/ballot-interpreter/src/bmd/utils/{qrcode.test.ts => qrcode.test.mts} (97%) rename libs/ballot-interpreter/src/bmd/utils/{rotate.test.ts => rotate.test.mts} (95%) rename libs/ballot-interpreter/src/hmpb-ts/__snapshots__/{interpret.test.ts.snap => interpret.test.mts.snap} (99%) rename libs/ballot-interpreter/src/hmpb-ts/{rust_addon.d.ts => addon.ts} (55%) rename libs/ballot-interpreter/src/hmpb-ts/{cli.test.ts => cli.test.mts} (92%) rename libs/ballot-interpreter/src/hmpb-ts/{debug.test.ts => debug.test.mts} (93%) rename libs/ballot-interpreter/src/hmpb-ts/{diagnostic.test.ts => diagnostic.test.mts} (84%) rename libs/ballot-interpreter/src/hmpb-ts/{find_template_grid_and_bubbles.test.ts => find_template_grid_and_bubbles.test.mts} (92%) rename libs/ballot-interpreter/src/hmpb-ts/{interpret.test.ts => interpret.test.mts} (99%) delete mode 120000 libs/ballot-interpreter/src/hmpb-ts/rust_addon.node rename libs/ballot-interpreter/src/hmpb-ts/{types.test.ts => types.test.mts} (59%) rename libs/ballot-interpreter/src/{interpret_all_bubble_ballot.test.ts => interpret_all_bubble_ballot.test.mts} (95%) rename libs/ballot-interpreter/src/{interpret_and_save_files.test.ts => interpret_and_save_files.test.mts} (87%) rename libs/ballot-interpreter/src/{interpret_bmd_and_hmp_ballots.test.ts => interpret_bmd_and_hmp_ballots.test.mts} (95%) rename libs/ballot-interpreter/src/{interpret_bmd_ballots.test.ts => interpret_bmd_ballots.test.mts} (98%) rename libs/ballot-interpreter/src/{interpret_nh_hmpb.test.ts => interpret_nh_hmpb.test.mts} (97%) rename libs/ballot-interpreter/src/{interpret_vx_hmpb.test.ts => interpret_vx_hmpb.test.mts} (98%) rename libs/ballot-interpreter/src/{save_images.test.ts => save_images.test.mts} (81%) rename libs/ballot-interpreter/src/{validation.test.ts => validation.test.mts} (96%) delete mode 100644 libs/ballot-interpreter/test/fixtures/index.ts rename libs/ballot-interpreter/test/helpers/{interpretation.ts => interpretation.mts} (100%) rename libs/ballot-interpreter/test/helpers/{tmp.ts => tmp.mts} (90%) create mode 100644 libs/ballot-interpreter/vitest.config.mts rename libs/test-utils-vitest/{vitest.config.ts => vitest.config.mts} (75%) create mode 100644 vitest.config.shared.mts diff --git a/libs/ballot-interpreter/.eslintignore b/libs/ballot-interpreter/.eslintignore index e2c7cf4cc8..93f0e825ef 100644 --- a/libs/ballot-interpreter/.eslintignore +++ b/libs/ballot-interpreter/.eslintignore @@ -1,3 +1,3 @@ build coverage -jest.config.js \ No newline at end of file +vitest.config.mts \ No newline at end of file diff --git a/libs/ballot-interpreter/Cargo.toml b/libs/ballot-interpreter/Cargo.toml index 6a9523fcb1..a5fbc026ae 100644 --- a/libs/ballot-interpreter/Cargo.toml +++ b/libs/ballot-interpreter/Cargo.toml @@ -2,7 +2,7 @@ name = "ballot-interpreter" version = "0.1.0" edition = "2021" -exclude = ["build/rust_addon.node"] +exclude = ["build/addon.node"] [lib] crate-type = ["cdylib", "rlib"] diff --git a/libs/ballot-interpreter/README.md b/libs/ballot-interpreter/README.md index a7d6cead07..0ec9d03d60 100644 --- a/libs/ballot-interpreter/README.md +++ b/libs/ballot-interpreter/README.md @@ -19,8 +19,7 @@ $ pnpm build This command uses the [cargo-cp-artifact](https://github.com/neon-bindings/cargo-cp-artifact) utility -to run the Rust build and copy the built library into -`./build/hmpb-ts/rust_addon.node`. +to run the Rust build and copy the built library into `./build/addon.node`. ## CLI diff --git a/libs/ballot-interpreter/benchmarks/benchmarking.ts b/libs/ballot-interpreter/benchmarks/benchmarking.mts similarity index 98% rename from libs/ballot-interpreter/benchmarks/benchmarking.ts rename to libs/ballot-interpreter/benchmarks/benchmarking.mts index 37369bfb13..2c826eed67 100644 --- a/libs/ballot-interpreter/benchmarks/benchmarking.ts +++ b/libs/ballot-interpreter/benchmarks/benchmarking.mts @@ -1,4 +1,5 @@ -/* eslint-disable vx/gts-safe-number-parse */ +/* eslint-disable import/no-extraneous-dependencies, vx/gts-safe-number-parse */ +import { expect } from 'vitest'; import { assertDefined, iter, range } from '@votingworks/basics'; import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'; import { dirname, join } from 'node:path'; diff --git a/libs/ballot-interpreter/benchmarks/interpret_bmd.bench.ts b/libs/ballot-interpreter/benchmarks/interpret_bmd.bench.mts similarity index 88% rename from libs/ballot-interpreter/benchmarks/interpret_bmd.bench.ts rename to libs/ballot-interpreter/benchmarks/interpret_bmd.bench.mts index 93b6d5d12d..c2481cf1f8 100644 --- a/libs/ballot-interpreter/benchmarks/interpret_bmd.bench.ts +++ b/libs/ballot-interpreter/benchmarks/interpret_bmd.bench.mts @@ -1,3 +1,4 @@ +import { beforeAll, describe, test } from 'vitest'; import { assertDefined } from '@votingworks/basics'; import { readElection } from '@votingworks/fs'; import { famousNamesFixtures } from '@votingworks/hmpb'; @@ -14,11 +15,9 @@ import { renderBmdBallotFixture, } from '@votingworks/bmd-ballot-fixtures'; import { electionFamousNames2021Fixtures } from '@votingworks/fixtures'; -import { interpretSheet } from '../src'; -import { pdfToPageImages } from '../test/helpers/interpretation'; -import { benchmarkRegressionTest } from './benchmarking'; - -jest.setTimeout(60_000); +import { interpretSheet } from '../src/index.js'; +import { pdfToPageImages } from '../test/helpers/interpretation.mjs'; +import { benchmarkRegressionTest } from './benchmarking.mjs'; describe('Interpretation benchmark', () => { const { electionPath, precinctId } = famousNamesFixtures; diff --git a/libs/ballot-interpreter/benchmarks/interpret_hmpb.bench.ts b/libs/ballot-interpreter/benchmarks/interpret_hmpb.bench.mts similarity index 88% rename from libs/ballot-interpreter/benchmarks/interpret_hmpb.bench.ts rename to libs/ballot-interpreter/benchmarks/interpret_hmpb.bench.mts index beb2001561..5e0fbfedc4 100644 --- a/libs/ballot-interpreter/benchmarks/interpret_hmpb.bench.ts +++ b/libs/ballot-interpreter/benchmarks/interpret_hmpb.bench.mts @@ -1,3 +1,4 @@ +import { beforeAll, describe, test } from 'vitest'; import { assertDefined } from '@votingworks/basics'; import { readElection } from '@votingworks/fs'; import { famousNamesFixtures } from '@votingworks/hmpb'; @@ -7,11 +8,9 @@ import { ElectionDefinition, } from '@votingworks/types'; import { singlePrecinctSelectionFor } from '@votingworks/utils'; -import { interpretSheet } from '../src'; -import { pdfToPageImages } from '../test/helpers/interpretation'; -import { benchmarkRegressionTest } from './benchmarking'; - -jest.setTimeout(60_000); +import { interpretSheet } from '../src/index.js'; +import { pdfToPageImages } from '../test/helpers/interpretation.mjs'; +import { benchmarkRegressionTest } from './benchmarking.mjs'; describe('Interpretation benchmark', () => { const { electionPath, precinctId, blankBallotPath, markedBallotPath } = diff --git a/libs/ballot-interpreter/benchmarks/jest.config.js b/libs/ballot-interpreter/benchmarks/jest.config.js deleted file mode 100644 index f6861bf2de..0000000000 --- a/libs/ballot-interpreter/benchmarks/jest.config.js +++ /dev/null @@ -1,13 +0,0 @@ -const shared = require('../../../jest.config.shared'); - -/** - * @type {import('@jest/types').Config.InitialOptions} - */ -module.exports = { - ...shared, - testMatch: ['/**/*.bench.ts'], - watchPathIgnorePatterns: [ - ...shared.watchPathIgnorePatterns, - '/results', - ], -}; diff --git a/libs/ballot-interpreter/benchmarks/vitest.config.mts b/libs/ballot-interpreter/benchmarks/vitest.config.mts new file mode 100644 index 0000000000..1fadfd1622 --- /dev/null +++ b/libs/ballot-interpreter/benchmarks/vitest.config.mts @@ -0,0 +1,9 @@ +// @ts-ignore +import { defineConfig } from '../../../vitest.config.shared.mjs'; + +export default defineConfig({ + test: { + include: ['**/*.bench.mts'], + maxConcurrency: 1, + }, +}); diff --git a/libs/ballot-interpreter/bin/diagnostic b/libs/ballot-interpreter/bin/diagnostic index 7889dd3c1e..dde0a869f0 100755 --- a/libs/ballot-interpreter/bin/diagnostic +++ b/libs/ballot-interpreter/bin/diagnostic @@ -5,9 +5,9 @@ const fs = require('fs'); const { join } = require('path'); -if (!fs.existsSync(join(__dirname, '../build/hmpb-ts/rust_addon.node'))) { +if (!fs.existsSync(join(__dirname, '../build/addon.node'))) { process.stderr.write( - 'Error: native rust_addon has not been built. Please run `pnpm build` first.\n' + 'Error: native addon has not been built. Please run `pnpm build` first.\n' ); process.exit(1); } diff --git a/libs/ballot-interpreter/bin/interpret b/libs/ballot-interpreter/bin/interpret index eab94117d8..2b8a444e59 100755 --- a/libs/ballot-interpreter/bin/interpret +++ b/libs/ballot-interpreter/bin/interpret @@ -5,9 +5,9 @@ const fs = require('fs'); const { join } = require('path'); -if (!fs.existsSync(join(__dirname, '../build/hmpb-ts/rust_addon.node'))) { +if (!fs.existsSync(join(__dirname, '../build/addon.node'))) { process.stderr.write( - 'Error: native rust_addon has not been built. Please run `pnpm build` first.\n' + 'Error: native addon has not been built. Please run `pnpm build` first.\n' ); process.exit(1); } diff --git a/libs/ballot-interpreter/bin/scoring-report b/libs/ballot-interpreter/bin/scoring-report index c584b530f6..2d0f3dafb3 100755 --- a/libs/ballot-interpreter/bin/scoring-report +++ b/libs/ballot-interpreter/bin/scoring-report @@ -5,9 +5,9 @@ const fs = require('fs'); const { join } = require('path'); -if (!fs.existsSync(join(__dirname, '../build/hmpb-ts/rust_addon.node'))) { +if (!fs.existsSync(join(__dirname, '../build/addon.node'))) { process.stderr.write( - 'Error: native rust_addon has not been built. Please run `pnpm build` first.\n' + 'Error: native addon has not been built. Please run `pnpm build` first.\n' ); process.exit(1); } diff --git a/libs/ballot-interpreter/jest.config.js b/libs/ballot-interpreter/jest.config.js deleted file mode 100644 index 545cd53b0c..0000000000 --- a/libs/ballot-interpreter/jest.config.js +++ /dev/null @@ -1,23 +0,0 @@ -const shared = require('../../jest.config.shared'); - -/** - * @type {import('@jest/types').Config.InitialOptions} - */ -module.exports = { - ...shared, - coverageThreshold: { - global: { - branches: -5, - lines: -7, - }, - }, - setupFilesAfterEnv: ['/src/setupTests.ts'], - watchPathIgnorePatterns: [ - ...shared.watchPathIgnorePatterns, - '/benchmarks', - ], - coveragePathIgnorePatterns: [ - '/src/hmpb-ts/cli.ts', - '/src/hmpb-ts/diagnostic_cli.ts', - ], -}; diff --git a/libs/ballot-interpreter/package.json b/libs/ballot-interpreter/package.json index 30d12ba685..cd365096e6 100644 --- a/libs/ballot-interpreter/package.json +++ b/libs/ballot-interpreter/package.json @@ -10,10 +10,10 @@ "build" ], "scripts": { - "benchmark": "jest --runInBand --projects benchmarks", + "benchmark": "cd benchmarks && vitest", "build": "pnpm --filter $npm_package_name... build:self", "build:self": "pnpm install:rust-addon && pnpm build:rust-addon && pnpm build:ts", - "build:rust-addon": "cargo-cp-artifact -nc build/hmpb-ts/rust_addon.node -- cargo build --message-format=json-render-diagnostics --release --offline", + "build:rust-addon": "cargo-cp-artifact -nc build/addon.node -- cargo build --message-format=json-render-diagnostics --release --offline", "build:ts": "tsc --build tsconfig.build.json", "clean": "pnpm --filter $npm_package_name... clean:self", "clean:self": "cargo clean --release --package ballot-interpreter && rm -rf build && tsc --build --clean tsconfig.build.json", @@ -22,11 +22,11 @@ "lint:fix": "pnpm type-check && eslint . --fix", "pre-commit": "lint-staged", "test": "pnpm test:rust-addon && pnpm test:ts", - "test:ci": "pnpm build && pnpm test:ts:coverage --reporters=default --reporters=jest-junit --maxWorkers=6", + "test:ci": "pnpm build && pnpm test:ts:coverage --run", "test:rust-addon": "cargo test", "test:ts": "is-ci test:ci test:ts:watch", - "test:ts:coverage": "jest --coverage", - "test:ts:watch": "jest --watch", + "test:ts:coverage": "vitest --coverage", + "test:ts:watch": "vitest", "type-check": "tsc --build" }, "dependencies": { @@ -35,7 +35,7 @@ "@votingworks/fixtures": "workspace:*", "@votingworks/image-utils": "workspace:*", "@votingworks/qrdetect": "^1.0.1", - "@votingworks/test-utils": "workspace:*", + "@votingworks/test-utils-vitest": "workspace:*", "@votingworks/types": "workspace:*", "@votingworks/utils": "workspace:*", "better-sqlite3": "8.2.0", @@ -50,11 +50,11 @@ "@types/chalk": "^2.2.0", "@types/debug": "4.1.8", "@types/fs-extra": "11.0.1", - "@types/jest": "^29.5.3", "@types/jest-image-snapshot": "^6.4.0", "@types/node": "20.16.0", "@types/node-quirc": "workspace:*", "@types/tmp": "0.2.4", + "@vitest/coverage-istanbul": "^2.1.8", "@votingworks/bmd-ballot-fixtures": "workspace:*", "@votingworks/fs": "workspace:*", "@votingworks/hmpb": "workspace:*", @@ -64,13 +64,10 @@ "eslint-plugin-vx": "workspace:*", "fs-extra": "11.1.1", "is-ci-cli": "2.2.0", - "jest": "^29.6.2", "jest-image-snapshot": "^6.4.0", - "jest-junit": "^16.0.0", - "jest-watch-typeahead": "^2.2.2", "lint-staged": "11.0.0", "sort-package-json": "^1.50.0", - "ts-jest": "29.1.1" + "vitest": "^2.1.8" }, "packageManager": "pnpm@8.15.5" } diff --git a/libs/ballot-interpreter/src/__image_snapshots__/interpret-vx-hmpb-test-ts-hmpb-general-election-letter-paper-language-en-marked-ballot-interpretation-1-snap.png b/libs/ballot-interpreter/src/__image_snapshots__/interpret-vx-hmpb-test-mts-hmpb-general-election-letter-paper-language-en-marked-ballot-interpretation-1-snap.png similarity index 100% rename from libs/ballot-interpreter/src/__image_snapshots__/interpret-vx-hmpb-test-ts-hmpb-general-election-letter-paper-language-en-marked-ballot-interpretation-1-snap.png rename to libs/ballot-interpreter/src/__image_snapshots__/interpret-vx-hmpb-test-mts-hmpb-general-election-letter-paper-language-en-marked-ballot-interpretation-1-snap.png diff --git a/libs/ballot-interpreter/src/__snapshots__/interpret_bmd_ballots.test.ts.snap b/libs/ballot-interpreter/src/__snapshots__/interpret_bmd_ballots.test.mts.snap similarity index 96% rename from libs/ballot-interpreter/src/__snapshots__/interpret_bmd_ballots.test.ts.snap rename to libs/ballot-interpreter/src/__snapshots__/interpret_bmd_ballots.test.mts.snap index 04a24849d3..7147b2bd82 100644 --- a/libs/ballot-interpreter/src/__snapshots__/interpret_bmd_ballots.test.ts.snap +++ b/libs/ballot-interpreter/src/__snapshots__/interpret_bmd_ballots.test.mts.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`VX BMD interpretation extracts votes encoded in a QR code 1`] = ` +exports[`VX BMD interpretation > extracts votes encoded in a QR code 1`] = ` [ { "adjudicationInfo": { @@ -141,7 +141,7 @@ exports[`VX BMD interpretation extracts votes encoded in a QR code 1`] = ` ] `; -exports[`VX BMD interpretation interpretSimplexBmdBallot 1`] = ` +exports[`VX BMD interpretation > interpretSimplexBmdBallot 1`] = ` [ { "adjudicationInfo": { @@ -282,7 +282,7 @@ exports[`VX BMD interpretation interpretSimplexBmdBallot 1`] = ` ] `; -exports[`adjudication reporting correctly reports blank ballot adjudication flag 1`] = ` +exports[`adjudication reporting > correctly reports blank ballot adjudication flag 1`] = ` { "enabledReasonInfos": [ { @@ -418,7 +418,7 @@ exports[`adjudication reporting correctly reports blank ballot adjudication flag } `; -exports[`adjudication reporting ignores blank ballot adjudication flag when configured to do so 1`] = ` +exports[`adjudication reporting > ignores blank ballot adjudication flag when configured to do so 1`] = ` { "enabledReasonInfos": [ { @@ -554,7 +554,7 @@ exports[`adjudication reporting ignores blank ballot adjudication flag when conf } `; -exports[`adjudication reporting ignores undervote adjudication flag when configured to do so 1`] = ` +exports[`adjudication reporting > ignores undervote adjudication flag when configured to do so 1`] = ` [ { "contestId": "president", diff --git a/libs/ballot-interpreter/src/__snapshots__/interpret_nh_hmpb.test.ts.snap b/libs/ballot-interpreter/src/__snapshots__/interpret_nh_hmpb.test.mts.snap similarity index 96% rename from libs/ballot-interpreter/src/__snapshots__/interpret_nh_hmpb.test.ts.snap rename to libs/ballot-interpreter/src/__snapshots__/interpret_nh_hmpb.test.mts.snap index 07c31e9ccb..fe750f4580 100644 --- a/libs/ballot-interpreter/src/__snapshots__/interpret_nh_hmpb.test.ts.snap +++ b/libs/ballot-interpreter/src/__snapshots__/interpret_nh_hmpb.test.mts.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=04e81bd0-1cb6-4030-bc35-2ac549b25437 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=04e81bd0-1cb6-4030-bc35-2ac549b25437 1`] = ` { "04e81bd0-1cb6-4030-bc35-2ac549b25437": [ { @@ -62,7 +62,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=04e81bd0-1 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=05b4f778-4a9c-477f-bb7d-40ca98c280e9 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=05b4f778-4a9c-477f-bb7d-40ca98c280e9 1`] = ` { "05b4f778-4a9c-477f-bb7d-40ca98c280e9": [ { @@ -172,7 +172,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=05b4f778-4 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=060d4aba-9b70-43c3-80e0-1ac38dc129a6 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=060d4aba-9b70-43c3-80e0-1ac38dc129a6 1`] = ` { "060d4aba-9b70-43c3-80e0-1ac38dc129a6": [ { @@ -267,7 +267,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=060d4aba-9 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=0603e8df-6aa4-413c-b5cc-f2dadad9c441 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=0603e8df-6aa4-413c-b5cc-f2dadad9c441 1`] = ` { "0603e8df-6aa4-413c-b5cc-f2dadad9c441": [ { @@ -348,7 +348,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=0603e8df-6 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=0c802ae3-06f5-431b-8953-6368f93e71b1 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=0c802ae3-06f5-431b-8953-6368f93e71b1 1`] = ` { "0c802ae3-06f5-431b-8953-6368f93e71b1": [ { @@ -499,7 +499,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=0c802ae3-0 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=1d8eb82c-43bb-454d-a85b-1ffaf65c2b72 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=1d8eb82c-43bb-454d-a85b-1ffaf65c2b72 1`] = ` { "1d8eb82c-43bb-454d-a85b-1ffaf65c2b72": [ { @@ -611,7 +611,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=1d8eb82c-4 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=1e44bb3a-dfb3-4f70-9ed5-7da7548af1bd 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=1e44bb3a-dfb3-4f70-9ed5-7da7548af1bd 1`] = ` { "1e44bb3a-dfb3-4f70-9ed5-7da7548af1bd": [ { @@ -690,7 +690,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=1e44bb3a-d } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=3cb39cd0-6357-42ca-841a-b7c750d327b9 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=3cb39cd0-6357-42ca-841a-b7c750d327b9 1`] = ` { "3cb39cd0-6357-42ca-841a-b7c750d327b9": [ { @@ -761,7 +761,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=3cb39cd0-6 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=4b12014e-60c5-447c-bfde-98855d1feaea 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=4b12014e-60c5-447c-bfde-98855d1feaea 1`] = ` { "4b12014e-60c5-447c-bfde-98855d1feaea": [ { @@ -906,7 +906,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=4b12014e-6 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=4c7a63dc-3f16-434d-87bf-7ac31bd6caa0 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=4c7a63dc-3f16-434d-87bf-7ac31bd6caa0 1`] = ` { "4c7a63dc-3f16-434d-87bf-7ac31bd6caa0": [ { @@ -971,7 +971,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=4c7a63dc-3 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=4f054d5a-f890-4717-ae1e-5ddadf32a16b 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=4f054d5a-f890-4717-ae1e-5ddadf32a16b 1`] = ` { "4f054d5a-f890-4717-ae1e-5ddadf32a16b": [ { @@ -1074,7 +1074,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=4f054d5a-f } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=5dc43750-a2aa-4d46-ad1c-7a0e2cb4e2c1 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=5dc43750-a2aa-4d46-ad1c-7a0e2cb4e2c1 1`] = ` { "5dc43750-a2aa-4d46-ad1c-7a0e2cb4e2c1": [ { @@ -1244,7 +1244,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=5dc43750-a } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=6e229f1d-676e-4ced-bb8f-523793391001 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=6e229f1d-676e-4ced-bb8f-523793391001 1`] = ` { "6e229f1d-676e-4ced-bb8f-523793391001": [ { @@ -1333,7 +1333,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=6e229f1d-6 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=7a5f1429-a94b-44a8-80fc-c290b217e632 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=7a5f1429-a94b-44a8-80fc-c290b217e632 1`] = ` { "7a5f1429-a94b-44a8-80fc-c290b217e632": [ { @@ -1493,7 +1493,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=7a5f1429-a } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=7c29afa2-8b91-49c6-8292-db47d2d8a34c 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=7c29afa2-8b91-49c6-8292-db47d2d8a34c 1`] = ` { "7c29afa2-8b91-49c6-8292-db47d2d8a34c": [ { @@ -1617,7 +1617,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=7c29afa2-8 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=7cd316f5-9775-49a2-a8ac-3da46c30add3 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=7cd316f5-9775-49a2-a8ac-3da46c30add3 1`] = ` { "7cd316f5-9775-49a2-a8ac-3da46c30add3": [ { @@ -1688,7 +1688,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=7cd316f5-9 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=7cd12878-7c65-4d81-8cc6-45a4238df0a8 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=7cd12878-7c65-4d81-8cc6-45a4238df0a8 1`] = ` { "7cd12878-7c65-4d81-8cc6-45a4238df0a8": [ { @@ -1777,7 +1777,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=7cd12878-7 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=7dfff758-2f99-467e-b1d9-b590d871ae0b 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=7dfff758-2f99-467e-b1d9-b590d871ae0b 1`] = ` { "7dfff758-2f99-467e-b1d9-b590d871ae0b": [ { @@ -1872,7 +1872,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=7dfff758-2 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=8a7625a3-950f-4346-aad2-e904b1a9cba2 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=8a7625a3-950f-4346-aad2-e904b1a9cba2 1`] = ` { "8a7625a3-950f-4346-aad2-e904b1a9cba2": [ { @@ -1991,7 +1991,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=8a7625a3-9 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=8c5ea5a3-9d17-4895-96b4-ab803d39bd3f 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=8c5ea5a3-9d17-4895-96b4-ab803d39bd3f 1`] = ` { "8c5ea5a3-9d17-4895-96b4-ab803d39bd3f": [ { @@ -2115,7 +2115,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=8c5ea5a3-9 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=8d50bac9-d511-48b3-9e1f-af9c7d85b7a8 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=8d50bac9-d511-48b3-9e1f-af9c7d85b7a8 1`] = ` { "8d50bac9-d511-48b3-9e1f-af9c7d85b7a8": [ { @@ -2188,7 +2188,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=8d50bac9-d } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=8e6a152e-7986-4ff1-b52d-a89d52d240f6 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=8e6a152e-7986-4ff1-b52d-a89d52d240f6 1`] = ` { "8e6a152e-7986-4ff1-b52d-a89d52d240f6": [ { @@ -2358,7 +2358,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=8e6a152e-7 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=9f5ee84a-5da0-4a80-bc1e-5ea0e2cf4e34 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=9f5ee84a-5da0-4a80-bc1e-5ea0e2cf4e34 1`] = ` { "9f5ee84a-5da0-4a80-bc1e-5ea0e2cf4e34": [ { @@ -2532,7 +2532,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=9f5ee84a-5 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=12ee4c7c-fe40-4492-94ca-75bcf6db9f18 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=12ee4c7c-fe40-4492-94ca-75bcf6db9f18 1`] = ` { "12ee4c7c-fe40-4492-94ca-75bcf6db9f18": [ { @@ -2597,7 +2597,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=12ee4c7c-f } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=12effe84-6be5-481b-b70d-5a5df4b049e7 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=12effe84-6be5-481b-b70d-5a5df4b049e7 1`] = ` { "12effe84-6be5-481b-b70d-5a5df4b049e7": [ { @@ -2646,7 +2646,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=12effe84-6 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=21e0d2db-0f44-4a23-ac08-2eec70851df5 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=21e0d2db-0f44-4a23-ac08-2eec70851df5 1`] = ` { "21e0d2db-0f44-4a23-ac08-2eec70851df5": [ { @@ -2797,7 +2797,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=21e0d2db-0 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=22c0ab78-020b-4535-b231-5b5177581265 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=22c0ab78-020b-4535-b231-5b5177581265 1`] = ` { "22c0ab78-020b-4535-b231-5b5177581265": [ { @@ -2870,7 +2870,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=22c0ab78-0 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=32e0764e-e0b1-4275-b5bd-e6e9f1b504fc 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=32e0764e-e0b1-4275-b5bd-e6e9f1b504fc 1`] = ` { "32e0764e-e0b1-4275-b5bd-e6e9f1b504fc": [ { @@ -3026,7 +3026,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=32e0764e-e } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=40ce9cdc-42c3-4932-bb2d-46aa782629e8 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=40ce9cdc-42c3-4932-bb2d-46aa782629e8 1`] = ` { "40ce9cdc-42c3-4932-bb2d-46aa782629e8": [ { @@ -3123,7 +3123,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=40ce9cdc-4 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=46f9490e-5717-4c56-92e5-37c1f1a971c2 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=46f9490e-5717-4c56-92e5-37c1f1a971c2 1`] = ` { "46f9490e-5717-4c56-92e5-37c1f1a971c2": [ { @@ -3266,7 +3266,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=46f9490e-5 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=47cda523-a05a-439d-8519-ce077cf781f3 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=47cda523-a05a-439d-8519-ce077cf781f3 1`] = ` { "47cda523-a05a-439d-8519-ce077cf781f3": [ { @@ -3375,7 +3375,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=47cda523-a } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=50d8aa5e-2a3b-47e3-813d-075be04ebb6e 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=50d8aa5e-2a3b-47e3-813d-075be04ebb6e 1`] = ` { "50d8aa5e-2a3b-47e3-813d-075be04ebb6e": [ { @@ -3439,7 +3439,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=50d8aa5e-2 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=55a65b48-69ce-4b44-a582-736b492bb10c 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=55a65b48-69ce-4b44-a582-736b492bb10c 1`] = ` { "55a65b48-69ce-4b44-a582-736b492bb10c": [ { @@ -3528,7 +3528,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=55a65b48-6 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=85cde9ce-edc4-41eb-b1cd-280c63a46474 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=85cde9ce-edc4-41eb-b1cd-280c63a46474 1`] = ` { "85cde9ce-edc4-41eb-b1cd-280c63a46474": [ { @@ -3599,7 +3599,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=85cde9ce-e } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=97af3ccb-dd18-406f-aea2-e0a7af30c11c 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=97af3ccb-dd18-406f-aea2-e0a7af30c11c 1`] = ` { "97af3ccb-dd18-406f-aea2-e0a7af30c11c": [ { @@ -3707,7 +3707,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=97af3ccb-d } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=97c8dd4a-52ec-4d16-a843-5a5bdf22d6f3 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=97c8dd4a-52ec-4d16-a843-5a5bdf22d6f3 1`] = ` { "97c8dd4a-52ec-4d16-a843-5a5bdf22d6f3": [ { @@ -3763,7 +3763,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=97c8dd4a-5 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=99b486dd-9507-4c82-87c8-67bba43b4e1b 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=99b486dd-9507-4c82-87c8-67bba43b4e1b 1`] = ` { "99b486dd-9507-4c82-87c8-67bba43b4e1b": [ { @@ -3903,7 +3903,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=99b486dd-9 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=227e070a-53e5-4409-a89d-cec7e8c45c7d 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=227e070a-53e5-4409-a89d-cec7e8c45c7d 1`] = ` { "227e070a-53e5-4409-a89d-cec7e8c45c7d": [ { @@ -3981,7 +3981,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=227e070a-5 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=381da8b3-cb46-4f1e-8511-814d892a05f3 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=381da8b3-cb46-4f1e-8511-814d892a05f3 1`] = ` { "381da8b3-cb46-4f1e-8511-814d892a05f3": [ { @@ -4054,7 +4054,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=381da8b3-c } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=524a09ad-b366-4d3f-8399-763ea31bf357 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=524a09ad-b366-4d3f-8399-763ea31bf357 1`] = ` { "524a09ad-b366-4d3f-8399-763ea31bf357": [ { @@ -4119,7 +4119,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=524a09ad-b } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=759fee43-9f63-4550-ba2d-eec22fa6fb0d 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=759fee43-9f63-4550-ba2d-eec22fa6fb0d 1`] = ` { "759fee43-9f63-4550-ba2d-eec22fa6fb0d": [ { @@ -4192,7 +4192,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=759fee43-9 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=786f4868-0d0a-45cd-b193-42a9c3553d30 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=786f4868-0d0a-45cd-b193-42a9c3553d30 1`] = ` { "786f4868-0d0a-45cd-b193-42a9c3553d30": [ { @@ -4262,7 +4262,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=786f4868-0 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=913c814b-f170-4427-8049-76d322b3eee3 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=913c814b-f170-4427-8049-76d322b3eee3 1`] = ` { "913c814b-f170-4427-8049-76d322b3eee3": [ { @@ -4430,7 +4430,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=913c814b-f } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=4483d72e-ea62-4698-b8f7-e24911a72a5b 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=4483d72e-ea62-4698-b8f7-e24911a72a5b 1`] = ` { "4483d72e-ea62-4698-b8f7-e24911a72a5b": [ { @@ -4598,7 +4598,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=4483d72e-e } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=4653ca16-0f5c-4968-8390-f6297f2c278c 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=4653ca16-0f5c-4968-8390-f6297f2c278c 1`] = ` { "4653ca16-0f5c-4968-8390-f6297f2c278c": [ { @@ -4674,7 +4674,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=4653ca16-0 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=7527d2a4-1cde-4f8f-ae08-7f95de165192 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=7527d2a4-1cde-4f8f-ae08-7f95de165192 1`] = ` { "7527d2a4-1cde-4f8f-ae08-7f95de165192": [ { @@ -4844,7 +4844,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=7527d2a4-1 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=62385dba-db90-442a-b089-fb41d1f42eea 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=62385dba-db90-442a-b089-fb41d1f42eea 1`] = ` { "62385dba-db90-442a-b089-fb41d1f42eea": [ { @@ -4998,7 +4998,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=62385dba-d } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=346698d4-e4fa-4f9f-956d-2e86a0150673 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=346698d4-e4fa-4f9f-956d-2e86a0150673 1`] = ` { "346698d4-e4fa-4f9f-956d-2e86a0150673": [ { @@ -5094,7 +5094,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=346698d4-e } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=672353df-27cb-4e5a-8b6a-de0b90f8a28d 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=672353df-27cb-4e5a-8b6a-de0b90f8a28d 1`] = ` { "672353df-27cb-4e5a-8b6a-de0b90f8a28d": [ { @@ -5183,7 +5183,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=672353df-2 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=8978016e-2585-49bc-9bfb-2852a473a11d 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=8978016e-2585-49bc-9bfb-2852a473a11d 1`] = ` { "8978016e-2585-49bc-9bfb-2852a473a11d": [ { @@ -5240,7 +5240,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=8978016e-2 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=30950612-8e0b-4934-a7b9-5e2190724afe 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=30950612-8e0b-4934-a7b9-5e2190724afe 1`] = ` { "30950612-8e0b-4934-a7b9-5e2190724afe": [ { @@ -5327,7 +5327,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=30950612-8 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=53884725-3c74-49ba-86b9-932e1177ec10 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=53884725-3c74-49ba-86b9-932e1177ec10 1`] = ` { "53884725-3c74-49ba-86b9-932e1177ec10": [ { @@ -5451,7 +5451,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=53884725-3 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=72547548-e08e-48fa-a8f9-d36560c43125 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=72547548-e08e-48fa-a8f9-d36560c43125 1`] = ` { "72547548-e08e-48fa-a8f9-d36560c43125": [ { @@ -5618,7 +5618,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=72547548-e } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=a7cbd4bb-9ca8-4001-ab5e-f0f5eb30d360 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=a7cbd4bb-9ca8-4001-ab5e-f0f5eb30d360 1`] = ` { "a7cbd4bb-9ca8-4001-ab5e-f0f5eb30d360": [ { @@ -5778,7 +5778,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=a7cbd4bb-9 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=adb431f9-4fd9-41f2-8f13-14d198a92dfe 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=adb431f9-4fd9-41f2-8f13-14d198a92dfe 1`] = ` { "adb431f9-4fd9-41f2-8f13-14d198a92dfe": [ { @@ -5872,7 +5872,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=adb431f9-4 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=af6d30a5-958c-4c08-884a-30c1d1a52416 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=af6d30a5-958c-4c08-884a-30c1d1a52416 1`] = ` { "af6d30a5-958c-4c08-884a-30c1d1a52416": [ { @@ -6031,7 +6031,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=af6d30a5-9 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=b36f2116-5290-4509-b53c-015895333e1a 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=b36f2116-5290-4509-b53c-015895333e1a 1`] = ` { "b36f2116-5290-4509-b53c-015895333e1a": [ { @@ -6095,7 +6095,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=b36f2116-5 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=b57e8748-f761-46c6-9da5-acd4cafd654e 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=b57e8748-f761-46c6-9da5-acd4cafd654e 1`] = ` { "b57e8748-f761-46c6-9da5-acd4cafd654e": [ { @@ -6254,7 +6254,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=b57e8748-f } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=bc1c384d-23ec-4358-b5ba-83ed457feabe 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=bc1c384d-23ec-4358-b5ba-83ed457feabe 1`] = ` { "bc1c384d-23ec-4358-b5ba-83ed457feabe": [ { @@ -6332,7 +6332,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=bc1c384d-2 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=bf365d83-4e7a-4708-92c8-e3b092a4f26a 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=bf365d83-4e7a-4708-92c8-e3b092a4f26a 1`] = ` { "bf365d83-4e7a-4708-92c8-e3b092a4f26a": [ { @@ -6396,7 +6396,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=bf365d83-4 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=c8b3565d-d8e2-4b13-9ada-10aba6e25327 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=c8b3565d-d8e2-4b13-9ada-10aba6e25327 1`] = ` { "c8b3565d-d8e2-4b13-9ada-10aba6e25327": [ { @@ -6501,7 +6501,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=c8b3565d-d } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=c59ef524-893f-4cf8-8678-14103f1286de 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=c59ef524-893f-4cf8-8678-14103f1286de 1`] = ` { "c59ef524-893f-4cf8-8678-14103f1286de": [ { @@ -6663,7 +6663,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=c59ef524-8 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=c336275b-921b-4d25-9463-ddaf6b1f2210 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=c336275b-921b-4d25-9463-ddaf6b1f2210 1`] = ` { "c336275b-921b-4d25-9463-ddaf6b1f2210": [ { @@ -6744,7 +6744,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=c336275b-9 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=ccdad2d3-ef7c-402d-8b9a-593988722583 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=ccdad2d3-ef7c-402d-8b9a-593988722583 1`] = ` { "ccdad2d3-ef7c-402d-8b9a-593988722583": [ { @@ -6807,7 +6807,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=ccdad2d3-e } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=cd113cfc-2393-4cf1-889d-7bfca2b17cad 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=cd113cfc-2393-4cf1-889d-7bfca2b17cad 1`] = ` { "cd113cfc-2393-4cf1-889d-7bfca2b17cad": [ { @@ -6919,7 +6919,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=cd113cfc-2 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=d5be8dd6-46d1-4ce4-b906-3bfc61bcfad6 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=d5be8dd6-46d1-4ce4-b906-3bfc61bcfad6 1`] = ` { "d5be8dd6-46d1-4ce4-b906-3bfc61bcfad6": [ { @@ -7000,7 +7000,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=d5be8dd6-4 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=d9c7eaae-79f8-4c8a-b2d2-f47b5768fd3a 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=d9c7eaae-79f8-4c8a-b2d2-f47b5768fd3a 1`] = ` { "d9c7eaae-79f8-4c8a-b2d2-f47b5768fd3a": [ { @@ -7049,7 +7049,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=d9c7eaae-7 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=d24bf705-40ef-4da3-a9b0-4d2f21924db6 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=d24bf705-40ef-4da3-a9b0-4d2f21924db6 1`] = ` { "d24bf705-40ef-4da3-a9b0-4d2f21924db6": [ { @@ -7174,7 +7174,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=d24bf705-4 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=e61e3d7a-a060-41a2-b14e-c7bffd0a6960 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=e61e3d7a-a060-41a2-b14e-c7bffd0a6960 1`] = ` { "e61e3d7a-a060-41a2-b14e-c7bffd0a6960": [ { @@ -7292,7 +7292,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=e61e3d7a-a } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=ed1dd8cb-257e-48de-b4bf-95e293fbf57f 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=ed1dd8cb-257e-48de-b4bf-95e293fbf57f 1`] = ` { "ed1dd8cb-257e-48de-b4bf-95e293fbf57f": [ { @@ -7385,7 +7385,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=ed1dd8cb-2 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=edd42fb9-83b6-4df0-96d5-7b193f11e970 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=edd42fb9-83b6-4df0-96d5-7b193f11e970 1`] = ` { "edd42fb9-83b6-4df0-96d5-7b193f11e970": [ { @@ -7449,7 +7449,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=edd42fb9-8 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=ee64f4eb-9ea3-48a3-a50d-6ef5f91251da 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=ee64f4eb-9ea3-48a3-a50d-6ef5f91251da 1`] = ` { "ee64f4eb-9ea3-48a3-a50d-6ef5f91251da": [ { @@ -7498,7 +7498,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=ee64f4eb-9 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=f1a1a561-52ee-4750-82f7-88cef012b451 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=f1a1a561-52ee-4750-82f7-88cef012b451 1`] = ` { "f1a1a561-52ee-4750-82f7-88cef012b451": [ { @@ -7555,7 +7555,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=f1a1a561-5 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=f55cca96-7b2f-47b2-8457-092db1e17e20 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=f55cca96-7b2f-47b2-8457-092db1e17e20 1`] = ` { "f55cca96-7b2f-47b2-8457-092db1e17e20": [ { @@ -7724,7 +7724,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=f55cca96-7 } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=fa5d9338-fd91-4936-88e7-a16b294caa12 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=fa5d9338-fd91-4936-88e7-a16b294caa12 1`] = ` { "fa5d9338-fd91-4936-88e7-a16b294caa12": [ { @@ -7840,7 +7840,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=fa5d9338-f } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=fc7db095-ce91-4d6c-8a05-53b2930ec583 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=fc7db095-ce91-4d6c-8a05-53b2930ec583 1`] = ` { "fc7db095-ce91-4d6c-8a05-53b2930ec583": [ { @@ -7917,7 +7917,7 @@ exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=fc7db095-c } `; -exports[`HMPB - m17 backup Interprets all ballots correctly: ballotId=fda1aa08-52b4-4364-b537-990666219558 1`] = ` +exports[`HMPB - m17 backup > Interprets all ballots correctly: ballotId=fda1aa08-52b4-4364-b537-990666219558 1`] = ` { "fda1aa08-52b4-4364-b537-990666219558": [ { diff --git a/libs/ballot-interpreter/src/adjudication_reasons.test.ts b/libs/ballot-interpreter/src/adjudication_reasons.test.mts similarity index 99% rename from libs/ballot-interpreter/src/adjudication_reasons.test.ts rename to libs/ballot-interpreter/src/adjudication_reasons.test.mts index df9343acb6..e18077ad92 100644 --- a/libs/ballot-interpreter/src/adjudication_reasons.test.ts +++ b/libs/ballot-interpreter/src/adjudication_reasons.test.mts @@ -1,3 +1,4 @@ +import { describe, expect, test } from 'vitest'; import { AdjudicationReason, AdjudicationReasonInfo, @@ -14,7 +15,7 @@ import { allContestOptions } from '@votingworks/utils'; import { getAllPossibleAdjudicationReasons, adjudicationReasonDescription, -} from './adjudication_reasons'; +} from './adjudication_reasons.js'; const bestAnimalMammal = electionTwoPartyPrimaryDefinition.election.contests.find( diff --git a/libs/ballot-interpreter/src/bmd/__image_snapshots__/interpret-test-tsx-happy-path-back-front-upside-down-2-snap.png b/libs/ballot-interpreter/src/bmd/__image_snapshots__/interpret-test-mts-happy-path-back-front-upside-down-2-snap.png similarity index 100% rename from libs/ballot-interpreter/src/bmd/__image_snapshots__/interpret-test-tsx-happy-path-back-front-upside-down-2-snap.png rename to libs/ballot-interpreter/src/bmd/__image_snapshots__/interpret-test-mts-happy-path-back-front-upside-down-2-snap.png diff --git a/libs/ballot-interpreter/src/bmd/__image_snapshots__/interpret-test-tsx-happy-path-front-upside-down-back-2-snap.png b/libs/ballot-interpreter/src/bmd/__image_snapshots__/interpret-test-mts-happy-path-front-upside-down-back-2-snap.png similarity index 100% rename from libs/ballot-interpreter/src/bmd/__image_snapshots__/interpret-test-tsx-happy-path-front-upside-down-back-2-snap.png rename to libs/ballot-interpreter/src/bmd/__image_snapshots__/interpret-test-mts-happy-path-front-upside-down-back-2-snap.png diff --git a/libs/ballot-interpreter/src/bmd/__snapshots__/interpret.test.tsx.snap b/libs/ballot-interpreter/src/bmd/__snapshots__/interpret.test.mts.snap similarity index 99% rename from libs/ballot-interpreter/src/bmd/__snapshots__/interpret.test.tsx.snap rename to libs/ballot-interpreter/src/bmd/__snapshots__/interpret.test.mts.snap index 55370abf7b..3a6a657f98 100644 --- a/libs/ballot-interpreter/src/bmd/__snapshots__/interpret.test.tsx.snap +++ b/libs/ballot-interpreter/src/bmd/__snapshots__/interpret.test.mts.snap @@ -1,4 +1,4 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`happy path: back, front 1`] = ` { diff --git a/libs/ballot-interpreter/src/bmd/interpret.test.tsx b/libs/ballot-interpreter/src/bmd/interpret.test.mts similarity index 98% rename from libs/ballot-interpreter/src/bmd/interpret.test.tsx rename to libs/ballot-interpreter/src/bmd/interpret.test.mts index 7f9c9381db..666f6b4b4a 100644 --- a/libs/ballot-interpreter/src/bmd/interpret.test.tsx +++ b/libs/ballot-interpreter/src/bmd/interpret.test.mts @@ -1,3 +1,4 @@ +import { beforeAll, expect, test } from 'vitest'; import { sliceBallotHashForEncoding } from '@votingworks/ballot-encoder'; import { assert, err } from '@votingworks/basics'; import { @@ -13,8 +14,8 @@ import { DEFAULT_FAMOUS_NAMES_VOTES, } from '@votingworks/bmd-ballot-fixtures'; import { ImageData, createCanvas } from 'canvas'; -import { InterpretResult, interpret } from './interpret'; -import { pdfToPageImages } from '../../test/helpers/interpretation'; +import { InterpretResult, interpret } from './interpret.js'; +import { pdfToPageImages } from '../../test/helpers/interpretation.mjs'; let famousNamesBmdBallot: SheetOf; let famousNamesBmdBallotUpsideDown: SheetOf; diff --git a/libs/ballot-interpreter/src/bmd/utils/qrcode.test.ts b/libs/ballot-interpreter/src/bmd/utils/qrcode.test.mts similarity index 97% rename from libs/ballot-interpreter/src/bmd/utils/qrcode.test.ts rename to libs/ballot-interpreter/src/bmd/utils/qrcode.test.mts index b22521a5c4..a01f51f1c8 100644 --- a/libs/ballot-interpreter/src/bmd/utils/qrcode.test.ts +++ b/libs/ballot-interpreter/src/bmd/utils/qrcode.test.mts @@ -1,3 +1,4 @@ +import { expect, test } from 'vitest'; import { Buffer } from 'node:buffer'; import { err, ok } from '@votingworks/basics'; import { @@ -5,8 +6,8 @@ import { sampleBallotImages, } from '@votingworks/fixtures'; import { renderBmdBallotFixture } from '@votingworks/bmd-ballot-fixtures'; -import { QrCodePageResult, detectInBallot, getSearchAreas } from './qrcode'; -import { pdfToPageImages } from '../../../test/helpers/interpretation'; +import { QrCodePageResult, detectInBallot, getSearchAreas } from './qrcode.js'; +import { pdfToPageImages } from '../../../test/helpers/interpretation.mjs'; test('does not find QR codes when there are none to find', async () => { const detectResult = await detectInBallot( diff --git a/libs/ballot-interpreter/src/bmd/utils/rotate.test.ts b/libs/ballot-interpreter/src/bmd/utils/rotate.test.mts similarity index 95% rename from libs/ballot-interpreter/src/bmd/utils/rotate.test.ts rename to libs/ballot-interpreter/src/bmd/utils/rotate.test.mts index 0fbe297b3e..87be28d846 100644 --- a/libs/ballot-interpreter/src/bmd/utils/rotate.test.ts +++ b/libs/ballot-interpreter/src/bmd/utils/rotate.test.mts @@ -1,7 +1,8 @@ +import { test } from 'vitest'; import { assert } from '@votingworks/basics'; import { sampleBallotImages } from '@votingworks/fixtures'; import { ImageData } from 'canvas'; -import { rotateImageData180 } from './rotate'; +import { rotateImageData180 } from './rotate.js'; test('can rotate real life ImageData as expected', async () => { const rotatedImageData = await sampleBallotImages.notBallot.asImageData(); diff --git a/libs/ballot-interpreter/src/hmpb-ts/__snapshots__/interpret.test.ts.snap b/libs/ballot-interpreter/src/hmpb-ts/__snapshots__/interpret.test.mts.snap similarity index 99% rename from libs/ballot-interpreter/src/hmpb-ts/__snapshots__/interpret.test.ts.snap rename to libs/ballot-interpreter/src/hmpb-ts/__snapshots__/interpret.test.mts.snap index b6a30406ef..a908d02e39 100644 --- a/libs/ballot-interpreter/src/hmpb-ts/__snapshots__/interpret.test.ts.snap +++ b/libs/ballot-interpreter/src/hmpb-ts/__snapshots__/interpret.test.mts.snap @@ -1,4 +1,4 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`interpret \`ImageData\` objects 1`] = ` [ diff --git a/libs/ballot-interpreter/src/hmpb-ts/rust_addon.d.ts b/libs/ballot-interpreter/src/hmpb-ts/addon.ts similarity index 55% rename from libs/ballot-interpreter/src/hmpb-ts/rust_addon.d.ts rename to libs/ballot-interpreter/src/hmpb-ts/addon.ts index 777ce7b164..6619d4fd33 100644 --- a/libs/ballot-interpreter/src/hmpb-ts/rust_addon.d.ts +++ b/libs/ballot-interpreter/src/hmpb-ts/addon.ts @@ -1,7 +1,22 @@ import { Election } from '@votingworks/types'; import { ImageData } from 'canvas'; +import { createRequire } from 'node:module'; +import { join } from 'node:path'; import { type TemplateGridAndBubbles } from './find_template_grid_and_bubbles'; +const addon = (() => { + // NOTE: this only works because the build output can get to the root of the + // project in the same number of `../` as the source input: + // + // src/hmpb-ts/addon.ts -> build/addon.node via `../../build/addon.node` + // build/hmpb-ts/addon.js -> build/addon.node via `../../build/addon.node` + // + const require = createRequire(__filename); + const root = join(__dirname, '../..'); + // eslint-disable-next-line import/no-dynamic-require + return require(join(root, 'build', 'addon.node')); +})(); + /** * The result of calling `interpret`. */ @@ -32,7 +47,16 @@ export function interpret( scoreWriteIns?: boolean; disableVerticalStreakDetection?: boolean; } -): BridgeInterpretResult; +): BridgeInterpretResult { + return addon.interpret( + election, + ballotImageSourceSideA, + ballotImageSourceSideB, + debugBasePathSideA, + debugBasePathSideB, + options + ); +} /** * Type of the Rust `findTemplateGridAndBubbles` implementation. @@ -40,9 +64,16 @@ export function interpret( export function findTemplateGridAndBubbles( ballotImageSourceSideA: string | ImageData, ballotImageSourceSideB: string | ImageData -): TemplateGridAndBubbles; +): TemplateGridAndBubbles { + return addon.findTemplateGridAndBubbles( + ballotImageSourceSideA, + ballotImageSourceSideB + ); +} export function runBlankPaperDiagnostic( image: string | ImageData, debugBasePath?: string -): boolean; +): boolean { + return addon.runBlankPaperDiagnostic(image, debugBasePath); +} diff --git a/libs/ballot-interpreter/src/hmpb-ts/cli.test.ts b/libs/ballot-interpreter/src/hmpb-ts/cli.test.mts similarity index 92% rename from libs/ballot-interpreter/src/hmpb-ts/cli.test.ts rename to libs/ballot-interpreter/src/hmpb-ts/cli.test.mts index 1ec147a2b2..80aece5de6 100644 --- a/libs/ballot-interpreter/src/hmpb-ts/cli.test.ts +++ b/libs/ballot-interpreter/src/hmpb-ts/cli.test.mts @@ -1,3 +1,4 @@ +import { expect, test } from 'vitest'; import { electionGridLayoutNewHampshireTestBallotFixtures } from '@votingworks/fixtures'; import { DEFAULT_SYSTEM_SETTINGS } from '@votingworks/types'; import { dirSync, fileSync } from 'tmp'; @@ -5,8 +6,8 @@ import { mkdir, writeFile } from 'node:fs/promises'; import { integers, iter } from '@votingworks/basics'; import { randomUUID } from 'node:crypto'; import { join } from 'node:path'; -import { mockWritable } from '@votingworks/test-utils'; -import { main } from './cli'; +import { mockWritable } from '@votingworks/test-utils-vitest'; +import { main } from './cli.js'; test('interpret CVRs', async () => { const rootDir = dirSync().name; diff --git a/libs/ballot-interpreter/src/hmpb-ts/debug.test.ts b/libs/ballot-interpreter/src/hmpb-ts/debug.test.mts similarity index 93% rename from libs/ballot-interpreter/src/hmpb-ts/debug.test.ts rename to libs/ballot-interpreter/src/hmpb-ts/debug.test.mts index f87b15e71c..ab65d8776f 100644 --- a/libs/ballot-interpreter/src/hmpb-ts/debug.test.ts +++ b/libs/ballot-interpreter/src/hmpb-ts/debug.test.mts @@ -1,14 +1,12 @@ +import { beforeAll, expect, test, vi } from 'vitest'; import { ImageData } from 'canvas'; import { electionGridLayoutNewHampshireTestBallotFixtures } from '@votingworks/fixtures'; -import { interpret as interpretImpl } from './rust_addon'; -import { interpret } from './interpret'; +import * as addon from './addon.js'; +import { interpret } from './interpret.js'; -jest.mock('./rust_addon'); - -const interpretImplMock = interpretImpl as jest.MockedFunction< - typeof interpretImpl ->; +vi.mock('./addon.js'); +const interpretImplMock = vi.mocked(addon.interpret); let frontImageData!: ImageData; let backImageData!: ImageData; diff --git a/libs/ballot-interpreter/src/hmpb-ts/diagnostic.test.ts b/libs/ballot-interpreter/src/hmpb-ts/diagnostic.test.mts similarity index 84% rename from libs/ballot-interpreter/src/hmpb-ts/diagnostic.test.ts rename to libs/ballot-interpreter/src/hmpb-ts/diagnostic.test.mts index 4598dd52e0..e0d10b57a5 100644 --- a/libs/ballot-interpreter/src/hmpb-ts/diagnostic.test.ts +++ b/libs/ballot-interpreter/src/hmpb-ts/diagnostic.test.mts @@ -1,5 +1,6 @@ +import { expect, test } from 'vitest'; import { join } from 'node:path'; -import { runBlankPaperDiagnostic } from './diagnostic'; +import { runBlankPaperDiagnostic } from './diagnostic.js'; test('runBlankPaperDiagnostic can pass', () => { expect( diff --git a/libs/ballot-interpreter/src/hmpb-ts/diagnostic.ts b/libs/ballot-interpreter/src/hmpb-ts/diagnostic.ts index be9737571b..fa00a18ad1 100644 --- a/libs/ballot-interpreter/src/hmpb-ts/diagnostic.ts +++ b/libs/ballot-interpreter/src/hmpb-ts/diagnostic.ts @@ -1,4 +1,4 @@ -import { runBlankPaperDiagnostic as runBlankPaperDiagnosticImpl } from './rust_addon'; +import { runBlankPaperDiagnostic as runBlankPaperDiagnosticImpl } from './addon'; /** * Runs a diagnostic on a blank paper image to determine if it is a valid diff --git a/libs/ballot-interpreter/src/hmpb-ts/find_template_grid_and_bubbles.test.ts b/libs/ballot-interpreter/src/hmpb-ts/find_template_grid_and_bubbles.test.mts similarity index 92% rename from libs/ballot-interpreter/src/hmpb-ts/find_template_grid_and_bubbles.test.ts rename to libs/ballot-interpreter/src/hmpb-ts/find_template_grid_and_bubbles.test.mts index 8ac40d0bba..af47114111 100644 --- a/libs/ballot-interpreter/src/hmpb-ts/find_template_grid_and_bubbles.test.ts +++ b/libs/ballot-interpreter/src/hmpb-ts/find_template_grid_and_bubbles.test.mts @@ -1,3 +1,4 @@ +import { expect, test } from 'vitest'; import { ImageData } from 'canvas'; import { err } from '@votingworks/basics'; import { @@ -5,8 +6,8 @@ import { sampleBallotImages, } from '@votingworks/fixtures'; import { SheetOf } from '@votingworks/types'; -import { findTemplateGridAndBubbles } from './find_template_grid_and_bubbles'; -import { TimingMarkGrid } from './types'; +import { findTemplateGridAndBubbles } from './find_template_grid_and_bubbles.js'; +import { TimingMarkGrid } from './types.js'; test('find layout from template images', async () => { const ballotImages: SheetOf = [ diff --git a/libs/ballot-interpreter/src/hmpb-ts/find_template_grid_and_bubbles.ts b/libs/ballot-interpreter/src/hmpb-ts/find_template_grid_and_bubbles.ts index 64fcd55e48..a77618ae0d 100644 --- a/libs/ballot-interpreter/src/hmpb-ts/find_template_grid_and_bubbles.ts +++ b/libs/ballot-interpreter/src/hmpb-ts/find_template_grid_and_bubbles.ts @@ -1,7 +1,7 @@ import { ImageData } from 'canvas'; import { Result, err, ok } from '@votingworks/basics'; import { SheetOf } from '@votingworks/types'; -import { findTemplateGridAndBubbles as findTemplateGridAndBubblesImpl } from './rust_addon'; +import { findTemplateGridAndBubbles as findTemplateGridAndBubblesImpl } from './addon'; import { BallotPageTimingMarkMetadata, Point, diff --git a/libs/ballot-interpreter/src/hmpb-ts/interpret.test.ts b/libs/ballot-interpreter/src/hmpb-ts/interpret.test.mts similarity index 99% rename from libs/ballot-interpreter/src/hmpb-ts/interpret.test.ts rename to libs/ballot-interpreter/src/hmpb-ts/interpret.test.mts index 6281974b4c..7f6fdd8de5 100644 --- a/libs/ballot-interpreter/src/hmpb-ts/interpret.test.ts +++ b/libs/ballot-interpreter/src/hmpb-ts/interpret.test.mts @@ -1,8 +1,9 @@ +import { expect, test } from 'vitest'; import { assertDefined, iter, ok, unique } from '@votingworks/basics'; import { ImageData } from 'canvas'; import { electionGridLayoutNewHampshireTestBallotFixtures } from '@votingworks/fixtures'; import { Election, ElectionDefinition, SheetOf } from '@votingworks/types'; -import { interpret } from './interpret'; +import { interpret } from './interpret.js'; test('interpret exists', () => { expect(interpret).toBeDefined(); diff --git a/libs/ballot-interpreter/src/hmpb-ts/interpret.ts b/libs/ballot-interpreter/src/hmpb-ts/interpret.ts index 6037362972..d70deaa663 100644 --- a/libs/ballot-interpreter/src/hmpb-ts/interpret.ts +++ b/libs/ballot-interpreter/src/hmpb-ts/interpret.ts @@ -1,7 +1,7 @@ import { assert, err, ok } from '@votingworks/basics'; import { ImageData } from 'canvas'; import { ElectionDefinition, safeParseJson, SheetOf } from '@votingworks/types'; -import { interpret as interpretImpl } from './rust_addon'; +import { interpret as interpretImpl } from './addon'; import { InterpretedBallotCard, InterpretError, diff --git a/libs/ballot-interpreter/src/hmpb-ts/rust_addon.node b/libs/ballot-interpreter/src/hmpb-ts/rust_addon.node deleted file mode 120000 index 380e1b7135..0000000000 --- a/libs/ballot-interpreter/src/hmpb-ts/rust_addon.node +++ /dev/null @@ -1 +0,0 @@ -../../build/hmpb-ts/rust_addon.node \ No newline at end of file diff --git a/libs/ballot-interpreter/src/hmpb-ts/types.test.ts b/libs/ballot-interpreter/src/hmpb-ts/types.test.mts similarity index 59% rename from libs/ballot-interpreter/src/hmpb-ts/types.test.ts rename to libs/ballot-interpreter/src/hmpb-ts/types.test.mts index 8c08637e25..dfe02bdb4a 100644 --- a/libs/ballot-interpreter/src/hmpb-ts/types.test.ts +++ b/libs/ballot-interpreter/src/hmpb-ts/types.test.mts @@ -1,4 +1,5 @@ -import { BallotSide } from './types'; +import { expect, test } from 'vitest'; +import { BallotSide } from './types.js'; test('has BallotSide enum', () => { expect(BallotSide).toEqual({ diff --git a/libs/ballot-interpreter/src/interpret_all_bubble_ballot.test.ts b/libs/ballot-interpreter/src/interpret_all_bubble_ballot.test.mts similarity index 95% rename from libs/ballot-interpreter/src/interpret_all_bubble_ballot.test.ts rename to libs/ballot-interpreter/src/interpret_all_bubble_ballot.test.mts index bcab82aac5..591b924b56 100644 --- a/libs/ballot-interpreter/src/interpret_all_bubble_ballot.test.ts +++ b/libs/ballot-interpreter/src/interpret_all_bubble_ballot.test.mts @@ -1,3 +1,4 @@ +import { beforeAll, describe, expect, test } from 'vitest'; import { assert, Optional } from '@votingworks/basics'; import { readElection } from '@votingworks/fs'; import { allBubbleBallotFixtures } from '@votingworks/hmpb'; @@ -10,8 +11,11 @@ import { ElectionDefinition, } from '@votingworks/types'; import { singlePrecinctSelectionFor } from '@votingworks/utils'; -import { pdfToPageImages, sortVotesDict } from '../test/helpers/interpretation'; -import { interpretSheet } from './interpret'; +import { + pdfToPageImages, + sortVotesDict, +} from '../test/helpers/interpretation.mjs'; +import { interpretSheet } from './interpret.js'; describe('Interpret - HMPB - All bubble ballot', () => { const { diff --git a/libs/ballot-interpreter/src/interpret_and_save_files.test.ts b/libs/ballot-interpreter/src/interpret_and_save_files.test.mts similarity index 87% rename from libs/ballot-interpreter/src/interpret_and_save_files.test.ts rename to libs/ballot-interpreter/src/interpret_and_save_files.test.mts index a04b8855d4..5b576e955d 100644 --- a/libs/ballot-interpreter/src/interpret_and_save_files.test.ts +++ b/libs/ballot-interpreter/src/interpret_and_save_files.test.mts @@ -1,3 +1,4 @@ +import { expect, test } from 'vitest'; import { DEFAULT_FAMOUS_NAMES_BALLOT_STYLE_ID, DEFAULT_FAMOUS_NAMES_PRECINCT_ID, @@ -8,9 +9,9 @@ import { electionFamousNames2021Fixtures } from '@votingworks/fixtures'; import { loadImageData } from '@votingworks/image-utils'; import { DEFAULT_MARK_THRESHOLDS, asSheet } from '@votingworks/types'; import { ALL_PRECINCTS_SELECTION } from '@votingworks/utils'; -import { pdfToPageImages } from '../test/helpers/interpretation'; -import { tmpDir } from '../test/helpers/tmp'; -import { interpretSheetAndSaveImages } from './interpret'; +import { pdfToPageImages } from '../test/helpers/interpretation.mjs'; +import { tmpDir } from '../test/helpers/tmp.mjs'; +import { interpretSheetAndSaveImages } from './interpret.js'; test('interprets ballot images and saves images for storage', async () => { const fixtures = electionFamousNames2021Fixtures; diff --git a/libs/ballot-interpreter/src/interpret_bmd_and_hmp_ballots.test.ts b/libs/ballot-interpreter/src/interpret_bmd_and_hmp_ballots.test.mts similarity index 95% rename from libs/ballot-interpreter/src/interpret_bmd_and_hmp_ballots.test.ts rename to libs/ballot-interpreter/src/interpret_bmd_and_hmp_ballots.test.mts index 2195443d07..3ea7c0774e 100644 --- a/libs/ballot-interpreter/src/interpret_bmd_and_hmp_ballots.test.ts +++ b/libs/ballot-interpreter/src/interpret_bmd_and_hmp_ballots.test.mts @@ -1,3 +1,4 @@ +import { expect, test } from 'vitest'; import { renderBmdBallotFixture } from '@votingworks/bmd-ballot-fixtures'; import { readElection } from '@votingworks/fs'; import { famousNamesFixtures } from '@votingworks/hmpb'; @@ -8,8 +9,8 @@ import { asSheet, } from '@votingworks/types'; import { ALL_PRECINCTS_SELECTION } from '@votingworks/utils'; -import { pdfToPageImages } from '../test/helpers/interpretation'; -import { interpretSheet } from './interpret'; +import { pdfToPageImages } from '../test/helpers/interpretation.mjs'; +import { interpretSheet } from './interpret.js'; test('interpret BMD ballot for an election supporting hand-marked paper ballots', async () => { const electionDefinition = ( diff --git a/libs/ballot-interpreter/src/interpret_bmd_ballots.test.ts b/libs/ballot-interpreter/src/interpret_bmd_ballots.test.mts similarity index 98% rename from libs/ballot-interpreter/src/interpret_bmd_ballots.test.ts rename to libs/ballot-interpreter/src/interpret_bmd_ballots.test.mts index d04ad700ec..3d44f37fb9 100644 --- a/libs/ballot-interpreter/src/interpret_bmd_ballots.test.ts +++ b/libs/ballot-interpreter/src/interpret_bmd_ballots.test.mts @@ -1,3 +1,4 @@ +import { beforeAll, beforeEach, describe, expect, test, vi } from 'vitest'; import { sliceBallotHashForEncoding } from '@votingworks/ballot-encoder'; import { DEFAULT_ELECTION_GENERAL_BALLOT_STYLE_ID, @@ -13,7 +14,7 @@ import { electionGeneralDefinition, electionPrimaryPrecinctSplitsFixtures, } from '@votingworks/fixtures'; -import { mockOf } from '@votingworks/test-utils'; +import { mockOf } from '@votingworks/test-utils-vitest'; import { AdjudicationReason, BallotStyleId, @@ -37,12 +38,12 @@ import { import { ImageData } from 'canvas'; import { assert } from 'node:console'; import { assertDefined } from '@votingworks/basics'; -import { pdfToPageImages } from '../test/helpers/interpretation'; -import { interpretSheet, interpretSimplexBmdBallot } from './interpret'; -import { InterpreterOptions } from './types'; -import { normalizeBallotMode } from './validation'; +import { pdfToPageImages } from '../test/helpers/interpretation.mjs'; +import { interpretSheet, interpretSimplexBmdBallot } from './interpret.js'; +import { InterpreterOptions } from './types.js'; +import { normalizeBallotMode } from './validation.js'; -jest.mock('./validation'); +vi.mock('./validation'); beforeEach(() => { mockOf(normalizeBallotMode).mockImplementation((input) => input); diff --git a/libs/ballot-interpreter/src/interpret_nh_hmpb.test.ts b/libs/ballot-interpreter/src/interpret_nh_hmpb.test.mts similarity index 97% rename from libs/ballot-interpreter/src/interpret_nh_hmpb.test.ts rename to libs/ballot-interpreter/src/interpret_nh_hmpb.test.mts index 27039b0184..3191878b96 100644 --- a/libs/ballot-interpreter/src/interpret_nh_hmpb.test.ts +++ b/libs/ballot-interpreter/src/interpret_nh_hmpb.test.mts @@ -1,10 +1,11 @@ +import { beforeEach, describe, expect, test, vi } from 'vitest'; import { assert, unique } from '@votingworks/basics'; import { electionGridLayoutNewHampshireTestBallotFixtures, sampleBallotImages, } from '@votingworks/fixtures'; import { loadImageData } from '@votingworks/image-utils'; -import { mockOf } from '@votingworks/test-utils'; +import { mockOf } from '@votingworks/test-utils-vitest'; import { AdjudicationReason, DEFAULT_MARK_THRESHOLDS, @@ -20,11 +21,11 @@ import { import { ImageData } from 'canvas'; import { readdirSync, readFileSync } from 'node:fs'; import { join } from 'node:path'; -import { interpretSheet } from './interpret'; -import { InterpreterOptions } from './types'; -import { normalizeBallotMode } from './validation'; +import { interpretSheet } from './interpret.js'; +import { InterpreterOptions } from './types.js'; +import { normalizeBallotMode } from './validation.js'; -jest.mock('./validation'); +vi.mock('./validation'); beforeEach(() => { mockOf(normalizeBallotMode).mockImplementation((input) => input); diff --git a/libs/ballot-interpreter/src/interpret_vx_hmpb.test.ts b/libs/ballot-interpreter/src/interpret_vx_hmpb.test.mts similarity index 98% rename from libs/ballot-interpreter/src/interpret_vx_hmpb.test.ts rename to libs/ballot-interpreter/src/interpret_vx_hmpb.test.mts index a0a4fb4d18..20c0c0117e 100644 --- a/libs/ballot-interpreter/src/interpret_vx_hmpb.test.ts +++ b/libs/ballot-interpreter/src/interpret_vx_hmpb.test.mts @@ -1,3 +1,4 @@ +import { beforeAll, beforeEach, describe, expect, test, vi } from 'vitest'; import { sliceBallotHashForEncoding } from '@votingworks/ballot-encoder'; import { assert, assertDefined, iter } from '@votingworks/basics'; import { readElection } from '@votingworks/fs'; @@ -6,7 +7,7 @@ import { generalElectionFixtures, primaryElectionFixtures, } from '@votingworks/hmpb'; -import { mockOf } from '@votingworks/test-utils'; +import { mockOf } from '@votingworks/test-utils-vitest'; import { AdjudicationReason, asSheet, @@ -27,12 +28,12 @@ import { sortVotesDict, unmarkedWriteInsForSheet, votesForSheet, -} from '../test/helpers/interpretation'; -import { interpretSheet } from './interpret'; -import { InterpreterOptions } from './types'; -import { normalizeBallotMode } from './validation'; +} from '../test/helpers/interpretation.mjs'; +import { interpretSheet } from './interpret.js'; +import { InterpreterOptions } from './types.js'; +import { normalizeBallotMode } from './validation.js'; -jest.mock('./validation'); +vi.mock('./validation'); beforeEach(() => { mockOf(normalizeBallotMode).mockImplementation((input) => input); diff --git a/libs/ballot-interpreter/src/save_images.test.ts b/libs/ballot-interpreter/src/save_images.test.mts similarity index 81% rename from libs/ballot-interpreter/src/save_images.test.ts rename to libs/ballot-interpreter/src/save_images.test.mts index 764af2d8ea..7b5df7b279 100644 --- a/libs/ballot-interpreter/src/save_images.test.ts +++ b/libs/ballot-interpreter/src/save_images.test.mts @@ -1,8 +1,9 @@ +import { expect, test } from 'vitest'; import { createImageData, ImageData } from '@votingworks/image-utils'; import { SheetOf } from '@votingworks/types'; import { join } from 'node:path'; -import { tmpDir } from '../test/helpers/tmp'; -import { saveSheetImages } from './save_images'; +import { tmpDir } from '../test/helpers/tmp.mjs'; +import { saveSheetImages } from './save_images.js'; test('saveSheetImages', async () => { const sheetId = 'sheetId'; diff --git a/libs/ballot-interpreter/src/setupTests.ts b/libs/ballot-interpreter/src/setupTests.ts index 579dbe11f8..2adc7ff74c 100644 --- a/libs/ballot-interpreter/src/setupTests.ts +++ b/libs/ballot-interpreter/src/setupTests.ts @@ -1,3 +1,4 @@ +import { expect } from 'vitest'; import { toMatchImageSnapshot } from 'jest-image-snapshot'; expect.extend({ toMatchImageSnapshot }); diff --git a/libs/ballot-interpreter/src/validation.test.ts b/libs/ballot-interpreter/src/validation.test.mts similarity index 96% rename from libs/ballot-interpreter/src/validation.test.ts rename to libs/ballot-interpreter/src/validation.test.mts index ae2b2a45ec..8254ab9caa 100644 --- a/libs/ballot-interpreter/src/validation.test.ts +++ b/libs/ballot-interpreter/src/validation.test.mts @@ -1,3 +1,4 @@ +import { describe, expect, test } from 'vitest'; import { electionGeneralDefinition } from '@votingworks/fixtures'; import { BallotId, @@ -7,8 +8,8 @@ import { PageInterpretation, } from '@votingworks/types'; import { ALL_PRECINCTS_SELECTION } from '@votingworks/utils'; -import { normalizeBallotMode } from './validation'; -import { InterpreterOptions } from './types'; +import { normalizeBallotMode } from './validation.js'; +import { InterpreterOptions } from './types.js'; const BLANK_INTERPRETATION: PageInterpretation = { type: 'BlankPage' }; diff --git a/libs/ballot-interpreter/test/fixtures/index.ts b/libs/ballot-interpreter/test/fixtures/index.ts deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/libs/ballot-interpreter/test/helpers/interpretation.ts b/libs/ballot-interpreter/test/helpers/interpretation.mts similarity index 100% rename from libs/ballot-interpreter/test/helpers/interpretation.ts rename to libs/ballot-interpreter/test/helpers/interpretation.mts diff --git a/libs/ballot-interpreter/test/helpers/tmp.ts b/libs/ballot-interpreter/test/helpers/tmp.mts similarity index 90% rename from libs/ballot-interpreter/test/helpers/tmp.ts rename to libs/ballot-interpreter/test/helpers/tmp.mts index 04e04b0050..0565e0f157 100644 --- a/libs/ballot-interpreter/test/helpers/tmp.ts +++ b/libs/ballot-interpreter/test/helpers/tmp.mts @@ -1,3 +1,4 @@ +import { afterAll } from 'vitest'; import { removeSync } from 'fs-extra'; import { dirSync } from 'tmp'; diff --git a/libs/ballot-interpreter/tsconfig.build.json b/libs/ballot-interpreter/tsconfig.build.json index 02202f3c78..443bd65738 100644 --- a/libs/ballot-interpreter/tsconfig.build.json +++ b/libs/ballot-interpreter/tsconfig.build.json @@ -1,7 +1,12 @@ { "extends": "./tsconfig.json", "include": ["src", "src/data/*.json"], - "exclude": ["**/*.test.ts", "**/*.test.tsx"], + "exclude": [ + "**/*.test.mts", + "**/*.test.mtsx", + "**/*.test.ts", + "**/*.test.tsx" + ], "compilerOptions": { "noEmit": false, "rootDir": "src", @@ -17,6 +22,7 @@ { "path": "../image-utils/tsconfig.build.json" }, { "path": "../printing/tsconfig.build.json" }, { "path": "../types/tsconfig.build.json" }, + { "path": "../test-utils-vitest/tsconfig.build.json" }, { "path": "../ui/tsconfig.build.json" }, { "path": "../utils/tsconfig.build.json" } ] diff --git a/libs/ballot-interpreter/tsconfig.json b/libs/ballot-interpreter/tsconfig.json index 5e5bd21f5e..49ef977255 100644 --- a/libs/ballot-interpreter/tsconfig.json +++ b/libs/ballot-interpreter/tsconfig.json @@ -26,6 +26,7 @@ { "path": "../image-utils/tsconfig.build.json" }, { "path": "../printing/tsconfig.build.json" }, { "path": "../types/tsconfig.build.json" }, + { "path": "../test-utils-vitest/tsconfig.build.json" }, { "path": "../ui/tsconfig.build.json" }, { "path": "../utils/tsconfig.build.json" } ] diff --git a/libs/ballot-interpreter/vitest.config.mts b/libs/ballot-interpreter/vitest.config.mts new file mode 100644 index 0000000000..311aa00980 --- /dev/null +++ b/libs/ballot-interpreter/vitest.config.mts @@ -0,0 +1,13 @@ +import { defineConfig } from '../../vitest.config.shared.mjs'; + +export default defineConfig({ + test: { + setupFiles: ['src/setupTests.ts'], + coverage: { + thresholds: { + lines: 51, + branches: 47, + }, + }, + }, +}); diff --git a/libs/eslint-plugin-vx/src/configs/recommended.ts b/libs/eslint-plugin-vx/src/configs/recommended.ts index 33e9758f0c..a27109ded0 100644 --- a/libs/eslint-plugin-vx/src/configs/recommended.ts +++ b/libs/eslint-plugin-vx/src/configs/recommended.ts @@ -1,5 +1,5 @@ -const jsExtensions = ['.js', '.jsx']; -const tsExtensions = ['.ts', '.tsx']; +const jsExtensions = ['.js', '.jsx', '.mjs', '.mjsx']; +const tsExtensions = ['.ts', '.tsx', '.mts', '.mtsx']; const allExtensions = jsExtensions.concat(tsExtensions); export = { @@ -11,6 +11,7 @@ export = { ecmaVersion: 2018, project: ['./tsconfig.json'], sourceType: 'module', + extraExtensions: tsExtensions, }, extends: [ 'airbnb-base', @@ -112,14 +113,23 @@ export = { devDependencies: [ '**/*.test.ts', '**/*.test.tsx', + '**/*.test.mts', + '**/*.test.mtsx', 'test/**/*', 'src/setupTests.ts', 'src/setupTests.tsx', + 'src/setupTests.mts', + 'src/setupTests.mtsx', '**/*.stories.ts', '**/*.stories.tsx', + '**/*.stories.mts', + '**/*.stories.mtsx', '**/test_utils.ts', '**/test_utils.tsx', + '**/test_utils.mts', + '**/test_utils.mtsx', '**/*.bench.ts', + '**/*.bench.mts', ], }, ], @@ -164,7 +174,12 @@ export = { }, overrides: [ { - files: ['**/*.test.ts', '**/*.test.tsx'], + files: [ + '**/*.test.ts', + '**/*.test.tsx', + '**/*.test.mts', + '**/*.test.mtsx', + ], rules: { '@typescript-eslint/no-non-null-assertion': 'off', 'no-loop-func': 'off', @@ -172,7 +187,12 @@ export = { }, }, { - files: ['**/*.test.ts', '**/*.test.tsx'], + files: [ + '**/*.test.ts', + '**/*.test.tsx', + '**/*.test.mts', + '**/*.test.mtsx', + ], plugins: ['jest'], rules: { 'jest/max-nested-describe': ['error', { max: 1 }], diff --git a/libs/test-utils-vitest/.eslintignore b/libs/test-utils-vitest/.eslintignore index ca254321c0..93f0e825ef 100644 --- a/libs/test-utils-vitest/.eslintignore +++ b/libs/test-utils-vitest/.eslintignore @@ -1,3 +1,3 @@ build coverage -vitest.config.ts \ No newline at end of file +vitest.config.mts \ No newline at end of file diff --git a/libs/test-utils-vitest/package.json b/libs/test-utils-vitest/package.json index 8f29f808f5..3a8f6b79f7 100644 --- a/libs/test-utils-vitest/package.json +++ b/libs/test-utils-vitest/package.json @@ -4,6 +4,7 @@ "private": true, "description": "Test utilities for the monorepo using vitest instead of jest", "license": "GPL-3.0-only", + "type": "module", "main": "build/index.js", "types": "build/index.d.ts", "files": [ @@ -18,8 +19,8 @@ "lint:fix": "pnpm type-check && eslint . --fix", "pre-commit": "lint-staged", "test": "is-ci test:ci test:watch", - "test:ci": "vitest --coverage --reporter junit --outputFile reports/junit.xml", - "test:coverage": "vitest run --coverage", + "test:ci": "vitest run --coverage", + "test:coverage": "vitest --coverage", "test:watch": "vitest", "type-check": "tsc --build" }, diff --git a/libs/test-utils-vitest/src/child_process.test.ts b/libs/test-utils-vitest/src/child_process.test.ts index 3acb9c6daf..80e56d131b 100644 --- a/libs/test-utils-vitest/src/child_process.test.ts +++ b/libs/test-utils-vitest/src/child_process.test.ts @@ -1,6 +1,10 @@ import { expect, test, vi } from 'vitest'; import { Buffer } from 'node:buffer'; -import { mockChildProcess, mockReadable, mockWritable } from './child_process'; +import { + mockChildProcess, + mockReadable, + mockWritable, +} from './child_process.js'; test('mockReadable', () => { const onReadable = vi.fn(); diff --git a/libs/test-utils-vitest/src/console.test.ts b/libs/test-utils-vitest/src/console.test.ts index 32240f138b..bae8a649eb 100644 --- a/libs/test-utils-vitest/src/console.test.ts +++ b/libs/test-utils-vitest/src/console.test.ts @@ -1,6 +1,6 @@ /* eslint-disable no-console */ import { expect, test } from 'vitest'; -import { suppressingConsoleOutput } from './console'; +import { suppressingConsoleOutput } from './console.js'; test.each(['log', 'warn', 'error'] as const)( 'suppressingConsoleOutput replaces console.%s with a mock', diff --git a/libs/test-utils-vitest/src/index.ts b/libs/test-utils-vitest/src/index.ts index 1439c75a85..53591e08e1 100644 --- a/libs/test-utils-vitest/src/index.ts +++ b/libs/test-utils-vitest/src/index.ts @@ -1,6 +1,6 @@ -export * from './advance_timers'; -export * from './child_process'; -export * from './console'; -export * from './mock_kiosk'; -export * from './mock_of'; -export * from './mock_use_audio_controls'; +export * from './advance_timers.js'; +export * from './child_process.js'; +export * from './console.js'; +export * from './mock_kiosk.js'; +export * from './mock_of.js'; +export * from './mock_use_audio_controls.js'; diff --git a/libs/test-utils-vitest/src/mock_function.test.ts b/libs/test-utils-vitest/src/mock_function.test.ts index 6b5ac0a742..fb7c1bdaf6 100644 --- a/libs/test-utils-vitest/src/mock_function.test.ts +++ b/libs/test-utils-vitest/src/mock_function.test.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ import { describe, expect, it } from 'vitest'; -import { mockFunction } from './mock_function'; +import { mockFunction } from './mock_function.js'; describe('mockFunction', () => { function add(num1: number, num2: number): number { diff --git a/libs/test-utils-vitest/vitest.config.ts b/libs/test-utils-vitest/vitest.config.mts similarity index 75% rename from libs/test-utils-vitest/vitest.config.ts rename to libs/test-utils-vitest/vitest.config.mts index d1ec6cc46f..c1ed93ee1a 100644 --- a/libs/test-utils-vitest/vitest.config.ts +++ b/libs/test-utils-vitest/vitest.config.mts @@ -1,4 +1,4 @@ -import { defineConfig } from 'vitest/config'; +import { defineConfig } from '../../vitest.config.shared.mjs'; export default defineConfig({ test: { @@ -7,8 +7,6 @@ export default defineConfig({ lines: 84, branches: 79, }, - provider: 'istanbul', - include: ['src/**/*.ts'], exclude: [ 'src/**/*.test.ts', 'src/advance_timers.ts', diff --git a/package.json b/package.json index 57357ce62f..9b977af422 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,8 @@ "storybook": "^7.2.2", "stylelint": "^15.10.2", "stylelint-config-standard": "^34.0.0", - "typescript": "5.6.2" + "typescript": "5.6.2", + "vitest": "^2.1.8" }, "pnpm": { "overrides": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index db369ba5a8..270e92c51d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -126,6 +126,9 @@ importers: typescript: specifier: 5.6.2 version: 5.6.2 + vitest: + specifier: ^2.1.8 + version: 2.1.8(@types/node@20.16.0) apps/admin/backend: dependencies: @@ -1486,7 +1489,7 @@ importers: version: 2.2.0 jest: specifier: ^29.6.2 - version: 29.6.2 + version: 29.6.2(@types/node@20.16.0) jest-environment-jsdom: specifier: ^29.6.2 version: 29.6.2 @@ -1878,7 +1881,7 @@ importers: version: 2.2.0 jest: specifier: ^29.6.2 - version: 29.6.2 + version: 29.6.2(@types/node@20.16.0) jest-environment-jsdom: specifier: ^29.6.2 version: 29.6.2 @@ -1905,7 +1908,7 @@ importers: version: 1.50.0 ts-jest: specifier: 29.1.1 - version: 29.1.1(@babel/core@7.26.0)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) + version: 29.1.1(@babel/core@7.26.0)(@jest/types@29.6.1)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) vite: specifier: 4.5.2 version: 4.5.2(@types/node@20.16.0) @@ -2283,7 +2286,7 @@ importers: version: 2.2.0 jest: specifier: ^29.6.2 - version: 29.6.2 + version: 29.6.2(@types/node@20.16.0) jest-environment-jsdom: specifier: ^29.6.2 version: 29.6.2 @@ -2310,7 +2313,7 @@ importers: version: 1.53.1 ts-jest: specifier: 29.1.1 - version: 29.1.1(@babel/core@7.26.0)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) + version: 29.1.1(@babel/core@7.26.0)(@jest/types@29.6.1)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) vite: specifier: 4.5.2 version: 4.5.2(@types/node@20.16.0) @@ -2754,7 +2757,7 @@ importers: version: 1.53.1 ts-jest: specifier: 29.1.1 - version: 29.1.1(@babel/core@7.26.0)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) + version: 29.1.1(@babel/core@7.26.0)(@jest/types@29.6.1)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) vite: specifier: 4.5.2 version: 4.5.2(@types/node@20.16.0) @@ -2805,7 +2808,7 @@ importers: version: 1.50.0 ts-jest: specifier: 29.1.1 - version: 29.1.1(@babel/core@7.26.0)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) + version: 29.1.1(@babel/core@7.26.0)(@jest/types@29.6.1)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) libs/@types/compress-commons: dependencies: @@ -2862,7 +2865,7 @@ importers: version: 2.2.0 jest: specifier: ^29.6.2 - version: 29.6.2 + version: 29.6.2(@types/node@20.16.0) jest-junit: specifier: ^16.0.0 version: 16.0.0 @@ -2877,7 +2880,7 @@ importers: version: 1.53.1 ts-jest: specifier: 29.1.1 - version: 29.1.1(@babel/core@7.26.0)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) + version: 29.1.1(@babel/core@7.26.0)(@jest/types@29.6.1)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) libs/auth: dependencies: @@ -2977,7 +2980,7 @@ importers: version: 2.2.0 jest: specifier: ^29.6.2 - version: 29.6.2 + version: 29.6.2(@types/node@20.16.0) jest-junit: specifier: ^16.0.0 version: 16.0.0 @@ -3161,7 +3164,7 @@ importers: version: 1.53.1 ts-jest: specifier: 29.1.1 - version: 29.1.1(@babel/core@7.26.0)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) + version: 29.1.1(@babel/core@7.26.0)(@jest/types@29.6.1)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) libs/ballot-encoder: dependencies: @@ -3213,7 +3216,7 @@ importers: version: 1.50.0 ts-jest: specifier: 29.1.1 - version: 29.1.1(@babel/core@7.26.0)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) + version: 29.1.1(@babel/core@7.26.0)(@jest/types@29.6.1)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) libs/ballot-interpreter: dependencies: @@ -3232,9 +3235,9 @@ importers: '@votingworks/qrdetect': specifier: ^1.0.1 version: 1.0.1 - '@votingworks/test-utils': + '@votingworks/test-utils-vitest': specifier: workspace:* - version: link:../test-utils + version: link:../test-utils-vitest '@votingworks/types': specifier: workspace:* version: link:../types @@ -3272,9 +3275,6 @@ importers: '@types/fs-extra': specifier: 11.0.1 version: 11.0.1 - '@types/jest': - specifier: ^29.5.3 - version: 29.5.3 '@types/jest-image-snapshot': specifier: ^6.4.0 version: 6.4.0 @@ -3287,6 +3287,9 @@ importers: '@types/tmp': specifier: 0.2.4 version: 0.2.4 + '@vitest/coverage-istanbul': + specifier: ^2.1.8 + version: 2.1.8(vitest@2.1.8) '@votingworks/bmd-ballot-fixtures': specifier: workspace:* version: link:../bmd-ballot-fixtures @@ -3314,27 +3317,18 @@ importers: is-ci-cli: specifier: 2.2.0 version: 2.2.0 - jest: - specifier: ^29.6.2 - version: 29.6.2(@types/node@20.16.0) jest-image-snapshot: specifier: ^6.4.0 version: 6.4.0(jest@29.6.2) - jest-junit: - specifier: ^16.0.0 - version: 16.0.0 - jest-watch-typeahead: - specifier: ^2.2.2 - version: 2.2.2(jest@29.6.2) lint-staged: specifier: 11.0.0 version: 11.0.0 sort-package-json: specifier: ^1.50.0 version: 1.50.0 - ts-jest: - specifier: 29.1.1 - version: 29.1.1(@babel/core@7.26.0)(@jest/types@29.6.1)(esbuild@0.21.2)(jest@29.6.2)(typescript@5.6.2) + vitest: + specifier: ^2.1.8 + version: 2.1.8(@types/node@20.16.0) libs/basics: dependencies: @@ -3380,7 +3374,7 @@ importers: version: 1.53.1 ts-jest: specifier: 29.1.1 - version: 29.1.1(@babel/core@7.26.0)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) + version: 29.1.1(@babel/core@7.26.0)(@jest/types@29.6.1)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) libs/bmd-ballot-fixtures: dependencies: @@ -3429,7 +3423,7 @@ importers: version: 2.2.0 jest: specifier: ^29.6.2 - version: 29.6.2 + version: 29.6.2(@types/node@20.16.0) jest-image-snapshot: specifier: ^6.4.0 version: 6.4.0(jest@29.6.2) @@ -3453,7 +3447,7 @@ importers: version: 1.50.0 ts-jest: specifier: 29.1.1 - version: 29.1.1(@babel/core@7.26.0)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) + version: 29.1.1(@babel/core@7.26.0)(@jest/types@29.6.1)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) util: specifier: ^0.12.4 version: 0.12.4 @@ -3508,7 +3502,7 @@ importers: version: 1.53.1 ts-jest: specifier: 29.1.1 - version: 29.1.1(@babel/core@7.26.0)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) + version: 29.1.1(@babel/core@7.26.0)(@jest/types@29.6.1)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) libs/custom-paper-handler: dependencies: @@ -3800,7 +3794,7 @@ importers: version: 1.50.0 ts-jest: specifier: 29.1.1 - version: 29.1.1(@babel/core@7.26.0)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) + version: 29.1.1(@babel/core@7.26.0)(@jest/types@29.6.1)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) libs/dev-dock/frontend: dependencies: @@ -3909,7 +3903,7 @@ importers: version: 5.3.11(react-dom@18.3.1)(react-is@18.2.0)(react@18.3.1) ts-jest: specifier: 29.1.1 - version: 29.1.1(@babel/core@7.26.0)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) + version: 29.1.1(@babel/core@7.26.0)(@jest/types@29.6.1)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) libs/eslint-plugin-vx: dependencies: @@ -3985,7 +3979,7 @@ importers: version: 18.3.1 ts-jest: specifier: 29.1.1 - version: 29.1.1(@babel/core@7.26.0)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) + version: 29.1.1(@babel/core@7.26.0)(@jest/types@29.6.1)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) libs/fixture-generators: dependencies: @@ -4137,7 +4131,7 @@ importers: version: 1.50.0 ts-jest: specifier: 29.1.1 - version: 29.1.1(@babel/core@7.26.0)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) + version: 29.1.1(@babel/core@7.26.0)(@jest/types@29.6.1)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) libs/fs: dependencies: @@ -4216,7 +4210,7 @@ importers: version: 0.2.1 ts-jest: specifier: 29.1.1 - version: 29.1.1(@babel/core@7.26.0)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) + version: 29.1.1(@babel/core@7.26.0)(@jest/types@29.6.1)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) libs/fujitsu-thermal-printer: dependencies: @@ -4329,7 +4323,7 @@ importers: version: 2.2.0 jest: specifier: ^29.6.2 - version: 29.6.2 + version: 29.6.2(@types/node@20.16.0) jest-junit: specifier: ^16.0.0 version: 16.0.0 @@ -4344,7 +4338,7 @@ importers: version: 1.53.1 ts-jest: specifier: 29.1.1 - version: 29.1.1(@babel/core@7.26.0)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) + version: 29.1.1(@babel/core@7.26.0)(@jest/types@29.6.1)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) libs/grout/test-utils: dependencies: @@ -4369,7 +4363,7 @@ importers: version: 2.2.0 jest: specifier: ^29.6.2 - version: 29.6.2 + version: 29.6.2(@types/node@20.16.0) jest-junit: specifier: ^16.0.0 version: 16.0.0 @@ -4384,7 +4378,7 @@ importers: version: 1.53.1 ts-jest: specifier: 29.1.1 - version: 29.1.1(@babel/core@7.26.0)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) + version: 29.1.1(@babel/core@7.26.0)(@jest/types@29.6.1)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) libs/hmpb: dependencies: @@ -4883,7 +4877,7 @@ importers: version: 5.3.11(react-dom@18.3.1)(react-is@18.2.0)(react@18.3.1) ts-jest: specifier: 29.1.1 - version: 29.1.1(@babel/core@7.26.0)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) + version: 29.1.1(@babel/core@7.26.0)(@jest/types@29.6.1)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) util: specifier: ^0.12.4 version: 0.12.4 @@ -4914,7 +4908,7 @@ importers: version: 2.2.0 jest: specifier: ^29.6.2 - version: 29.6.2 + version: 29.6.2(@types/node@20.16.0) jest-junit: specifier: ^16.0.0 version: 16.0.0 @@ -4923,7 +4917,7 @@ importers: version: 2.2.2(jest@29.6.2) ts-jest: specifier: 29.1.1 - version: 29.1.1(@babel/core@7.26.0)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) + version: 29.1.1(@babel/core@7.26.0)(@jest/types@29.6.1)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) libs/monorepo-utils: dependencies: @@ -5300,7 +5294,7 @@ importers: version: 1.50.0 ts-jest: specifier: 29.1.1 - version: 29.1.1(@babel/core@7.26.0)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) + version: 29.1.1(@babel/core@7.26.0)(@jest/types@29.6.1)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) libs/test-utils-vitest: dependencies: @@ -5907,7 +5901,7 @@ importers: version: 1.50.0 ts-jest: specifier: 29.1.1 - version: 29.1.1(@babel/core@7.26.0)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) + version: 29.1.1(@babel/core@7.26.0)(@jest/types@29.6.1)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2) script: dependencies: @@ -12977,23 +12971,6 @@ packages: transitivePeerDependencies: - supports-color - /babel-jest@29.6.2(@babel/core@7.26.0): - resolution: {integrity: sha512-BYCzImLos6J3BH/+HvUCHG1dTf2MzmAB4jaVxHV+29RZLjR29XuYTmsf2sdDwkrb+FczkGo3kOhE7ga6sI0P4A==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - peerDependencies: - '@babel/core': ^7.8.0 - dependencies: - '@babel/core': 7.26.0 - '@jest/transform': 29.6.2 - '@types/babel__core': 7.20.1 - babel-plugin-istanbul: 6.1.1 - babel-preset-jest: 29.5.0(@babel/core@7.26.0) - chalk: 4.1.2 - graceful-fs: 4.2.11 - slash: 3.0.0 - transitivePeerDependencies: - - supports-color - /babel-plugin-istanbul@6.1.1: resolution: {integrity: sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==} engines: {node: '>=8'} @@ -13122,16 +13099,6 @@ packages: babel-plugin-jest-hoist: 29.5.0 babel-preset-current-node-syntax: 1.0.1(@babel/core@7.22.9) - /babel-preset-jest@29.5.0(@babel/core@7.26.0): - resolution: {integrity: sha512-JOMloxOqdiBSxMAzjRaH023/vvcaSaec49zvg+2LmNsktC7ei39LTJGw02J+9uUtTZUq6xbLyJ4dxe9sSmIuAg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - peerDependencies: - '@babel/core': ^7.0.0 - dependencies: - '@babel/core': 7.26.0 - babel-plugin-jest-hoist: 29.5.0 - babel-preset-current-node-syntax: 1.0.1(@babel/core@7.26.0) - /balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} @@ -17644,34 +17611,6 @@ packages: - babel-plugin-macros - supports-color - /jest-cli@29.6.2: - resolution: {integrity: sha512-TT6O247v6dCEX2UGHGyflMpxhnrL0DNqP2fRTKYm3nJJpCTfXX3GCMQPGFjXDoj0i5/Blp3jriKXFgdfmbYB6Q==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - hasBin: true - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - dependencies: - '@jest/core': 29.6.2 - '@jest/test-result': 29.6.2 - '@jest/types': 29.6.1 - chalk: 4.1.2 - exit: 0.1.2 - graceful-fs: 4.2.11 - import-local: 3.1.0 - jest-config: 29.6.2 - jest-util: 29.6.2 - jest-validate: 29.6.2 - prompts: 2.4.0 - yargs: 17.7.1 - transitivePeerDependencies: - - '@types/node' - - babel-plugin-macros - - supports-color - - ts-node - /jest-cli@29.6.2(@types/node@20.16.0): resolution: {integrity: sha512-TT6O247v6dCEX2UGHGyflMpxhnrL0DNqP2fRTKYm3nJJpCTfXX3GCMQPGFjXDoj0i5/Blp3jriKXFgdfmbYB6Q==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -17700,44 +17639,6 @@ packages: - supports-color - ts-node - /jest-config@29.6.2: - resolution: {integrity: sha512-VxwFOC8gkiJbuodG9CPtMRjBUNZEHxwfQXmIudSTzFWxaci3Qub1ddTRbFNQlD/zUeaifLndh/eDccFX4wCMQw==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - peerDependencies: - '@types/node': '*' - ts-node: '>=9.0.0' - peerDependenciesMeta: - '@types/node': - optional: true - ts-node: - optional: true - dependencies: - '@babel/core': 7.26.0 - '@jest/test-sequencer': 29.6.2 - '@jest/types': 29.6.1 - babel-jest: 29.6.2(@babel/core@7.26.0) - chalk: 4.1.2 - ci-info: 3.8.0 - deepmerge: 4.3.1 - glob: 7.2.3 - graceful-fs: 4.2.11 - jest-circus: 29.6.2 - jest-environment-node: 29.6.2 - jest-get-type: 29.4.3 - jest-regex-util: 29.4.3 - jest-resolve: 29.6.2 - jest-runner: 29.6.2 - jest-util: 29.6.2 - jest-validate: 29.6.2 - micromatch: 4.0.8 - parse-json: 5.2.0 - pretty-format: 29.6.2 - slash: 3.0.0 - strip-json-comments: 3.1.1 - transitivePeerDependencies: - - babel-plugin-macros - - supports-color - /jest-config@29.6.2(@types/node@20.16.0): resolution: {integrity: sha512-VxwFOC8gkiJbuodG9CPtMRjBUNZEHxwfQXmIudSTzFWxaci3Qub1ddTRbFNQlD/zUeaifLndh/eDccFX4wCMQw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -18143,26 +18044,6 @@ packages: merge-stream: 2.0.0 supports-color: 8.1.1 - /jest@29.6.2: - resolution: {integrity: sha512-8eQg2mqFbaP7CwfsTpCxQ+sHzw1WuNWL5UUvjnWP4hx2riGz9fPSzYOaU5q8/GqWn1TfgZIVTqYJygbGbWAANg==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - hasBin: true - peerDependencies: - node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 - peerDependenciesMeta: - node-notifier: - optional: true - dependencies: - '@jest/core': 29.6.2 - '@jest/types': 29.6.1 - import-local: 3.1.0 - jest-cli: 29.6.2 - transitivePeerDependencies: - - '@types/node' - - babel-plugin-macros - - supports-color - - ts-node - /jest@29.6.2(@types/node@20.16.0): resolution: {integrity: sha512-8eQg2mqFbaP7CwfsTpCxQ+sHzw1WuNWL5UUvjnWP4hx2riGz9fPSzYOaU5q8/GqWn1TfgZIVTqYJygbGbWAANg==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -22796,7 +22677,6 @@ packages: semver: 7.6.3 typescript: 5.6.2 yargs-parser: 21.1.1 - dev: true /ts-jest@29.1.1(@babel/core@7.26.0)(@jest/types@29.6.1)(esbuild@0.21.2)(jest@29.6.2)(typescript@5.6.2): resolution: {integrity: sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==} @@ -22834,40 +22714,6 @@ packages: yargs-parser: 21.1.1 dev: true - /ts-jest@29.1.1(@babel/core@7.26.0)(esbuild@0.18.17)(jest@29.6.2)(typescript@5.6.2): - resolution: {integrity: sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - hasBin: true - peerDependencies: - '@babel/core': '>=7.0.0-beta.0 <8' - '@jest/types': ^29.0.0 - babel-jest: ^29.0.0 - esbuild: '*' - jest: ^29.0.0 - typescript: 5.6.2 - peerDependenciesMeta: - '@babel/core': - optional: true - '@jest/types': - optional: true - babel-jest: - optional: true - esbuild: - optional: true - dependencies: - '@babel/core': 7.26.0 - bs-logger: 0.2.6 - esbuild: 0.18.17 - fast-json-stable-stringify: 2.1.0 - jest: 29.6.2 - jest-util: 29.6.2 - json5: 2.2.3 - lodash.memoize: 4.1.2 - make-error: 1.3.6 - semver: 7.6.3 - typescript: 5.6.2 - yargs-parser: 21.1.1 - /tsconfig-paths@3.14.1: resolution: {integrity: sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==} dependencies: diff --git a/vitest.config.shared.mts b/vitest.config.shared.mts new file mode 100644 index 0000000000..e89ebfe646 --- /dev/null +++ b/vitest.config.shared.mts @@ -0,0 +1,49 @@ +import * as vitest from 'vitest/config'; + +const isCI = process.env['CI'] === 'true'; + +export const base: vitest.ViteUserConfig = { + test: { + coverage: { + thresholds: { + lines: 100, + branches: 100, + }, + provider: 'istanbul', + include: ['src/**/*.ts'], + }, + minWorkers: isCI ? 1 : undefined, + maxWorkers: isCI ? 6 : undefined, + reporters: isCI ? ['verbose', 'junit'] : [], + outputFile: isCI ? 'reports/junit.xml' : undefined, + }, +}; + +/** + * Merge two objects recursively. Merges only objects, not arrays, strings, etc. + * If the two values cannot be merged, then `b` is used. + */ +function merge(a: any, b: any): any { + if ( + typeof a !== 'object' || + typeof b !== 'object' || + !a || + !b || + Array.isArray(a) || + Array.isArray(b) + ) { + return b; + } + + const result: any = { ...a }; + for (const [key, value] of Object.entries(b)) { + result[key] = merge(a[key], value); + } + return result; +} + +export function defineConfig( + config: vitest.ViteUserConfig +): vitest.ViteUserConfig { + return vitest.defineConfig(merge(base, config)); +}