Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libs/monorepo-utils: Switch from jest to vitest #5772

Merged
merged 2 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions libs/monorepo-utils/jest.config.js

This file was deleted.

15 changes: 6 additions & 9 deletions libs/monorepo-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
"lint": "pnpm type-check && eslint .",
"lint:fix": "pnpm type-check && eslint . --fix",
"test": "is-ci test:ci test:watch",
"test:coverage": "jest --coverage",
"test:watch": "jest --watch",
"test:ci": "jest --coverage --ci --reporters=default --reporters=jest-junit --maxWorkers=7",
"test:coverage": "vitest --coverage",
"test:watch": "vitest",
"test:ci": "vitest run --coverage",
"pre-commit": "lint-staged"
},
"dependencies": {
"@votingworks/basics": "workspace:*"
},
"devDependencies": {
"@types/jest": "^29.5.3",
"@types/node": "20.16.0",
"@typescript-eslint/eslint-plugin": "6.7.0",
"@typescript-eslint/parser": "6.7.0",
"@vitest/coverage-istanbul": "^2.1.8",
"esbuild-runner": "2.2.2",
"eslint": "8.57.0",
"eslint-config-prettier": "^9.0.0",
Expand All @@ -38,14 +38,11 @@
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-vx": "workspace:*",
"is-ci-cli": "2.2.0",
"jest": "^29.6.2",
"jest-junit": "^16.0.0",
"jest-watch-typeahead": "^2.2.2",
"lint-staged": "11.0.0",
"prettier": "3.0.3",
"sort-package-json": "^1.50.0",
"ts-jest": "29.1.1",
"typescript": "5.6.2"
"typescript": "5.6.2",
"vitest": "^2.1.8"
},
"packageManager": "[email protected]"
}
1 change: 1 addition & 0 deletions libs/monorepo-utils/src/circleci.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest';
import { join } from 'node:path';
import { generateConfig } from './circleci';
import { getWorkspacePackageInfo } from './pnpm';
Expand Down
4 changes: 2 additions & 2 deletions libs/monorepo-utils/src/circleci.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ function jobIdForRustPackageId(pkgId: string): string {
function generateTestJobForNodeJsPackage(
pkg: PnpmPackageInfo
): Optional<string[]> {
/* istanbul ignore next */
if (!pkg.packageJson?.scripts?.['test']) {
// exclude packages without tests
return;
Expand Down Expand Up @@ -98,11 +97,12 @@ function generateTestJobForRustCrate(pkgId: string): string[] {
}

function generateTestJobForPackage(pkg: PnpmPackageInfo): Optional<string[]> {
/* istanbul ignore else - @preserve */
if (pkg.packageJson) {
return generateTestJobForNodeJsPackage(pkg);
}

/* istanbul ignore next */
/* istanbul ignore next - @preserve */
throw new Error(`Unsupported package type: ${pkg.relativePath}`);
}

Expand Down
1 change: 1 addition & 0 deletions libs/monorepo-utils/src/dependencies.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest';
import { join } from 'node:path';
import {
findAllMonorepoDependencies,
Expand Down
1 change: 1 addition & 0 deletions libs/monorepo-utils/src/pnpm.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest';
import { relative } from 'node:path';
import { getWorkspacePackageInfo, getWorkspacePackagePaths } from './pnpm';

Expand Down
2 changes: 1 addition & 1 deletion libs/monorepo-utils/src/pnpm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function maybeReadJson(filepath: string): unknown {
try {
return JSON.parse(readFileSync(filepath, { encoding: 'utf-8' }));
} catch {
// istanbul ignore next
/* istanbul ignore next - @preserve */
return undefined;
}
}
Expand Down
1 change: 1 addition & 0 deletions libs/monorepo-utils/src/unused.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { expect, test } from 'vitest';
import { PnpmPackageInfo } from './types';
import { findUnusedPackages } from './unused';

Expand Down
3 changes: 3 additions & 0 deletions libs/monorepo-utils/vitest.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { defineConfig } from '../../vitest.config.shared.mjs';

export default defineConfig();
21 changes: 6 additions & 15 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.