This commit is contained in:
abhinav7x94 2026-08-26 04:01:27 +05:30 • committed by GitHub
commit a729830a39
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 81 additions and 7 deletions

View file

@ -0,0 +1,53 @@
import { describe, expect, it } from "bun:test"
import path from "node:path"
const asyncEntrypoints = [
"tests/typescript/quickstart.ts",
"tests/typescript/sdk.ts",
"tests/typescript/search.ts",
"tests/typescript/user-profiles.ts",
"tests/integrations/ai-sdk.ts",
"tests/integrations/claude-memory.ts",
"tests/integrations/openai-sdk.ts",
]
describe("TypeScript docs test entrypoints", () => {
it("exits unsuccessfully when an async test rejects", async () => {
const child = Bun.spawn(
[
process.execPath,
"run",
path.join(import.meta.dir, "tests/typescript/quickstart.ts"),
],
{
cwd: import.meta.dir,
env: {
...Bun.env,
SUPERMEMORY_API_KEY: "offline-test-key",
SUPERMEMORY_BASE_URL: "http://127.0.0.1:65536",
},
stdout: "ignore",
stderr: "pipe",
},
)
const [exitCode, stderr] = await Promise.all([
child.exited,
new Response(child.stderr).text(),
])
expect(exitCode).toBe(1)
expect(stderr).toContain("ERR_INVALID_URL")
})
it("marks every registered async entrypoint failure as unsuccessful", async () => {
for (const relativePath of asyncEntrypoints) {
const source = await Bun.file(
path.join(import.meta.dir, relativePath),
).text()
expect(source).not.toContain("main().catch(console.error)")
expect(source).toContain("process.exitCode = 1")
}
})
})

View file

@ -118,4 +118,7 @@ async function main() {
console.log("✅ All AI SDK tests passed!")
}
main().catch(console.error)
main().catch((error) => {
console.error(error)
process.exitCode = 1
})

View file

@ -102,4 +102,7 @@ async function main() {
console.log("✅ All Claude Memory tests passed!")
}
main().catch(console.error)
main().catch((error) => {
console.error(error)
process.exitCode = 1
})

View file

@ -83,4 +83,7 @@ async function main() {
console.log("✅ All OpenAI SDK tests passed!")
}
main().catch(console.error)
main().catch((error) => {
console.error(error)
process.exitCode = 1
})

View file

@ -54,4 +54,7 @@ ${profile.searchResults?.results.map((r) => r.content).join("\n")}`
console.log("\n✅ Quickstart TypeScript test passed!")
}
main().catch(console.error)
main().catch((error) => {
console.error(error)
process.exitCode = 1
})

View file

@ -148,4 +148,7 @@ async function main() {
console.log("✅ All TypeScript SDK tests passed!")
}
main().catch(console.error)
main().catch((error) => {
console.error(error)
process.exitCode = 1
})

View file

@ -115,4 +115,7 @@ async function main() {
console.log("✅ All search tests passed!")
}
main().catch(console.error)
main().catch((error) => {
console.error(error)
process.exitCode = 1
})

View file

@ -90,4 +90,7 @@ async function main() {
console.log("✅ All user profile tests passed!")
}
main().catch(console.error)
main().catch((error) => {
console.error(error)
process.exitCode = 1
})