Improve alias tests per CodeRabbit review

- Add verification that skipped packages don't appear in 'bun pm untrusted' output
- Add comment explaining that skipScriptsFrom accepts both alias and canonical names

This ensures the tests comprehensively verify that skipped packages are not
just excluded from the blocked count, but also from the untrusted dependencies
list entirely.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude Bot
2025-10-20 17:47:42 +00:00
parent 70ae7f2c92
commit fba94bbcdb

View File

@@ -3016,6 +3016,21 @@ for (const forceWaiterThread of isLinux ? [false, true] : [false]) {
expect(await exists(join(depDir, "preinstall.txt"))).toBeFalse();
expect(await exists(join(depDir, "install.txt"))).toBeFalse();
expect(await exists(join(depDir, "postinstall.txt"))).toBeFalse();
// Verify skipped packages don't appear in untrusted list
({ stdout, stderr, exited } = spawn({
cmd: [bunExe(), "pm", "untrusted"],
cwd: packageDir,
stdout: "pipe",
stderr: "pipe",
env: testEnv,
}));
out = await stdout.text();
err = await stderr.text();
expect(err).not.toContain("error:");
expect(out).not.toContain("all-lifecycle-scripts");
expect(await exited).toBe(0);
});
test("skipScriptsFrom works with aliased dependencies (default list)", async () => {
@@ -3122,6 +3137,7 @@ for (const forceWaiterThread of isLinux ? [false, true] : [false]) {
expect(await exists(join(scriptsDir, "prepare.txt"))).toBeTrue(); // prepare always runs
});
// skipScriptsFrom accepts either the dependency alias or canonical package name for flexibility
test("skipScriptsFrom by alias name", async () => {
const testEnv = forceWaiterThread ? { ...env, BUN_FEATURE_FLAG_FORCE_WAITER_THREAD: "1" } : env;
await writeFile(