test: pin PXPIPE_MODELS in savings-math e2e so CI is hermetic

The GPT tests drive gpt-5.6-sol, which is intentionally outside the
built-in default scope (Fable 5 only). Without pinning, the file's
result depended on the developer's ambient PXPIPE_MODELS — passing
locally but failing in CI's clean env. Snapshot/pin/restore, same
convention as proxy-usage.test.ts.
This commit is contained in:
teamchong
2026-07-09 22:41:42 -04:00
parent cd4c9efddd
commit 5deffdc757
+16 -1
View File
@@ -19,10 +19,25 @@
*
* Run just this file: pnpm vitest run tests/savings-math-e2e.test.ts
*/
import { describe, expect, it } from 'vitest';
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
import { createProxy, type ProxyEvent } from '../src/core/proxy.js';
import { countTokens as o200k } from 'gpt-tokenizer/encoding/o200k_base';
// The GPT tests below drive 'gpt-5.6-sol', which is intentionally absent from
// the built-in default scope (Fable 5 only). Pin PXPIPE_MODELS so the suite is
// deterministic regardless of the developer's shell (same convention as
// proxy-usage.test.ts) — without this, the file passes or fails depending on
// ambient env, which is exactly what broke CI.
let ambientPxpipeModels: string | undefined;
beforeAll(() => {
ambientPxpipeModels = process.env.PXPIPE_MODELS;
process.env.PXPIPE_MODELS = 'claude-fable-5,gpt-5.6-sol';
});
afterAll(() => {
if (ambientPxpipeModels === undefined) delete process.env.PXPIPE_MODELS;
else process.env.PXPIPE_MODELS = ambientPxpipeModels;
});
const PROBE_TOKENS = 9999; // canned count_tokens result from the fake upstream
function fakeUpstream() {