diff --git a/packages/plugin-babel/tests/index.test.ts b/packages/plugin-babel/tests/index.test.ts index 0639ea8008..776aeacac6 100644 --- a/packages/plugin-babel/tests/index.test.ts +++ b/packages/plugin-babel/tests/index.test.ts @@ -1,6 +1,5 @@ import { createRsbuild } from '@rsbuild/core'; import { matchRules } from '@scripts/test-helper'; -import { describe, expect, it } from 'vitest'; import { pluginBabel } from '../src'; describe('plugins/babel', () => { diff --git a/packages/plugin-babel/tests/tsconfig.json b/packages/plugin-babel/tests/tsconfig.json new file mode 100644 index 0000000000..a20c9af655 --- /dev/null +++ b/packages/plugin-babel/tests/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "@rsbuild/config/tsconfig", + "compilerOptions": { + "baseUrl": "./", + "types": ["vitest/globals"] + }, + "include": ["./**/*.ts"] +} diff --git a/packages/plugin-preact/tests/index.test.ts b/packages/plugin-preact/tests/index.test.ts index 4bf903b6d4..28c7aa2857 100644 --- a/packages/plugin-preact/tests/index.test.ts +++ b/packages/plugin-preact/tests/index.test.ts @@ -1,5 +1,4 @@ import { createRsbuild } from '@rsbuild/core'; -import { describe, expect, it } from 'vitest'; import { pluginPreact } from '../src'; describe('plugins/preact', () => { diff --git a/packages/plugin-preact/tests/tsconfig.json b/packages/plugin-preact/tests/tsconfig.json new file mode 100644 index 0000000000..a20c9af655 --- /dev/null +++ b/packages/plugin-preact/tests/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "@rsbuild/config/tsconfig", + "compilerOptions": { + "baseUrl": "./", + "types": ["vitest/globals"] + }, + "include": ["./**/*.ts"] +} diff --git a/packages/plugin-react/tests/features.test.ts b/packages/plugin-react/tests/features.test.ts index 7a5e00fc97..fa45af269e 100644 --- a/packages/plugin-react/tests/features.test.ts +++ b/packages/plugin-react/tests/features.test.ts @@ -1,5 +1,4 @@ import { createStubRsbuild } from '@scripts/test-helper'; -import { describe, expect, it, vi } from 'vitest'; import { pluginReact } from '../src'; describe('splitChunks', () => { diff --git a/packages/plugin-react/tests/index.test.ts b/packages/plugin-react/tests/index.test.ts index bfe0e6a5cd..8817f8b69e 100644 --- a/packages/plugin-react/tests/index.test.ts +++ b/packages/plugin-react/tests/index.test.ts @@ -1,5 +1,4 @@ import { createStubRsbuild, matchRules } from '@scripts/test-helper'; -import { describe, expect, it } from 'vitest'; import { pluginReact } from '../src'; describe('plugins/react', () => { diff --git a/packages/plugin-react/tests/tsconfig.json b/packages/plugin-react/tests/tsconfig.json new file mode 100644 index 0000000000..a20c9af655 --- /dev/null +++ b/packages/plugin-react/tests/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "@rsbuild/config/tsconfig", + "compilerOptions": { + "baseUrl": "./", + "types": ["vitest/globals"] + }, + "include": ["./**/*.ts"] +} diff --git a/packages/plugin-svgr/tests/index.test.ts b/packages/plugin-svgr/tests/index.test.ts index a030fe87fa..c62beb494f 100644 --- a/packages/plugin-svgr/tests/index.test.ts +++ b/packages/plugin-svgr/tests/index.test.ts @@ -1,7 +1,6 @@ import { createRsbuild } from '@rsbuild/core'; import { pluginReact } from '@rsbuild/plugin-react'; import { matchRules } from '@scripts/test-helper'; -import { describe, expect, it } from 'vitest'; import { type PluginSvgrOptions, pluginSvgr } from '../src'; describe('svgr', () => { diff --git a/packages/plugin-svgr/tests/tsconfig.json b/packages/plugin-svgr/tests/tsconfig.json new file mode 100644 index 0000000000..a20c9af655 --- /dev/null +++ b/packages/plugin-svgr/tests/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "@rsbuild/config/tsconfig", + "compilerOptions": { + "baseUrl": "./", + "types": ["vitest/globals"] + }, + "include": ["./**/*.ts"] +} diff --git a/scripts/test-helper/tsconfig.json b/scripts/test-helper/tsconfig.json index aa914af426..9679b20e85 100644 --- a/scripts/test-helper/tsconfig.json +++ b/scripts/test-helper/tsconfig.json @@ -4,7 +4,8 @@ "outDir": "./dist", "baseUrl": "./", "rootDir": "src", - "composite": true + "composite": true, + "types": ["vitest/globals"] }, "references": [ { diff --git a/scripts/test-helper/vitest.setup.ts b/scripts/test-helper/vitest.setup.ts index c6d2ecada7..952c94ffa5 100644 --- a/scripts/test-helper/vitest.setup.ts +++ b/scripts/test-helper/vitest.setup.ts @@ -1,6 +1,5 @@ import path from 'node:path'; import { createSnapshotSerializer } from 'path-serializer'; -import { beforeAll, expect } from 'vitest'; beforeAll((suite) => { process.env.REBUILD_TEST_SUITE_CWD =