From 49a8cedd8632d77dac309a16eeb2c8c00cbdf166 Mon Sep 17 00:00:00 2001 From: Josh GM Walker <56300765+Josh-Walker-GM@users.noreply.github.com> Date: Sun, 21 Jan 2024 23:42:23 +0000 Subject: [PATCH 1/2] switch to vitest --- packages/project-config/.babelrc.js | 1 - packages/project-config/jest.config.js | 8 -------- packages/project-config/package.json | 7 ++++--- packages/project-config/src/__tests__/config.test.ts | 2 ++ packages/project-config/src/__tests__/paths.test.ts | 10 ++++++---- packages/project-config/vitest.config.mts | 12 ++++++++++++ yarn.lock | 1 + 7 files changed, 25 insertions(+), 16 deletions(-) delete mode 100644 packages/project-config/.babelrc.js delete mode 100644 packages/project-config/jest.config.js create mode 100644 packages/project-config/vitest.config.mts diff --git a/packages/project-config/.babelrc.js b/packages/project-config/.babelrc.js deleted file mode 100644 index 3b2c815712d9..000000000000 --- a/packages/project-config/.babelrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = { extends: '../../babel.config.js' } diff --git a/packages/project-config/jest.config.js b/packages/project-config/jest.config.js deleted file mode 100644 index 02db68858b6d..000000000000 --- a/packages/project-config/jest.config.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/*.test.[jt]s?(x)'], - testPathIgnorePatterns: ['fixtures', 'dist'], - moduleNameMapper: { - 'src/(.*)': '/src/$1', - }, - testTimeout: 15000, -} diff --git a/packages/project-config/package.json b/packages/project-config/package.json index 20060378e6ce..9350b36bab47 100644 --- a/packages/project-config/package.json +++ b/packages/project-config/package.json @@ -20,8 +20,8 @@ "build:types": "tsc --build --verbose", "build:watch": "nodemon --watch src --ext \"js,ts,tsx\" --ignore dist --exec \"yarn build\"", "prepublishOnly": "NODE_ENV=production yarn build", - "test": "jest src", - "test:watch": "run test --watch" + "test": "vitest run src", + "test:watch": "vitest watch src" }, "dependencies": { "@iarna/toml": "2.2.5", @@ -33,7 +33,8 @@ "esbuild": "0.19.9", "jest": "29.7.0", "rimraf": "5.0.5", - "typescript": "5.3.3" + "typescript": "5.3.3", + "vitest": "1.2.1" }, "gitHead": "3905ed045508b861b495f8d5630d76c7a157d8f1" } diff --git a/packages/project-config/src/__tests__/config.test.ts b/packages/project-config/src/__tests__/config.test.ts index 4f1509757358..c2e458178f20 100644 --- a/packages/project-config/src/__tests__/config.test.ts +++ b/packages/project-config/src/__tests__/config.test.ts @@ -1,5 +1,7 @@ import path from 'path' +import { describe, it, expect } from 'vitest' + import { getConfig, getRawConfig } from '../config' describe('getRawConfig', () => { diff --git a/packages/project-config/src/__tests__/paths.test.ts b/packages/project-config/src/__tests__/paths.test.ts index a0245b0d1fbb..99e34e484f84 100644 --- a/packages/project-config/src/__tests__/paths.test.ts +++ b/packages/project-config/src/__tests__/paths.test.ts @@ -1,5 +1,7 @@ import path from 'path' +import { describe, beforeAll, afterAll, it, expect, test } from 'vitest' + import { processPagesDir, resolveFile, @@ -226,7 +228,7 @@ describe('paths', () => { }) }) - describe('resolveFile', () => { + test('resolveFile', () => { const p = resolveFile(path.join(FIXTURE_BASEDIR, 'web', 'src', 'App')) expect(path.extname(p)).toEqual('.tsx') @@ -547,7 +549,7 @@ describe('paths', () => { }) }) - describe('resolveFile', () => { + test('resolveFile', () => { const p = resolveFile(path.join(FIXTURE_BASEDIR, 'web', 'src', 'App')) expect(path.extname(p)).toEqual('.js') @@ -826,7 +828,7 @@ describe('paths', () => { }) }) - describe('resolveFile', () => { + test('resolveFile', () => { const p = resolveFile(path.join(FIXTURE_BASEDIR, 'web', 'src', 'index')) expect(path.extname(p)).toEqual('.js') @@ -1158,7 +1160,7 @@ describe('paths', () => { }) }) - describe('resolveFile', () => { + test('resolveFile', () => { const p = resolveFile(path.join(FIXTURE_BASEDIR, 'web', 'src', 'Routes')) expect(path.extname(p)).toEqual('.tsx') diff --git a/packages/project-config/vitest.config.mts b/packages/project-config/vitest.config.mts new file mode 100644 index 000000000000..e5f9df88ccb8 --- /dev/null +++ b/packages/project-config/vitest.config.mts @@ -0,0 +1,12 @@ +import { defineConfig, configDefaults } from 'vitest/config' + +export default defineConfig({ + test: { + testTimeout: 15_000, + include: ['**/__tests__/**/*.[jt]s?(x)', '**/*.test.[jt]s?(x)'], + exclude: [...configDefaults.exclude, '**/fixtures', '**/dist'], + alias: { + 'src/(.*)': '/src/$1', + } + }, +}) diff --git a/yarn.lock b/yarn.lock index e3b6932ba660..0dcf7f6be211 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8652,6 +8652,7 @@ __metadata: rimraf: "npm:5.0.5" string-env-interpolation: "npm:1.0.1" typescript: "npm:5.3.3" + vitest: "npm:1.2.1" languageName: unknown linkType: soft From cade60ceb2610b0d68c659a7a70776b93f04afb0 Mon Sep 17 00:00:00 2001 From: Josh GM Walker <56300765+Josh-Walker-GM@users.noreply.github.com> Date: Sun, 21 Jan 2024 23:43:15 +0000 Subject: [PATCH 2/2] remove jest devDep --- packages/project-config/package.json | 1 - yarn.lock | 1 - 2 files changed, 2 deletions(-) diff --git a/packages/project-config/package.json b/packages/project-config/package.json index 9350b36bab47..6d3e4e692316 100644 --- a/packages/project-config/package.json +++ b/packages/project-config/package.json @@ -31,7 +31,6 @@ }, "devDependencies": { "esbuild": "0.19.9", - "jest": "29.7.0", "rimraf": "5.0.5", "typescript": "5.3.3", "vitest": "1.2.1" diff --git a/yarn.lock b/yarn.lock index 0dcf7f6be211..bc906ddaf8d2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8648,7 +8648,6 @@ __metadata: deepmerge: "npm:4.3.1" esbuild: "npm:0.19.9" fast-glob: "npm:3.3.2" - jest: "npm:29.7.0" rimraf: "npm:5.0.5" string-env-interpolation: "npm:1.0.1" typescript: "npm:5.3.3"