diff --git a/packages/rolldown/package.json b/packages/rolldown/package.json index daeedf1dd4..527b3343dc 100644 --- a/packages/rolldown/package.json +++ b/packages/rolldown/package.json @@ -80,8 +80,8 @@ "rollup": "^4.12.1", "type-fest": "^4.12.0", "unbuild": "^2.0.0", - "vitest": "^1.3.1", - "fast-glob": "^3.3.2" + "vite": "^5.1.5", + "vitest": "^1.3.1" }, "optionalDependencies": { "@rolldown/binding-darwin-arm64": "workspace:*", diff --git a/packages/rolldown/tests/fixture.test.ts b/packages/rolldown/tests/fixture.test.ts index 9d70c8181b..589fa8aefe 100644 --- a/packages/rolldown/tests/fixture.test.ts +++ b/packages/rolldown/tests/fixture.test.ts @@ -2,32 +2,22 @@ import { test } from 'vitest' import type { TestConfig } from './src/types' import { InputOptions, OutputOptions, rolldown } from 'rolldown' import nodePath from 'node:path' -import * as fastGlob from 'fast-glob' -import { loadTestConfig } from '@tests/utils' main() function main() { - const fixturesPath = nodePath.join(__dirname, 'fixtures') - const testConfigPaths = fastGlob.sync('fixtures/**/_config.ts', { - absolute: true, - cwd: __dirname, - }) - for (const testConfigPath of testConfigPaths) { - const dirPath = nodePath.relative( - fixturesPath, - nodePath.dirname(testConfigPath), - ) - test(dirPath, async (ctx) => { - const testConfig = await loadTestConfig(testConfigPath) - if (testConfig.skip) { - ctx.skip() - return - } + const testConfigPaths = import.meta.glob( + './fixtures/**/_config.ts', + { import: 'default', eager: true }, + ) + for (const [testConfigPath, testConfig] of Object.entries(testConfigPaths)) { + const dirPath = nodePath.dirname(testConfigPath) + const testName = dirPath.replace('./fixtures/', '') + test.skipIf(testConfig.skip)(testName, async () => { try { const output = await compileFixture( - nodePath.dirname(testConfigPath), + nodePath.join(import.meta.dirname, dirPath), testConfig, ) if (testConfig.afterTest) { diff --git a/packages/rolldown/tsconfig.json b/packages/rolldown/tsconfig.json index dcbd411f1b..4c61ddc319 100644 --- a/packages/rolldown/tsconfig.json +++ b/packages/rolldown/tsconfig.json @@ -42,7 +42,10 @@ } /* Specify a set of entries that re-map imports to additional lookup locations. */, // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ - // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + "types": [ + "node", + "vite/client" + ] /* Specify type package names to be included without being referenced in a source file. */, // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4c730278c3..769c5d3d44 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -133,9 +133,6 @@ importers: consola: specifier: ^3.2.3 version: 3.2.3 - fast-glob: - specifier: ^3.3.2 - version: 3.3.2 glob: specifier: ^10.3.10 version: 10.3.10 @@ -151,6 +148,9 @@ importers: unbuild: specifier: ^2.0.0 version: 2.0.0(typescript@5.4.3) + vite: + specifier: ^5.1.5 + version: 5.1.6(@types/node@20.11.26) vitest: specifier: ^1.3.1 version: 1.3.1(@types/node@20.11.26)