fix(bgm): pass options arg to buildStart in unit test
Vite 8 (rolldown) changed buildStart to take (this, options), so the test's one-arg call failed typecheck. Add an ambient declaration for the fixture's virtual bgm modules so its entry typechecks in the editor.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
/**
|
||||
* Ambient types for the virtual `bgm` modules served by the bgm vite plugin,
|
||||
* so the fixture's entry typechecks in the editor (the plugin provides them at
|
||||
* build time). Mirrors `apps/web/src/vite-env.d.ts`.
|
||||
*/
|
||||
declare module 'virtual:bgm/packages' {
|
||||
import type { SerializedPackage } from '@tts/bgm';
|
||||
const packages: SerializedPackage[];
|
||||
export default packages;
|
||||
}
|
||||
|
||||
declare module 'virtual:bgm/package/*' {
|
||||
import type { SerializedPackage } from '@tts/bgm';
|
||||
const pkg: SerializedPackage;
|
||||
export default pkg;
|
||||
}
|
||||
@@ -80,7 +80,9 @@ describe('bgm vite plugin', () => {
|
||||
const plugin = bgm({ root: gamesRoot });
|
||||
const watched: string[] = [];
|
||||
const context = { addWatchFile: (file: string) => watched.push(file) };
|
||||
(plugin.buildStart as Callable<typeof plugin.buildStart>).call(context);
|
||||
// Vite 8 (rolldown) `buildStart` takes `(this, options)`; the plugin ignores
|
||||
// the options, so pass a placeholder.
|
||||
(plugin.buildStart as Callable<typeof plugin.buildStart>).call(context, {} as never);
|
||||
|
||||
// Every def file (real + virtual code blocks) is watched so edits
|
||||
// trigger a re-collect.
|
||||
|
||||
Reference in New Issue
Block a user