Skip to content

Commit 5aa939b

Browse files
committed
test: add vitest configureVitest plugin compatibility tests
1 parent 7ef3f0e commit 5aa939b

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

packages/cli/src/__tests__/index.spec.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,34 @@ test('defineConfig supports async function config with plain plugins array', asy
200200
const config = await configFn({ command: 'build', mode: 'production' });
201201
expect(config.plugins?.length).toBe(1);
202202
});
203+
204+
test('defineConfig supports vitest plugin with configureVitest hook', () => {
205+
const config = defineConfig({
206+
plugins: [
207+
{
208+
name: 'vitest-plugin',
209+
configureVitest() {
210+
// vitest plugin hook
211+
},
212+
},
213+
],
214+
});
215+
expect(config.plugins?.length).toBe(1);
216+
expect((config.plugins?.[0] as { name: string })?.name).toBe('vitest-plugin');
217+
});
218+
219+
test('defineConfig supports vitest plugin with configureVitest in plugins factory', () => {
220+
process.env.VP_COMMAND = 'test';
221+
const config = defineConfig({
222+
plugins: () => [
223+
{
224+
name: 'vitest-factory-plugin',
225+
configureVitest() {
226+
// vitest plugin hook
227+
},
228+
},
229+
],
230+
});
231+
expect(config.plugins?.length).toBe(1);
232+
expect((config.plugins?.[0] as { name: string })?.name).toBe('vitest-factory-plugin');
233+
});

0 commit comments

Comments
 (0)