mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-10-06 02:47:54 +00:00
Merge b84f672327 into 3f7b9667c6
This commit is contained in:
commit
a729830a39
8 changed files with 81 additions and 7 deletions
53
packages/docs-test/entrypoint-exit.test.ts
Normal file
53
packages/docs-test/entrypoint-exit.test.ts
Normal 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")
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
@ -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
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue