test(server): the ACP registry's fake npm is a fixture file, not a generated string (#15483)

Signed-off-by: Yordis Prieto <[email protected]>
This commit is contained in:
Yordis Prieto authored and GitHub committed 2026-10-03 21:51:44 -07:00
1 parent 070127cbb7
commit 1508552a16
2 files changed
+25 -25

No files matched your search

@@ -78,32 +78,11 @@ const makeFakeNpmToolchain = Effect.fn("AcpRegistrySupport.test.makeFakeNpmToolc
yield* fileSystem.makeDirectory(toolchainBin, { recursive: true });
yield* fileSystem.makeDirectory(globalPrefix, { recursive: true });
yield* fileSystem.writeFileString(logPath, "");
yield* fileSystem.writeFileString(
yield* fileSystem.copyFile(
yield* path.fromFileUrl(
new URL("./testing/AcpRegistrySupport.npm.fixture.sh", import.meta.url),
),
npmPath,
[
"#!/bin/sh",
'printf \'%s\\n\' "$*" >> "$FAKE_NPM_LOG"',
'prefix="${npm_config_prefix:-$FAKE_NPM_PREFIX}"',
'if [ "$1" = "root" ] && [ "$2" = "--global" ]; then',
" printf '%s\\n' \"$prefix/lib/node_modules\"",
" exit 0",
"fi",
'if [ "$1" = "prefix" ] && [ "$2" = "--global" ]; then',
" printf '%s\\n' \"$prefix\"",
" exit 0",
"fi",
'if [ "$1" = "install" ] && [ "$2" = "--global" ]; then',
' package_root="$prefix/lib/node_modules/@example/acp"',
' executable="$prefix/bin/example-agent"',
' mkdir -p "$package_root" "$prefix/bin"',
' printf \'%s\' "$FAKE_NPM_MANIFEST" > "$package_root/package.json"',
" printf '#!/bin/sh\\n' > \"$executable\"",
' chmod 755 "$executable"',
" exit 0",
"fi",
"exit 64",
"",
].join("\n"),
);
yield* fileSystem.chmod(npmPath, 0o755);
return {
@@ -0,0 +1,21 @@
#!/bin/sh
printf '%s\n' "$*" >> "$FAKE_NPM_LOG"
prefix="${npm_config_prefix:-$FAKE_NPM_PREFIX}"
if [ "$1" = "root" ] && [ "$2" = "--global" ]; then
printf '%s\n' "$prefix/lib/node_modules"
exit 0
fi
if [ "$1" = "prefix" ] && [ "$2" = "--global" ]; then
printf '%s\n' "$prefix"
exit 0
fi
if [ "$1" = "install" ] && [ "$2" = "--global" ]; then
package_root="$prefix/lib/node_modules/@example/acp"
executable="$prefix/bin/example-agent"
mkdir -p "$package_root" "$prefix/bin"
printf '%s' "$FAKE_NPM_MANIFEST" > "$package_root/package.json"
printf '#!/bin/sh\n' > "$executable"
chmod 755 "$executable"
exit 0
fi
exit 64