@@ -1824,6 +1824,31 @@ export const syntheticRuntimeMarker = {
|
1824 | 1824 | ).toBe(distFile); |
1825 | 1825 | }); |
1826 | 1826 | |
| 1827 | +it("uses the default startup argv hint for runtime fallback when argv1 is omitted", () => { |
| 1828 | +const root = makeTempDir(); |
| 1829 | +const distFile = path.join(root, "dist", "plugins", "runtime", "index.js"); |
| 1830 | +const loaderCacheRoot = makeTempDir(); |
| 1831 | +const loaderCachePath = path.join(loaderCacheRoot, "tsx", "openclaw-loader.js"); |
| 1832 | +const originalArgv1 = process.argv[1]; |
| 1833 | +mkdirSafeDir(path.dirname(distFile)); |
| 1834 | +mkdirSafeDir(path.dirname(loaderCachePath)); |
| 1835 | +mkdirSafeDir(path.join(root, "bin")); |
| 1836 | +fs.writeFileSync(distFile, "export const createPluginRuntime = () => ({});\n", "utf-8"); |
| 1837 | +fs.writeFileSync(loaderCachePath, "export {};\n", "utf-8"); |
| 1838 | + |
| 1839 | +process.argv[1] = path.join(root, "bin", "openclaw"); |
| 1840 | +try { |
| 1841 | +expect( |
| 1842 | +resolvePluginRuntimeModulePath({ |
| 1843 | +modulePath: loaderCachePath, |
| 1844 | +pluginSdkResolution: "dist", |
| 1845 | +}), |
| 1846 | +).toBe(distFile); |
| 1847 | +} finally { |
| 1848 | +process.argv[1] = originalArgv1; |
| 1849 | +} |
| 1850 | +}); |
| 1851 | + |
1827 | 1852 | it("reports loader, package root, and candidate paths when runtime resolution fails", () => { |
1828 | 1853 | const root = makeTempDir(); |
1829 | 1854 | const modulePath = path.join(root, "dist", "plugins", "loader.js"); |
|