From 0fae764f107dbd787df046f1496436fde0359c74 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Fri, 20 Mar 2026 01:12:05 -0700 Subject: [PATCH] test(plugins): use sync jiti regression path --- src/plugins/loader.git-path-regression.test.ts | 9 ++++----- src/plugins/loader.test.ts | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/plugins/loader.git-path-regression.test.ts b/src/plugins/loader.git-path-regression.test.ts index fde7d6554bc..23ab4f4243d 100644 --- a/src/plugins/loader.git-path-regression.test.ts +++ b/src/plugins/loader.git-path-regression.test.ts @@ -77,10 +77,9 @@ export const copiedRuntimeMarker = { ...__testing.buildPluginLoaderJitiOptions({}), tryNative: false, }); - // Jiti's pre-alias failure text varies across Node versions and platforms. - // The contract is simply that the source import rejects until the scoped - // plugin-sdk alias is applied. - await expect(withoutAlias.import(copiedChannelRuntime)).rejects.toThrow(); + // The production loader uses sync Jiti evaluation, so this regression test + // should exercise the same seam instead of Jiti's async import helper. + expect(() => withoutAlias(copiedChannelRuntime)).toThrow(); const withAlias = createJiti(jitiBaseUrl, { ...__testing.buildPluginLoaderJitiOptions({ @@ -88,7 +87,7 @@ export const copiedRuntimeMarker = { }), tryNative: false, }); - await expect(withAlias.import(copiedChannelRuntime)).resolves.toMatchObject({ + expect(withAlias(copiedChannelRuntime)).toMatchObject({ copiedRuntimeMarker: { PAIRING_APPROVED_MESSAGE: "paired", resolveOutboundSendDep: expect.any(Function), diff --git a/src/plugins/loader.test.ts b/src/plugins/loader.test.ts index 4f6132a3bd5..a4bf12fad15 100644 --- a/src/plugins/loader.test.ts +++ b/src/plugins/loader.test.ts @@ -3595,10 +3595,9 @@ export const syntheticRuntimeMarker = { ...__testing.buildPluginLoaderJitiOptions({}), tryNative: false, }); - // Jiti's pre-alias failure text varies across Node versions and platforms. - // This boundary only needs to prove the source import rejects until the - // plugin-sdk alias is present. - await expect(withoutAlias.import(copiedChannelRuntime)).rejects.toThrow(); + // The production loader uses sync Jiti evaluation, so this boundary should + // follow the same path instead of the async import helper. + expect(() => withoutAlias(copiedChannelRuntime)).toThrow(); const withAlias = createJiti(jitiBaseUrl, { ...__testing.buildPluginLoaderJitiOptions({ @@ -3606,7 +3605,7 @@ export const syntheticRuntimeMarker = { }), tryNative: false, }); - await expect(withAlias.import(copiedChannelRuntime)).resolves.toMatchObject({ + expect(withAlias(copiedChannelRuntime)).toMatchObject({ syntheticRuntimeMarker: { resolveOutboundSendDep: expect.any(Function), },