fix: stabilize release smoke reruns

This commit is contained in:
Peter Steinberger
2026-04-19 09:04:58 +01:00
parent 6682b12563
commit 8c4ecf42df
4 changed files with 65 additions and 3 deletions

View File

@@ -362,6 +362,43 @@ describe("stageBundledPluginRuntimeDeps", () => {
expect(fs.existsSync(path.join(pluginDir, ".openclaw-runtime-deps-stamp.json"))).toBe(true);
});
it("skips missing optional runtime deps when copying the installed closure", () => {
const { pluginDir, repoRoot } = createBundledPluginFixture({
packageJson: {
name: "@openclaw/fixture-plugin",
version: "1.0.0",
dependencies: { direct: "1.0.0" },
optionalDependencies: { missingOptional: "1.0.0" },
openclaw: { bundle: { stageRuntimeDependencies: true } },
},
});
const directDir = path.join(repoRoot, "node_modules", "direct");
fs.mkdirSync(directDir, { recursive: true });
fs.writeFileSync(
path.join(directDir, "package.json"),
'{ "name": "direct", "version": "1.0.0", "optionalDependencies": { "native-extra": "1.0.0" } }\n',
"utf8",
);
fs.writeFileSync(path.join(directDir, "index.js"), "module.exports = 1;\n", "utf8");
let installCount = 0;
stageBundledPluginRuntimeDeps({
cwd: repoRoot,
installPluginRuntimeDepsImpl: () => {
installCount += 1;
},
});
expect(installCount).toBe(0);
expect(
fs.readFileSync(path.join(pluginDir, "node_modules", "direct", "index.js"), "utf8"),
).toBe("module.exports = 1;\n");
expect(fs.existsSync(path.join(pluginDir, "node_modules", "missingOptional"))).toBe(false);
expect(
fs.existsSync(path.join(pluginDir, "node_modules", "direct", "node_modules", "native-extra")),
).toBe(false);
});
it("prunes staged test cargo from copied runtime dependencies", () => {
const { pluginDir, repoRoot } = createBundledPluginFixture({
packageJson: {