diff --git a/packages/toolkit/connector-kit/jest.config.js b/packages/toolkit/connector-kit/jest.config.js deleted file mode 100644 index 47665f39a..000000000 --- a/packages/toolkit/connector-kit/jest.config.js +++ /dev/null @@ -1,13 +0,0 @@ -/** @type {import('jest').Config} */ -const config = { - transform: {}, - coveragePathIgnorePatterns: ['/node_modules/', '/src/__mocks__/'], - coverageReporters: ['text-summary', 'lcov'], - coverageProvider: 'v8', - roots: ['./lib'], - moduleNameMapper: { - '^(chalk|inquirer)$': '/../../shared/lib/esm/module-proxy.js', - }, -}; - -export default config; diff --git a/packages/toolkit/connector-kit/package.json b/packages/toolkit/connector-kit/package.json index b6f9e0083..67bf3d380 100644 --- a/packages/toolkit/connector-kit/package.json +++ b/packages/toolkit/connector-kit/package.json @@ -26,14 +26,11 @@ "precommit": "lint-staged", "dev": "tsc --watch --preserveWatchOutput --incremental", "build": "rm -rf lib/ && tsc", - "build:test": "pnpm build", "lint": "eslint --ext .ts src", "lint:report": "pnpm lint --format json --output-file report.json", "prepack": "pnpm build", - "test:only": "NODE_OPTIONS=--experimental-vm-modules jest", - "test": "pnpm build:test && pnpm test:only", - "test:ci": "pnpm test:only", - "test:coverage": "pnpm test:only --silent --coverage" + "test": "vitest src", + "test:ci": "pnpm run test --silent --coverage" }, "dependencies": { "@logto/language-kit": "workspace:^1.1.0", @@ -45,17 +42,14 @@ "zod": "^3.22.4" }, "devDependencies": { - "@jest/types": "^29.0.3", "@silverhand/eslint-config": "5.0.0", "@silverhand/ts-config": "5.0.0", - "@types/jest": "^29.4.0", "@types/node": "^20.9.5", "eslint": "^8.44.0", - "jest": "^29.7.0", "lint-staged": "^15.0.0", "prettier": "^3.0.0", - "tslib": "^2.4.1", - "typescript": "^5.3.3" + "typescript": "^5.3.3", + "vitest": "^1.4.0" }, "engines": { "node": "^20.9.0" diff --git a/packages/toolkit/connector-kit/src/index.test.ts b/packages/toolkit/connector-kit/src/index.test.ts index 6cece2333..2e6e164ff 100644 --- a/packages/toolkit/connector-kit/src/index.test.ts +++ b/packages/toolkit/connector-kit/src/index.test.ts @@ -1,3 +1,4 @@ +import { describe, it, expect } from 'vitest'; import { z } from 'zod'; import { diff --git a/packages/toolkit/connector-kit/tsconfig.test.json b/packages/toolkit/connector-kit/tsconfig.test.json deleted file mode 100644 index 55de18c33..000000000 --- a/packages/toolkit/connector-kit/tsconfig.test.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "./tsconfig", - "compilerOptions": { - "isolatedModules": false, - "allowJs": true - }, - "include": ["src"] -} diff --git a/packages/toolkit/core-kit/jest.config.js b/packages/toolkit/core-kit/jest.config.js deleted file mode 100644 index 838c8248d..000000000 --- a/packages/toolkit/core-kit/jest.config.js +++ /dev/null @@ -1,14 +0,0 @@ -/** @type {import('jest').Config} */ -const config = { - transform: {}, - coveragePathIgnorePatterns: ['/node_modules/', '/src/__mocks__/'], - coverageReporters: ['text-summary', 'lcov'], - coverageProvider: 'v8', - roots: ['./lib'], - setupFilesAfterEnv: ['/jest.setup.js'], - moduleNameMapper: { - '^(chalk|inquirer)$': '/../../shared/lib/esm/module-proxy.js', - }, -}; - -export default config; diff --git a/packages/toolkit/core-kit/jest.setup.js b/packages/toolkit/core-kit/jest.setup.js deleted file mode 100644 index ee007a943..000000000 --- a/packages/toolkit/core-kit/jest.setup.js +++ /dev/null @@ -1,4 +0,0 @@ -import crypto from 'node:crypto'; - -// eslint-disable-next-line @silverhand/fp/no-mutation -global.crypto = crypto; diff --git a/packages/toolkit/core-kit/package.json b/packages/toolkit/core-kit/package.json index c99b3e45e..a898d0053 100644 --- a/packages/toolkit/core-kit/package.json +++ b/packages/toolkit/core-kit/package.json @@ -29,15 +29,12 @@ "precommit": "lint-staged", "dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput --incremental", "build": "rm -rf lib/ && tsc -p tsconfig.build.json", - "build:test": "pnpm build -p tsconfig.test.json --sourcemap", "lint": "eslint --ext .ts src", "lint:report": "pnpm lint --format json --output-file report.json", "prepack": "pnpm build", "stylelint": "stylelint \"scss/**/*.scss\"", - "test:only": "NODE_OPTIONS=--experimental-vm-modules jest", - "test": "pnpm build:test && pnpm test:only", - "test:ci": "pnpm test:only", - "test:coverage": "pnpm test:only --silent --coverage" + "test": "vitest src", + "test:ci": "pnpm run test --silent --coverage" }, "engines": { "node": "^20.9.0" @@ -52,22 +49,19 @@ "zod": "^3.22.4" }, "devDependencies": { - "@jest/types": "^29.0.3", "@silverhand/eslint-config": "5.0.0", "@silverhand/ts-config": "5.0.0", "@silverhand/ts-config-react": "5.0.0", "@types/color": "^3.0.3", - "@types/jest": "^29.4.0", "@types/node": "^20.9.5", "@types/react": "^18.0.31", "eslint": "^8.44.0", - "jest": "^29.7.0", "lint-staged": "^15.0.0", "postcss": "^8.4.31", "prettier": "^3.0.0", "stylelint": "^15.0.0", - "tslib": "^2.4.1", - "typescript": "^5.3.3" + "typescript": "^5.3.3", + "vitest": "^1.4.0" }, "eslintConfig": { "extends": "@silverhand" diff --git a/packages/toolkit/core-kit/src/password-policy.test.ts b/packages/toolkit/core-kit/src/password-policy.test.ts index b7a44c2a1..55106112e 100644 --- a/packages/toolkit/core-kit/src/password-policy.test.ts +++ b/packages/toolkit/core-kit/src/password-policy.test.ts @@ -1,14 +1,13 @@ +import { describe, expect, it, beforeAll, afterAll, vi } from 'vitest'; import { ZodError } from 'zod'; import { PasswordPolicyChecker } from './password-policy.js'; -const { jest } = import.meta; - const mockPwnResponse = () => { const originalFetch = global.fetch; beforeAll(() => { // eslint-disable-next-line @silverhand/fp/no-mutation - global.fetch = jest.fn().mockResolvedValue({ + global.fetch = vi.fn().mockResolvedValue({ // Return hash suffixes for '123456'. text: async () => 'D032E84B0AEB4E773555C73D6B13BEA7A44:1\nD09CA3762AF61E59520943DC26494F8941B:37615252', diff --git a/packages/toolkit/core-kit/src/regex.test.ts b/packages/toolkit/core-kit/src/regex.test.ts index 555580b56..09321f44e 100644 --- a/packages/toolkit/core-kit/src/regex.test.ts +++ b/packages/toolkit/core-kit/src/regex.test.ts @@ -1,3 +1,5 @@ +import { describe, expect, it } from 'vitest'; + import { domainRegEx } from './regex.js'; describe('Regular expressions should work as expected', () => { diff --git a/packages/toolkit/core-kit/src/utils/url.test.ts b/packages/toolkit/core-kit/src/utils/url.test.ts index 90742ca2e..75ab7588c 100644 --- a/packages/toolkit/core-kit/src/utils/url.test.ts +++ b/packages/toolkit/core-kit/src/utils/url.test.ts @@ -1,3 +1,5 @@ +import { describe, expect, it } from 'vitest'; + import { isLocalhost, isValidUrl, validateRedirectUrl } from './url.js'; describe('url utilities', () => { diff --git a/packages/toolkit/core-kit/tsconfig.test.json b/packages/toolkit/core-kit/tsconfig.test.json deleted file mode 100644 index 55de18c33..000000000 --- a/packages/toolkit/core-kit/tsconfig.test.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "./tsconfig", - "compilerOptions": { - "isolatedModules": false, - "allowJs": true - }, - "include": ["src"] -} diff --git a/packages/toolkit/language-kit/jest.config.js b/packages/toolkit/language-kit/jest.config.js deleted file mode 100644 index 47665f39a..000000000 --- a/packages/toolkit/language-kit/jest.config.js +++ /dev/null @@ -1,13 +0,0 @@ -/** @type {import('jest').Config} */ -const config = { - transform: {}, - coveragePathIgnorePatterns: ['/node_modules/', '/src/__mocks__/'], - coverageReporters: ['text-summary', 'lcov'], - coverageProvider: 'v8', - roots: ['./lib'], - moduleNameMapper: { - '^(chalk|inquirer)$': '/../../shared/lib/esm/module-proxy.js', - }, -}; - -export default config; diff --git a/packages/toolkit/language-kit/package.json b/packages/toolkit/language-kit/package.json index 3f6627f83..46e029bfc 100644 --- a/packages/toolkit/language-kit/package.json +++ b/packages/toolkit/language-kit/package.json @@ -22,14 +22,11 @@ "scripts": { "precommit": "lint-staged", "build": "rm -rf lib/ && tsc -p tsconfig.build.json", - "build:test": "pnpm build -p tsconfig.test.json --sourcemap", "lint": "eslint --ext .ts src", "lint:report": "pnpm lint --format json --output-file report.json", "prepack": "pnpm build", - "test:only": "NODE_OPTIONS=--experimental-vm-modules jest", - "test": "pnpm build:test && pnpm test:only", - "test:ci": "pnpm test:only", - "test:coverage": "pnpm test:only --silent --coverage" + "test": "vitest src", + "test:ci": "pnpm run test --silent --coverage" }, "engines": { "node": "^20.9.0" @@ -38,17 +35,14 @@ "zod": "^3.22.4" }, "devDependencies": { - "@jest/types": "^29.0.3", "@silverhand/eslint-config": "5.0.0", "@silverhand/ts-config": "5.0.0", - "@types/jest": "^29.4.0", "@types/node": "^20.9.5", "eslint": "^8.44.0", - "jest": "^29.7.0", "lint-staged": "^15.0.0", "prettier": "^3.0.0", - "tslib": "^2.4.1", - "typescript": "^5.3.3" + "typescript": "^5.3.3", + "vitest": "^1.4.0" }, "eslintConfig": { "extends": "@silverhand" diff --git a/packages/toolkit/language-kit/src/utility.test.ts b/packages/toolkit/language-kit/src/utility.test.ts index f79fca462..8743fb20f 100644 --- a/packages/toolkit/language-kit/src/utility.test.ts +++ b/packages/toolkit/language-kit/src/utility.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from 'vitest'; import { number, ZodError } from 'zod'; import { fallback, isLanguageTag, languageTagGuard } from './utility.js'; diff --git a/packages/toolkit/language-kit/tsconfig.test.json b/packages/toolkit/language-kit/tsconfig.test.json deleted file mode 100644 index 55de18c33..000000000 --- a/packages/toolkit/language-kit/tsconfig.test.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "./tsconfig", - "compilerOptions": { - "isolatedModules": false, - "allowJs": true - }, - "include": ["src"] -} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0ab70c2cf..3a499d24a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3919,39 +3919,30 @@ importers: specifier: ^3.22.4 version: 3.22.4 devDependencies: - '@jest/types': - specifier: ^29.0.3 - version: 29.1.2 '@silverhand/eslint-config': specifier: 5.0.0 version: 5.0.0(eslint@8.44.0)(prettier@3.0.0)(typescript@5.3.3) '@silverhand/ts-config': specifier: 5.0.0 version: 5.0.0(typescript@5.3.3) - '@types/jest': - specifier: ^29.4.0 - version: 29.4.0 '@types/node': specifier: ^20.9.5 version: 20.10.4 eslint: specifier: ^8.44.0 version: 8.44.0 - jest: - specifier: ^29.7.0 - version: 29.7.0(@types/node@20.10.4) lint-staged: specifier: ^15.0.0 version: 15.0.2 prettier: specifier: ^3.0.0 version: 3.0.0 - tslib: - specifier: ^2.4.1 - version: 2.4.1 typescript: specifier: ^5.3.3 version: 5.3.3 + vitest: + specifier: ^1.4.0 + version: 1.4.0(@types/node@20.10.4) packages/toolkit/core-kit: dependencies: @@ -3972,9 +3963,6 @@ importers: specifier: ^3.22.4 version: 3.22.4 devDependencies: - '@jest/types': - specifier: ^29.0.3 - version: 29.3.1 '@silverhand/eslint-config': specifier: 5.0.0 version: 5.0.0(eslint@8.44.0)(prettier@3.0.0)(typescript@5.3.3) @@ -3987,9 +3975,6 @@ importers: '@types/color': specifier: ^3.0.3 version: 3.0.3 - '@types/jest': - specifier: ^29.4.0 - version: 29.4.0 '@types/node': specifier: ^20.9.5 version: 20.10.4 @@ -3999,9 +3984,6 @@ importers: eslint: specifier: ^8.44.0 version: 8.44.0 - jest: - specifier: ^29.7.0 - version: 29.7.0(@types/node@20.10.4) lint-staged: specifier: ^15.0.0 version: 15.0.2 @@ -4014,12 +3996,12 @@ importers: stylelint: specifier: ^15.0.0 version: 15.0.0 - tslib: - specifier: ^2.4.1 - version: 2.4.1 typescript: specifier: ^5.3.3 version: 5.3.3 + vitest: + specifier: ^1.4.0 + version: 1.4.0(@types/node@20.10.4) packages/toolkit/language-kit: optionalDependencies: @@ -4027,39 +4009,30 @@ importers: specifier: ^3.22.4 version: 3.22.4 devDependencies: - '@jest/types': - specifier: ^29.0.3 - version: 29.3.1 '@silverhand/eslint-config': specifier: 5.0.0 version: 5.0.0(eslint@8.44.0)(prettier@3.0.0)(typescript@5.3.3) '@silverhand/ts-config': specifier: 5.0.0 version: 5.0.0(typescript@5.3.3) - '@types/jest': - specifier: ^29.4.0 - version: 29.4.0 '@types/node': specifier: ^20.9.5 version: 20.10.4 eslint: specifier: ^8.44.0 version: 8.44.0 - jest: - specifier: ^29.7.0 - version: 29.7.0(@types/node@20.10.4) lint-staged: specifier: ^15.0.0 version: 15.0.2 prettier: specifier: ^3.0.0 version: 3.0.0 - tslib: - specifier: ^2.4.1 - version: 2.4.1 typescript: specifier: ^5.3.3 version: 5.3.3 + vitest: + specifier: ^1.4.0 + version: 1.4.0(@types/node@20.10.4) packages: @@ -7494,18 +7467,6 @@ packages: chalk: 4.1.2 dev: true - /@jest/types@29.3.1: - resolution: {integrity: sha512-d0S0jmmTpjnhCmNpApgX3jrUZgZ22ivKJRvL2lli5hpCRoNnp1f85r2/wpKfXuYu8E7Jjh1hGfhPyup1NM5AmA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - dependencies: - '@jest/schemas': 29.0.0 - '@types/istanbul-lib-coverage': 2.0.4 - '@types/istanbul-reports': 3.0.1 - '@types/node': 20.11.20 - '@types/yargs': 17.0.13 - chalk: 4.1.2 - dev: true - /@jest/types@29.5.0: resolution: {integrity: sha512-qbu7kN6czmVRc3xWFQcAN03RAUamgppVUdXrvl1Wr3jlNF93o9mJbGcDWrwGB6ht44u7efB1qCFgVQmca24Uog==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}