diff --git a/.github/workflows/run_tests.yaml b/.github/workflows/run_tests.yaml index fd71199..dfd7770 100644 --- a/.github/workflows/run_tests.yaml +++ b/.github/workflows/run_tests.yaml @@ -47,11 +47,15 @@ jobs: - name: Install gptscript run: | curl https://get.gptscript.ai/releases/default_windows_amd64_v1/gptscript.exe -o gptscript.exe + - name: Create config file + run: | + echo '{"credsStore":"file"}' > config - name: Install dependencies run: npm install - name: Run Tests env: GPTSCRIPT_BIN: .\gptscript.exe + GPTSCRIPT_CONFIG_FILE: .\config OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} NODE_GPTSCRIPT_SKIP_INSTALL_BINARY: true run: npm test diff --git a/tests/gptscript.test.ts b/tests/gptscript.test.ts index 81a3a20..702e32c 100644 --- a/tests/gptscript.test.ts +++ b/tests/gptscript.test.ts @@ -401,21 +401,24 @@ describe("gptscript module", () => { }, 10000) test("confirm", async () => { - let confirmFound = false const t = { instructions: "List the files in the current working directory.", tools: ["sys.exec"] } + + const commands = [`"ls"`, `"dir"`] + let confirmCallCount = 0 const run = await g.evaluate(t, {confirm: true}) run.on(gptscript.RunEventType.CallConfirm, async (data: gptscript.CallFrame) => { - expect(data.input).toContain(`"ls"`) - confirmFound = true + // On Windows, ls is not always a command. The LLM will try to run dir in this case. Allow both. + expect(data.input).toContain(commands[confirmCallCount]) + confirmCallCount++ await g.confirm({id: data.id, accept: true}) }) expect(await run.text()).toContain("README.md") expect(run.err).toEqual("") - expect(confirmFound).toBeTruthy() + expect(confirmCallCount > 0).toBeTruthy() }) test("do not confirm", async () => {