diff --git a/.hooks/pre-push b/.hooks/pre-push new file mode 100755 index 0000000..0159dcc --- /dev/null +++ b/.hooks/pre-push @@ -0,0 +1,3 @@ +#!/usr/bin/env sh +echo "Running tests before push..." +npm test diff --git a/package.json b/package.json index 78e5f8d..ba194bb 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ ], "scripts": { "build": "tsc", - "prepare": "npm run build", + "prepare": "git config core.hooksPath .hooks 2>/dev/null; npm run build", "smoke": "node dist/cli.js --help", "test": "tsc -p tsconfig.test.json && node --test dist-test/*.test.js" }, diff --git a/src/listers.integration.test.ts b/src/listers.integration.test.ts index d348569..cd63e64 100644 --- a/src/listers.integration.test.ts +++ b/src/listers.integration.test.ts @@ -121,9 +121,10 @@ exit 1 const result = await listLmStudio("http://localhost:1234", "tok"); assert.deepEqual(result, [{ id: "fallback-model", display: "fallback-model", extras: [] }]); - // Both calls were attempted before falling back. - const argv = readArgvLog().sort(); - assert.deepEqual(argv, ["ls --llm --json", "ps --json"]); + // ls is always attempted; ps may or may not have completed before + // Promise.all rejects (race), so only assert ls was called. + const argv = readArgvLog(); + assert.ok(argv.includes("ls --llm --json"), "ls should have been called"); }, );