chore(refactor): snapshot test baseline + no-regression gate truoc refactor open-sse
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -72,3 +72,6 @@ ecosystem.config.*
|
||||
scripts/agSniffer/*
|
||||
gitbooks/*
|
||||
gitbook/README.md
|
||||
|
||||
# Refactor backup reference (do not bundle/lint)
|
||||
open-sse.old/
|
||||
|
||||
1
tests/__baseline__/baseline-results.json
Normal file
1
tests/__baseline__/baseline-results.json
Normal file
File diff suppressed because one or more lines are too long
26
tests/__baseline__/known-fails.txt
Normal file
26
tests/__baseline__/known-fails.txt
Normal file
@@ -0,0 +1,26 @@
|
||||
tests/unit/antigravity-mitm.test.js :: Antigravity MITM model handling flags the out-of-box agent/Default model mandatory
|
||||
tests/unit/claude-header-forwarding.test.js :: proxyAwareFetch — api.anthropic.com routing routes api.anthropic.com to gotScraping (non-streaming) and returns ok response
|
||||
tests/unit/kiro-model-slots.test.js :: Kiro MITM model slots offers a mappable slot for the agent default model id 'auto'
|
||||
tests/unit/oauth-cursor-auto-import.test.js :: GET /api/oauth/cursor/auto-import extracts tokens using exact keys
|
||||
tests/unit/oauth-cursor-auto-import.test.js :: GET /api/oauth/cursor/auto-import falls back to fuzzy key matching on macOS when exact keys are missing
|
||||
tests/unit/oauth-cursor-auto-import.test.js :: GET /api/oauth/cursor/auto-import linux uses single hardcoded path and original error message
|
||||
tests/unit/oauth-cursor-auto-import.test.js :: GET /api/oauth/cursor/auto-import returns descriptive error if macOS db file exists but cannot be opened
|
||||
tests/unit/oauth-cursor-auto-import.test.js :: GET /api/oauth/cursor/auto-import returns login-prompt error when tokens are missing even after fallback
|
||||
tests/unit/oauth-cursor-auto-import.test.js :: GET /api/oauth/cursor/auto-import returns not-found when no macOS cursor db paths are accessible
|
||||
tests/unit/oauth-cursor-auto-import.test.js :: GET /api/oauth/cursor/auto-import unsupported platform returns 400
|
||||
tests/unit/oauth-cursor-auto-import.test.js :: GET /api/oauth/cursor/auto-import unwraps JSON-encoded string values
|
||||
tests/unit/openai-to-claude.test.js :: openaiToClaudeResponse omits empty Read pages tool argument before emitting Claude input deltas
|
||||
tests/unit/rtk.test.js :: RTK flag default off, toggle works
|
||||
tests/unit/rtk.test.js :: compressMessages (disabled) returns null when disabled
|
||||
tests/unit/rtk.test.js :: compressMessages (enabled) compresses Claude array-form tool_result text parts
|
||||
tests/unit/rtk.test.js :: compressMessages (enabled) compresses Claude string-form tool_result
|
||||
tests/unit/rtk.test.js :: compressMessages (enabled) compresses OpenAI tool message (string content)
|
||||
tests/unit/rtk.test.js :: compressMessages (enabled) handles mix of messages without crashing
|
||||
tests/unit/rtk.test.js :: compressMessages (enabled) never produces empty content (R14 guard)
|
||||
tests/unit/rtk.test.js :: compressMessages (enabled) skips below MIN_COMPRESS_SIZE (<500 bytes)
|
||||
tests/unit/rtk.test.js :: compressMessages (enabled) skips is_error tool_result
|
||||
tests/unit/rtk.test.js :: compressMessages (enabled) skips when body has no messages
|
||||
tests/unit/translator-request-normalization.test.js :: request normalization claudeToOpenAIRequest flattens text-only content arrays into string
|
||||
tests/unit/translator-request-normalization.test.js :: request normalization filterToOpenAIFormat flattens text-only arrays to string
|
||||
tests/unit/translator-request-normalization.test.js :: request normalization parseSSELine supports provider raw NDJSON stream lines
|
||||
tests/unit/translator-request-normalization.test.js :: request normalization translateRequest keeps /v1/messages Claude->OpenAI text payloads string-safe
|
||||
28
tests/__baseline__/verify-no-regression.mjs
Normal file
28
tests/__baseline__/verify-no-regression.mjs
Normal file
@@ -0,0 +1,28 @@
|
||||
// Gate: so kết quả test hiện tại với baseline known-fails.
|
||||
// PASS nếu KHÔNG có test nào pass(baseline) → fail(now). Test mới được phép.
|
||||
// Usage: node tests/__baseline__/verify-no-regression.mjs <current-results.json>
|
||||
import { readFileSync } from "fs";
|
||||
|
||||
const knownFails = new Set(
|
||||
readFileSync(new URL("./known-fails.txt", import.meta.url), "utf8")
|
||||
.split("\n").map(s => s.trim()).filter(Boolean)
|
||||
);
|
||||
|
||||
const resultsPath = process.argv[2];
|
||||
if (!resultsPath) { console.error("Missing results.json path"); process.exit(2); }
|
||||
|
||||
const r = JSON.parse(readFileSync(resultsPath, "utf8"));
|
||||
const nowFails = r.testResults.flatMap(f =>
|
||||
f.assertionResults.filter(a => a.status === "failed")
|
||||
.map(a => f.name.split("/app/")[1] + " :: " + a.fullName)
|
||||
);
|
||||
|
||||
// Regression = fail bây giờ NHƯNG không có trong baseline known-fails
|
||||
const regressions = nowFails.filter(f => !knownFails.has(f));
|
||||
|
||||
if (regressions.length) {
|
||||
console.error(`\n❌ REGRESSION: ${regressions.length} test pass→fail:\n`);
|
||||
regressions.forEach(f => console.error(" - " + f));
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(`✅ No regression. (now fails=${nowFails.length}, baseline known=${knownFails.size}, all known)`);
|
||||
Reference in New Issue
Block a user