11import { beforeEach , describe , expect , it , vi } from "vitest" ;
22import { withBundledPluginAllowlistCompat } from "../bundled-compat.js" ;
3+ import { loadPluginManifestRegistry } from "../manifest-registry.js" ;
34import { __testing as providerTesting } from "../providers.js" ;
45import { resolvePluginWebSearchProviders } from "../web-search-providers.js" ;
56import { providerContractCompatPluginIds , webSearchProviderContractRegistry } from "./registry.js" ;
67import { uniqueSortedStrings } from "./testkit.js" ;
78
9+ function resolveBundledManifestProviderPluginIds ( ) {
10+ return uniqueSortedStrings (
11+ loadPluginManifestRegistry ( { } )
12+ . plugins . filter ( ( plugin ) => plugin . origin === "bundled" && plugin . providers . length > 0 )
13+ . map ( ( plugin ) => plugin . id ) ,
14+ ) ;
15+ }
16+
817describe ( "plugin loader contract" , ( ) => {
918 beforeEach ( ( ) => {
1019 vi . restoreAllMocks ( ) ;
1120 } ) ;
1221
1322 it ( "keeps bundled provider compatibility wired to the provider registry" , ( ) => {
1423 const providerPluginIds = uniqueSortedStrings ( providerContractCompatPluginIds ) ;
24+ const manifestProviderPluginIds = resolveBundledManifestProviderPluginIds ( ) ;
1525 const compatPluginIds = providerTesting . resolveBundledProviderCompatPluginIds ( {
1626 config : {
1727 plugins : {
@@ -29,18 +39,22 @@ describe("plugin loader contract", () => {
2939 pluginIds : compatPluginIds ,
3040 } ) ;
3141
42+ expect ( providerPluginIds ) . toEqual ( manifestProviderPluginIds ) ;
43+ expect ( uniqueSortedStrings ( compatPluginIds ) ) . toEqual ( manifestProviderPluginIds ) ;
3244 expect ( uniqueSortedStrings ( compatPluginIds ) ) . toEqual ( expect . arrayContaining ( providerPluginIds ) ) ;
3345 expect ( compatConfig ?. plugins ?. allow ) . toEqual ( expect . arrayContaining ( providerPluginIds ) ) ;
3446 } ) ;
3547
3648 it ( "keeps vitest bundled provider enablement wired to the provider registry" , ( ) => {
3749 const providerPluginIds = uniqueSortedStrings ( providerContractCompatPluginIds ) ;
50+ const manifestProviderPluginIds = resolveBundledManifestProviderPluginIds ( ) ;
3851 const compatConfig = providerTesting . withBundledProviderVitestCompat ( {
3952 config : undefined ,
4053 pluginIds : providerPluginIds ,
4154 env : { VITEST : "1" } as NodeJS . ProcessEnv ,
4255 } ) ;
4356
57+ expect ( providerPluginIds ) . toEqual ( manifestProviderPluginIds ) ;
4458 expect ( compatConfig ?. plugins ) . toMatchObject ( {
4559 enabled : true ,
4660 allow : expect . arrayContaining ( providerPluginIds ) ,
0 commit comments