From 6b4fbfc9dec492bd9d88310f15137099b7f44f86 Mon Sep 17 00:00:00 2001 From: Tobbe Lundberg Date: Sun, 21 Jan 2024 14:39:28 +0100 Subject: [PATCH 1/6] fix(studio): Upgrade to 11.0.1 and enable web-side (#9858) --- packages/cli/src/commands/studioHandler.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/commands/studioHandler.js b/packages/cli/src/commands/studioHandler.js index 51c1d862e4f9..50ca7df5c3ef 100644 --- a/packages/cli/src/commands/studioHandler.js +++ b/packages/cli/src/commands/studioHandler.js @@ -9,7 +9,7 @@ export const handler = async (options) => { console.log( 'The studio package is not installed, installing it for you, this may take a moment...' ) - await installModule('@redwoodjs/studio', '11.0.0') + await installModule('@redwoodjs/studio', '11.0.1') console.log('Studio package installed successfully.') console.log('Adding config to redwood.toml...') @@ -18,7 +18,7 @@ export const handler = async (options) => { // Import studio and start it const { serve } = await import('@redwoodjs/studio') - await serve({ open: options.open }) + await serve({ open: options.open, enableWeb: true }) } catch (e) { console.log('Cannot start the development studio') console.log(e) From 9bf5fbcd4881b96baa9fcd5425091f7bf478c29b Mon Sep 17 00:00:00 2001 From: Tobbe Lundberg Date: Sun, 21 Jan 2024 14:44:30 +0100 Subject: [PATCH 2/6] fix(cli): Skip Studio when running `rw upgrade` (#9860) --- packages/cli/src/commands/upgrade.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/commands/upgrade.js b/packages/cli/src/commands/upgrade.js index 27af9aac365a..aebe934bbbcf 100644 --- a/packages/cli/src/commands/upgrade.js +++ b/packages/cli/src/commands/upgrade.js @@ -224,8 +224,8 @@ function updatePackageJsonVersion(pkgPath, version, { dryRun, verbose }) { ) if (pkg.dependencies) { - for (const depName of Object.keys(pkg.dependencies).filter((x) => - x.startsWith('@redwoodjs/') + for (const depName of Object.keys(pkg.dependencies).filter( + (x) => x.startsWith('@redwoodjs/') && x !== '@redwoodjs/studio' )) { if (verbose || dryRun) { console.log(` - ${depName}: ${pkg.dependencies[depName]} => ${version}`) @@ -234,8 +234,8 @@ function updatePackageJsonVersion(pkgPath, version, { dryRun, verbose }) { } } if (pkg.devDependencies) { - for (const depName of Object.keys(pkg.devDependencies).filter((x) => - x.startsWith('@redwoodjs/') + for (const depName of Object.keys(pkg.devDependencies).filter( + (x) => x.startsWith('@redwoodjs/') && x !== '@redwoodjs/studio' )) { if (verbose || dryRun) { console.log( From 6f38084c0c6d4efba14cf17c3f3eaed294922f13 Mon Sep 17 00:00:00 2001 From: Tobbe Lundberg Date: Sun, 21 Jan 2024 22:29:59 +0100 Subject: [PATCH 3/6] feat(crwa): Always install using yarn v4 (#9861) --- .../src/create-redwood-app.js | 57 +++++++------------ packages/create-redwood-app/tests/e2e.test.ts | 3 + 2 files changed, 23 insertions(+), 37 deletions(-) diff --git a/packages/create-redwood-app/src/create-redwood-app.js b/packages/create-redwood-app/src/create-redwood-app.js index 7f53b18731e9..bd3d75d9596d 100644 --- a/packages/create-redwood-app/src/create-redwood-app.js +++ b/packages/create-redwood-app/src/create-redwood-app.js @@ -38,21 +38,6 @@ const { telemetry } = Parser(hideBin(process.argv), { const tui = new RedwoodTUI() -// Credit to esbuild: https://github.com/rtsao/esbuild/blob/c35a4cebf037237559213abc684504658966f9d6/lib/install.ts#L190-L199 -function isYarnBerryOrNewer() { - const { npm_config_user_agent: npmConfigUserAgent } = process.env - - if (npmConfigUserAgent) { - const match = npmConfigUserAgent.match(/yarn\/(\d+)/) - - if (match && match[1]) { - return parseInt(match[1], 10) >= 2 - } - } - - return false -} - const USE_GITPOD_TEXT = [ ` As an alternative solution, you can launch a Redwood project using GitPod instead. GitPod is a an online IDE.`, ` See: ${terminalLink( @@ -250,7 +235,10 @@ async function installNodeModules(newAppDir) { }) tui.startReactive(tuiContent) - const yarnInstallSubprocess = execa('yarn install', { + const oldCwd = process.cwd() + process.chdir(newAppDir) + + const yarnInstallSubprocess = execa(`yarn install`, { shell: true, cwd: newAppDir, }) @@ -271,9 +259,12 @@ async function installNodeModules(newAppDir) { ) recordErrorViaTelemetry(error) await shutdownTelemetry() + process.chdir(oldCwd) process.exit(1) } + process.chdir(oldCwd) + tuiContent.update({ header: '', content: `${RedwoodStyling.green('✔')} Installed node modules`, @@ -611,6 +602,11 @@ async function handleCommitMessagePreference(commitMessageFlag) { async function handleYarnInstallPreference(yarnInstallFlag) { // Handle case where flag is set if (yarnInstallFlag !== null) { + tui.drawText( + `${RedwoodStyling.green('✔')} ${ + yarnInstallFlag ? 'Will' : 'Will not' + } run yarn install based on command line flag` + ) return yarnInstallFlag } @@ -673,6 +669,11 @@ async function createRedwoodApp() { type: 'string', describe: 'Commit message for the initial commit', }) + .option('yarn-install', { + default: null, + type: 'boolean', + describe: 'Install node modules. Skip via --no-yarn-install.', + }) .option('telemetry', { default: true, type: 'boolean', @@ -692,22 +693,10 @@ async function createRedwoodApp() { ].join('\n') ) - const _isYarnBerryOrNewer = isYarnBerryOrNewer() - - // Only permit the yarn install flag on yarn 1. - if (!_isYarnBerryOrNewer) { - cli.option('yarn-install', { - default: null, - type: 'boolean', - describe: 'Install node modules. Skip via --no-yarn-install.', - }) - } - // Extract the args as provided by the user in the command line // TODO: Make all flags have the 'flag' suffix const args = parsedFlags._ - const yarnInstallFlag = - parsedFlags['yarn-install'] ?? !_isYarnBerryOrNewer ? parsedFlags.yes : null + const yarnInstallFlag = parsedFlags['yarn-install'] ?? parsedFlags.yes const typescriptFlag = parsedFlags.typescript ?? parsedFlags.yes const overwrite = parsedFlags.overwrite const gitInitFlag = parsedFlags['git-init'] ?? parsedFlags.yes @@ -745,11 +734,7 @@ async function createRedwoodApp() { commitMessage = await handleCommitMessagePreference(commitMessageFlag) } - let yarnInstall = false - - if (!_isYarnBerryOrNewer) { - yarnInstall = await handleYarnInstallPreference(yarnInstallFlag) - } + const yarnInstall = await handleYarnInstallPreference(yarnInstallFlag) let newAppDir = path.resolve(process.cwd(), targetDir) @@ -765,9 +750,7 @@ async function createRedwoodApp() { .getActiveSpan() ?.setAttribute('yarn-install-time', Date.now() - yarnInstallStart) } else { - if (!_isYarnBerryOrNewer) { - tui.drawText(`${RedwoodStyling.info('ℹ')} Skipped yarn install step`) - } + tui.drawText(`${RedwoodStyling.info('ℹ')} Skipped yarn install step`) } // Generate types diff --git a/packages/create-redwood-app/tests/e2e.test.ts b/packages/create-redwood-app/tests/e2e.test.ts index 50ea12a89793..d81e411c58d7 100644 --- a/packages/create-redwood-app/tests/e2e.test.ts +++ b/packages/create-redwood-app/tests/e2e.test.ts @@ -28,6 +28,8 @@ describe('create-redwood-app', () => { --git-init, --git Initialize a git repository [boolean] [default: null] -m, --commit-message Commit message for the initial commit [string] [default: null] + --yarn-install Install node modules. Skip via --no-yarn-install. + [boolean] [default: null] --telemetry Enables sending telemetry events for this create command and all Redwood CLI commands https://telemetry.redwoodjs.com @@ -64,6 +66,7 @@ describe('create-redwood-app', () => { [?25h✔ Creating your Redwood app in ./redwood-app based on command line argument ✔ Using TypeScript based on command line flag ✔ Will initialize a git repo based on command line flag + ✔ Will run yarn install based on command line flag [?25l⠋ Creating project files [?25h[?25l✔ Project files created [?25h[?25l⠋ Initializing a git repo From f447adb192c7f0e99dd75b228ea3c58140ad38fd Mon Sep 17 00:00:00 2001 From: Dominic Saadi Date: Sun, 21 Jan 2024 15:09:30 -0800 Subject: [PATCH 4/6] chore(crwa): update e2e test to handle yarn install patch (#9862) This PR fixes the CRWA e2e tests after the functionality introduced in https://github.com/redwoodjs/redwood/pull/9861. For now I'm skipping `yarn install` since it's prone to timeouts in CI, and the subsequent step, generating types, is also flakey since `yarn pack` seems to skip the `.yarnrc.yml` which is necessary for configuring a proper install. --- packages/create-redwood-app/package.json | 2 +- .../create-redwood-app/scripts/buildPack.js | 31 +++++++++++++++++++ .../templates/js/web/package.json | 4 +-- .../templates/ts/web/package.json | 4 +-- packages/create-redwood-app/tests/e2e.test.ts | 11 +++++-- .../create-redwood-app/tests/e2e_prompts.sh | 2 +- .../tests/e2e_prompts_git.sh | 2 +- .../create-redwood-app/tests/e2e_prompts_m.sh | 2 +- .../tests/e2e_prompts_node_greater.sh | 2 +- .../tests/e2e_prompts_node_less.sh | 2 +- .../tests/e2e_prompts_overwrite.sh | 2 +- .../tests/e2e_prompts_ts.sh | 2 +- 12 files changed, 51 insertions(+), 15 deletions(-) create mode 100644 packages/create-redwood-app/scripts/buildPack.js diff --git a/packages/create-redwood-app/package.json b/packages/create-redwood-app/package.json index 73cba0ca9ed7..52db9b47ecc9 100644 --- a/packages/create-redwood-app/package.json +++ b/packages/create-redwood-app/package.json @@ -15,7 +15,7 @@ ], "scripts": { "build": "node ./scripts/build.js", - "build:pack": "yarn pack -o create-redwood-app.tgz", + "build:pack": "node ./scripts/buildPack.js", "build:watch": "nodemon --watch src --ignore dist,template --exec \"yarn build\"", "prepublishOnly": "NODE_ENV=production yarn build", "set-up-test-project": "node ./scripts/setUpTestProject.js", diff --git a/packages/create-redwood-app/scripts/buildPack.js b/packages/create-redwood-app/scripts/buildPack.js new file mode 100644 index 000000000000..8ec6bb7d1574 --- /dev/null +++ b/packages/create-redwood-app/scripts/buildPack.js @@ -0,0 +1,31 @@ +/* eslint-env node */ + +import { fileURLToPath } from 'node:url' + +import { cd, path, within, $ } from 'zx' + +const tsTemplatePath = fileURLToPath( + new URL('../templates/ts', import.meta.url) +) +const jsTemplatePath = fileURLToPath( + new URL('../templates/js', import.meta.url) +) + +await within(async () => { + cd(tsTemplatePath) + + await $`touch yarn.lock` + await $`yarn` +}) + +await within(async () => { + cd(jsTemplatePath) + + await $`touch yarn.lock` + await $`yarn` +}) + +await $`yarn pack -o create-redwood-app.tgz` + +await $`rm ${path.join(tsTemplatePath, 'yarn.lock')}` +await $`rm ${path.join(jsTemplatePath, 'yarn.lock')}` diff --git a/packages/create-redwood-app/templates/js/web/package.json b/packages/create-redwood-app/templates/js/web/package.json index 490b3c48db21..0b1722e8ff2b 100644 --- a/packages/create-redwood-app/templates/js/web/package.json +++ b/packages/create-redwood-app/templates/js/web/package.json @@ -18,8 +18,8 @@ "react-dom": "0.0.0-experimental-e5205658f-20230913" }, "devDependencies": { + "@redwoodjs/vite": "6.0.7", "@types/react": "18.2.37", - "@types/react-dom": "18.2.15", - "@redwoodjs/vite": "6.0.7" + "@types/react-dom": "18.2.15" } } diff --git a/packages/create-redwood-app/templates/ts/web/package.json b/packages/create-redwood-app/templates/ts/web/package.json index 490b3c48db21..0b1722e8ff2b 100644 --- a/packages/create-redwood-app/templates/ts/web/package.json +++ b/packages/create-redwood-app/templates/ts/web/package.json @@ -18,8 +18,8 @@ "react-dom": "0.0.0-experimental-e5205658f-20230913" }, "devDependencies": { + "@redwoodjs/vite": "6.0.7", "@types/react": "18.2.37", - "@types/react-dom": "18.2.15", - "@redwoodjs/vite": "6.0.7" + "@types/react-dom": "18.2.15" } } diff --git a/packages/create-redwood-app/tests/e2e.test.ts b/packages/create-redwood-app/tests/e2e.test.ts index d81e411c58d7..86dd9724fa48 100644 --- a/packages/create-redwood-app/tests/e2e.test.ts +++ b/packages/create-redwood-app/tests/e2e.test.ts @@ -54,7 +54,11 @@ describe('create-redwood-app', () => { }) test('--yes, -y', async () => { - const p = await $`yarn create-redwood-app ./redwood-app --yes` + // Running `yarn install` in Jest test times out and the subsequent step, + // generating types, is also flakey since `yarn pack` seems to skip `.yarnrc.yml` + // which is necessary for configuring a proper install. + const p = + await $`yarn create-redwood-app ./redwood-app --no-yarn-install --yes` expect(p.exitCode).toEqual(0) expect(p.stdout).toMatchInlineSnapshot(` @@ -66,10 +70,11 @@ describe('create-redwood-app', () => { [?25h✔ Creating your Redwood app in ./redwood-app based on command line argument ✔ Using TypeScript based on command line flag ✔ Will initialize a git repo based on command line flag - ✔ Will run yarn install based on command line flag + ✔ Will not run yarn install based on command line flag [?25l⠋ Creating project files [?25h[?25l✔ Project files created - [?25h[?25l⠋ Initializing a git repo + [?25hℹ Skipped yarn install step + [?25l⠋ Initializing a git repo [?25h[?25l✔ Initialized a git repo with commit message "Initial commit" [?25h Thanks for trying out Redwood! diff --git a/packages/create-redwood-app/tests/e2e_prompts.sh b/packages/create-redwood-app/tests/e2e_prompts.sh index c017c7b184fc..b01b1ece1b1a 100755 --- a/packages/create-redwood-app/tests/e2e_prompts.sh +++ b/packages/create-redwood-app/tests/e2e_prompts.sh @@ -11,7 +11,7 @@ cd $projectPath set projectDirectory "redwood-app-prompt-test" -spawn yarn create-redwood-app +spawn yarn create-redwood-app --no-yarn-install expect "Where would you like to create your Redwood app?" send "$projectDirectory\n" diff --git a/packages/create-redwood-app/tests/e2e_prompts_git.sh b/packages/create-redwood-app/tests/e2e_prompts_git.sh index 655896cc138c..39edd2cee3e2 100755 --- a/packages/create-redwood-app/tests/e2e_prompts_git.sh +++ b/packages/create-redwood-app/tests/e2e_prompts_git.sh @@ -11,7 +11,7 @@ cd $projectPath set projectDirectory "redwood-app-prompt-git-test" -spawn yarn create-redwood-app --git +spawn yarn create-redwood-app --no-yarn-install --git expect "Where would you like to create your Redwood app?" send "$projectDirectory\n" diff --git a/packages/create-redwood-app/tests/e2e_prompts_m.sh b/packages/create-redwood-app/tests/e2e_prompts_m.sh index 30d5e61e6ce3..f9abebafd092 100755 --- a/packages/create-redwood-app/tests/e2e_prompts_m.sh +++ b/packages/create-redwood-app/tests/e2e_prompts_m.sh @@ -11,7 +11,7 @@ cd $projectPath set projectDirectory "redwood-app-prompt-m-test" -spawn yarn create-redwood-app -m "first" +spawn yarn create-redwood-app --no-yarn-install -m "first" expect "Where would you like to create your Redwood app?" send "$projectDirectory\n" diff --git a/packages/create-redwood-app/tests/e2e_prompts_node_greater.sh b/packages/create-redwood-app/tests/e2e_prompts_node_greater.sh index 73a737735458..298f184624cf 100755 --- a/packages/create-redwood-app/tests/e2e_prompts_node_greater.sh +++ b/packages/create-redwood-app/tests/e2e_prompts_node_greater.sh @@ -13,7 +13,7 @@ cd $projectPath set projectDirectory "redwood-app-prompt-node-greater-test" -spawn yarn create-redwood-app +spawn yarn create-redwood-app --no-yarn-install expect "How would you like to proceed?" # ❯ Override error and continue install diff --git a/packages/create-redwood-app/tests/e2e_prompts_node_less.sh b/packages/create-redwood-app/tests/e2e_prompts_node_less.sh index d8187de802fe..2c591a6aefdc 100755 --- a/packages/create-redwood-app/tests/e2e_prompts_node_less.sh +++ b/packages/create-redwood-app/tests/e2e_prompts_node_less.sh @@ -13,7 +13,7 @@ cd $projectPath set projectDirectory "redwood-app-prompt-node-less-test" -spawn yarn create-redwood-app +spawn yarn create-redwood-app --no-yarn-install expect eof catch wait result diff --git a/packages/create-redwood-app/tests/e2e_prompts_overwrite.sh b/packages/create-redwood-app/tests/e2e_prompts_overwrite.sh index dd828aa1a7bf..6dec6771e3db 100755 --- a/packages/create-redwood-app/tests/e2e_prompts_overwrite.sh +++ b/packages/create-redwood-app/tests/e2e_prompts_overwrite.sh @@ -14,7 +14,7 @@ set projectDirectory "redwood-app-prompt-overwrite-test" exec mkdir $projectDirectory exec touch $projectDirectory/README.md -spawn yarn create-redwood-app +spawn yarn create-redwood-app --no-yarn-install expect "Where would you like to create your Redwood app?" send "$projectDirectory\n" diff --git a/packages/create-redwood-app/tests/e2e_prompts_ts.sh b/packages/create-redwood-app/tests/e2e_prompts_ts.sh index 7a32631c8c8a..884bc777b346 100755 --- a/packages/create-redwood-app/tests/e2e_prompts_ts.sh +++ b/packages/create-redwood-app/tests/e2e_prompts_ts.sh @@ -11,7 +11,7 @@ cd $projectPath set projectDirectory "redwood-app-prompt-ts-test" -spawn yarn create-redwood-app --ts +spawn yarn create-redwood-app --no-yarn-install --ts expect "Where would you like to create your Redwood app?" send "$projectDirectory\n" From e17322be6fa11251b865fef897ef8d4b17070277 Mon Sep 17 00:00:00 2001 From: Josh GM Walker <56300765+Josh-Walker-GM@users.noreply.github.com> Date: Mon, 22 Jan 2024 00:43:26 +0000 Subject: [PATCH 5/6] chore(ci): Fix CRWA telemetry check (#9865) The check is currently running indefinitely as it is waiting for the result of a prompt. This PR passes the `--no-yarn-install` flag to prevent this. That flag was introduced in #9861 --- .github/actions/telemetry_check/check.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/telemetry_check/check.mjs b/.github/actions/telemetry_check/check.mjs index 830fd13532ac..54e34c79b54a 100644 --- a/.github/actions/telemetry_check/check.mjs +++ b/.github/actions/telemetry_check/check.mjs @@ -37,7 +37,7 @@ try { switch (mode) { case 'crwa': exitCode = await exec( - `yarn node ./packages/create-redwood-app/dist/create-redwood-app.js ../project-for-telemetry --typescript true --git false` + `yarn node ./packages/create-redwood-app/dist/create-redwood-app.js ../project-for-telemetry --typescript true --git false --no-yarn-install` ) if (exitCode) { process.exit(1) From 74a9b0addc06d2f9745d237322843fd66f79539e Mon Sep 17 00:00:00 2001 From: Josh GM Walker <56300765+Josh-Walker-GM@users.noreply.github.com> Date: Mon, 22 Jan 2024 01:22:24 +0000 Subject: [PATCH 6/6] chore(project-config): switch to vitest (#9864) Switches our tests in `@redwoodjs/project-config` over to vitest. --- packages/project-config/.babelrc.js | 1 - packages/project-config/jest.config.js | 8 -------- packages/project-config/package.json | 8 ++++---- 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 | 2 +- 7 files changed, 25 insertions(+), 18 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..6d3e4e692316 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", @@ -31,9 +31,9 @@ }, "devDependencies": { "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..bc906ddaf8d2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8648,10 +8648,10 @@ __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" + vitest: "npm:1.2.1" languageName: unknown linkType: soft