Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/lib/evals/evalRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,11 @@ export function evaluateCase(evalCase: any, actualOutput: string) {
}
const regex =
expectedValue instanceof RegExp
? new RegExp(expectedValue.source, expectedValue.flags.replace(/[gy]/g, ""))
: new RegExp(expectedValue);
? new RegExp(
expectedValue.source,
(expectedValue.flags.replace(/[gy]/g, "") + "s").split("").sort().join("")
)
: new RegExp(expectedValue, "s");
if (regex.source.length > 512) {
passed = false;
details.error = "Regex pattern too large for safe evaluation.";
Expand Down
24 changes: 24 additions & 0 deletions tests/unit/combo-silent-stop-gaps.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,30 @@ test("G7: benign regex still evaluates normally", () => {
assert.equal(result.passed, true);
});


test("G7: regex with dotAll matches multiline answers", () => {
const result = evaluateCase(
{
id: "dotall-test",
name: "dotall-test",
expected: { strategy: "regex", value: "hello.*world" },
},
"hello\nworld"
);
assert.equal(result.passed, true, "dotAll regex should match across newlines");
});

test("G7: RegExp object with dotAll flag works correctly", () => {
const result = evaluateCase(
{
id: "dotall-regex-obj",
name: "dotall-regex-obj",
expected: { strategy: "regex", value: /hello.*world/ },
},
"hello\nworld"
);
assert.equal(result.passed, true, "RegExp with dotAll should match across newlines");
});
// ── G8: autoRefreshDaemon logs network errors per provider ──────────────────
test("G8: autoRefreshDaemon logs network errors instead of swallowing them", async () => {
const { autoRefreshDaemon } = await import("../../open-sse/services/autoRefreshDaemon.ts");
Expand Down
Loading