Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

test(sdk): extract only the tar fixture asset under test (#1995)

Michael D'Angelo6467e0fbe24b
diff --git a/sdk/typescript/tests-ts/package-tar-listing.test.ts b/sdk/typescript/tests-ts/package-tar-listing.test.ts
index 490d4be1c..fd51b46cd 100644
--- a/sdk/typescript/tests-ts/package-tar-listing.test.ts
+++ b/sdk/typescript/tests-ts/package-tar-listing.test.ts
@@ -651,17 +651,16 @@ describe("npm package tar listings", () => {
}),
),
);
- const nativeRoot = join(root, "native");
- mkdirSync(nativeRoot);
+ const native = mkdtempSync(join(root, "native-"));
+ // The wrong-long-name fixtures have no portable asset path to select.
const extracted = await execFileAsync(
"tar",
- ["-xzf", archivePath, "-C", nativeRoot],
+ ["-xzf", archivePath, "-C", native, ...(wrongLongName ? [] : [path])],
{ encoding: "buffer", timeout: 30_000, windowsHide: true },
);
expect(extracted.stderr.toString()).toBe("");
- // These incompatible packages do not promise a portable native asset path.
if (!wrongLongName)
- expect(readFileSync(join(nativeRoot, path)).equals(logo)).toBe(true);
+ expect(readFileSync(join(native, path)).equals(logo)).toBe(true);
const contractPath = join(root, "contract.json");
writeFileSync(
contractPath,