Skip to content

Commit dd86c25

Browse files
committed
test: use async import pattern in skip-on-lint snap test
The heavy-plugin.ts throws on import, proving the dynamic import inside vitePlugins() is never executed during vp lint.
1 parent 04638b9 commit dd86c25

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
throw new Error('Plugins should not be loaded during lint');
2+
3+
export default function heavyPlugin() {
4+
return { name: 'heavy-plugin' };
5+
}

packages/cli/snap-tests/vite-plugins-skip-on-lint/vite.config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import { defineConfig, vitePlugins } from 'vite-plus';
22

33
export default defineConfig({
44
plugins: [
5-
vitePlugins(() => {
6-
throw new Error('Plugins should not be loaded during lint');
5+
vitePlugins(async () => {
6+
const { default: heavyPlugin } = await import('./heavy-plugin');
7+
return [heavyPlugin()];
78
}),
89
],
910
});

0 commit comments

Comments
 (0)