@@ -14,6 +14,14 @@ import {
|
14 | 14 | listReadOnlyChannelPluginsForConfig, |
15 | 15 | } from "./read-only.js"; |
16 | 16 | |
| 17 | +const jitiLoaderParams = vi.hoisted( |
| 18 | +() => |
| 19 | +[] as Array<{ |
| 20 | +modulePath: string; |
| 21 | +tryNative?: boolean; |
| 22 | +}>, |
| 23 | +); |
| 24 | + |
17 | 25 | vi.mock("../../plugins/bundled-dir.js", async (importOriginal) => { |
18 | 26 | const actual = await importOriginal<typeof import("../../plugins/bundled-dir.js")>(); |
19 | 27 | return { |
@@ -98,6 +106,10 @@ vi.mock("../../plugins/jiti-loader-cache.js", async (importOriginal) => {
|
98 | 106 | return { |
99 | 107 | ...actual, |
100 | 108 | getCachedPluginJitiLoader: ((params) => { |
| 109 | +jitiLoaderParams.push({ |
| 110 | +modulePath: params.modulePath, |
| 111 | +tryNative: params.tryNative, |
| 112 | +}); |
101 | 113 | const actualLoader = actual.getCachedPluginJitiLoader(params); |
102 | 114 | return ((modulePath: string) => { |
103 | 115 | if ( |
@@ -419,6 +431,7 @@ function expectExternalChatSetupOnlyPluginLoaded(params: {
|
419 | 431 | } |
420 | 432 | |
421 | 433 | afterEach(() => { |
| 434 | +jitiLoaderParams.length = 0; |
422 | 435 | resetPluginLoaderTestStateForTest(); |
423 | 436 | }); |
424 | 437 | |
@@ -484,6 +497,14 @@ describe("listReadOnlyChannelPluginsForConfig", () => {
|
484 | 497 | ); |
485 | 498 | |
486 | 499 | expectExternalChatSetupOnlyPluginLoaded({ plugins, setupMarker, fullMarker }); |
| 500 | +expect( |
| 501 | +jitiLoaderParams.some( |
| 502 | +(entry) => |
| 503 | +entry.tryNative === true && |
| 504 | +(entry.modulePath.endsWith("/plugins/loader.js") || |
| 505 | +entry.modulePath.endsWith("/plugins/loader.ts")), |
| 506 | +), |
| 507 | +).toBe(true); |
487 | 508 | }); |
488 | 509 | |
489 | 510 | it("matches setup-only plugins by manifest-owned channel ids when plugin id differs", () => { |
|