@quikit/quikpilot-runner 9.3.0-rc.47 → 9.3.0-rc.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/index.js +390 -65
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26434,7 +26434,7 @@ pp$8.enterClassBody = function() {
|
|
|
26434
26434
|
};
|
|
26435
26435
|
pp$8.exitClassBody = function() {
|
|
26436
26436
|
var ref2 = this.privateNameStack.pop();
|
|
26437
|
-
var
|
|
26437
|
+
var declared2 = ref2.declared;
|
|
26438
26438
|
var used = ref2.used;
|
|
26439
26439
|
if (!this.options.checkPrivateFields) {
|
|
26440
26440
|
return;
|
|
@@ -26443,7 +26443,7 @@ pp$8.exitClassBody = function() {
|
|
|
26443
26443
|
var parent = len === 0 ? null : this.privateNameStack[len - 1];
|
|
26444
26444
|
for (var i2 = 0; i2 < used.length; ++i2) {
|
|
26445
26445
|
var id = used[i2];
|
|
26446
|
-
if (!hasOwn(
|
|
26446
|
+
if (!hasOwn(declared2, id.name)) {
|
|
26447
26447
|
if (parent) {
|
|
26448
26448
|
parent.used.push(id);
|
|
26449
26449
|
} else {
|
|
@@ -33516,6 +33516,11 @@ var ALLOWED_NAMES = /* @__PURE__ */ new Set([
|
|
|
33516
33516
|
"PIPX_HOME",
|
|
33517
33517
|
"PIPX_BIN_DIR",
|
|
33518
33518
|
"POETRY_HOME",
|
|
33519
|
+
// QUIKTR-1699: PHP projects (Composer, set up by shivammathur/setup-php).
|
|
33520
|
+
"COMPOSER_HOME",
|
|
33521
|
+
"COMPOSER_CACHE_DIR",
|
|
33522
|
+
"COMPOSER_NO_INTERACTION",
|
|
33523
|
+
"PHP_INI_SCAN_DIR",
|
|
33519
33524
|
"PNPM_HOME",
|
|
33520
33525
|
"BUN_INSTALL",
|
|
33521
33526
|
"DENO_INSTALL",
|
|
@@ -33896,7 +33901,220 @@ var import_node_path9 = require("node:path");
|
|
|
33896
33901
|
// src/quiktest.ts
|
|
33897
33902
|
var import_node_fs6 = require("node:fs");
|
|
33898
33903
|
var import_node_path8 = require("node:path");
|
|
33904
|
+
|
|
33905
|
+
// src/caseTags.ts
|
|
33906
|
+
var MAX_CASE_TESTS = 50;
|
|
33907
|
+
var MAX_TEXT = 300;
|
|
33908
|
+
var CASE_ID_RE = /^QP-[A-Z][A-Z0-9]*-\d+-\d+$/;
|
|
33909
|
+
var TOKEN_RE = /\[QP-[A-Z][A-Z0-9]*-\d+-\d+\]/;
|
|
33910
|
+
var declared = [];
|
|
33911
|
+
function readCaseTests(value, allowedIds) {
|
|
33912
|
+
if (!Array.isArray(value)) return [];
|
|
33913
|
+
const allowed = new Set(allowedIds);
|
|
33914
|
+
const out = /* @__PURE__ */ new Map();
|
|
33915
|
+
for (const item of value.slice(0, MAX_CASE_TESTS)) {
|
|
33916
|
+
if (typeof item !== "object" || item === null) continue;
|
|
33917
|
+
const o = item;
|
|
33918
|
+
const ok = (v) => typeof v === "string" && v.trim().length > 0 && v.length <= MAX_TEXT;
|
|
33919
|
+
if (!ok(o.caseId) || !ok(o.path) || !ok(o.testName)) continue;
|
|
33920
|
+
const caseId = o.caseId.trim();
|
|
33921
|
+
if (!CASE_ID_RE.test(caseId) || allowed.size > 0 && !allowed.has(caseId)) continue;
|
|
33922
|
+
out.set(caseId, { caseId, path: normalisePath(o.path), testName: o.testName.trim() });
|
|
33923
|
+
}
|
|
33924
|
+
return [...out.values()];
|
|
33925
|
+
}
|
|
33926
|
+
function addCaseTests(list2) {
|
|
33927
|
+
const byId = new Map(declared.map((d) => [d.caseId, d]));
|
|
33928
|
+
for (const d of list2) byId.set(d.caseId, d);
|
|
33929
|
+
declared = [...byId.values()];
|
|
33930
|
+
}
|
|
33931
|
+
function declaredIn(caseId, written) {
|
|
33932
|
+
const d = declared.find((x) => x.caseId === caseId);
|
|
33933
|
+
if (!d) return false;
|
|
33934
|
+
for (const [path, text2] of written) if (samePath(path, d.path) && text2.includes(bareName(d.testName))) return true;
|
|
33935
|
+
return false;
|
|
33936
|
+
}
|
|
33937
|
+
function idCoversCase(testId, caseId) {
|
|
33938
|
+
if (testId.includes(`[${caseId}]`)) return true;
|
|
33939
|
+
const d = declared.find((x) => x.caseId === caseId);
|
|
33940
|
+
if (!d) return false;
|
|
33941
|
+
const at2 = testId.indexOf("::");
|
|
33942
|
+
const c = at2 < 0 ? { name: testId } : { classname: testId.slice(0, at2), name: testId.slice(at2 + 2) };
|
|
33943
|
+
if (!nameMatches(c.name, d.testName)) return false;
|
|
33944
|
+
return placeOf(c) === null || placeMatches(c, d.path);
|
|
33945
|
+
}
|
|
33946
|
+
function declaredFileOf(caseId) {
|
|
33947
|
+
return declared.find((x) => x.caseId === caseId)?.path ?? null;
|
|
33948
|
+
}
|
|
33949
|
+
function sameFile2(a, b) {
|
|
33950
|
+
return samePath(a, b);
|
|
33951
|
+
}
|
|
33952
|
+
function tagNames(cases, list2 = declared) {
|
|
33953
|
+
const names = cases.map((c) => c.name);
|
|
33954
|
+
for (const d of list2) {
|
|
33955
|
+
const matching = [];
|
|
33956
|
+
cases.forEach((c, i2) => {
|
|
33957
|
+
if (!TOKEN_RE.test(names[i2]) && nameMatches(c.name, d.testName)) matching.push(i2);
|
|
33958
|
+
});
|
|
33959
|
+
if (matching.length === 0) continue;
|
|
33960
|
+
const placed = matching.filter((i2) => placeOf(cases[i2]) !== null);
|
|
33961
|
+
let chosen;
|
|
33962
|
+
if (placed.length > 0) chosen = placed.filter((i2) => placeMatches(cases[i2], d.path));
|
|
33963
|
+
else chosen = matching.length === 1 || matching.every((i2) => isRowOf(cases[i2].name, d.testName)) ? matching : [];
|
|
33964
|
+
for (const i2 of chosen) names[i2] = `[${d.caseId}] ${names[i2]}`;
|
|
33965
|
+
}
|
|
33966
|
+
return names;
|
|
33967
|
+
}
|
|
33968
|
+
var SEPARATORS = [" ", " > ", " \u203A ", "::", ".", "/", "#"];
|
|
33969
|
+
function bareName(n) {
|
|
33970
|
+
return n.trim().replace(/\(\)$/, "");
|
|
33971
|
+
}
|
|
33972
|
+
function isRowOf(name, testName) {
|
|
33973
|
+
const n = bareName(name);
|
|
33974
|
+
const t = bareName(testName);
|
|
33975
|
+
return n === t || n.startsWith(`${t}[`) || n.startsWith(`${t}/`);
|
|
33976
|
+
}
|
|
33977
|
+
function nameMatches(name, testName) {
|
|
33978
|
+
const n = bareName(name);
|
|
33979
|
+
const t = bareName(testName);
|
|
33980
|
+
if (!t) return false;
|
|
33981
|
+
if (isRowOf(n, t)) return true;
|
|
33982
|
+
return SEPARATORS.some((s) => n.endsWith(`${s}${t}`) || n.includes(`${s}${t}[`));
|
|
33983
|
+
}
|
|
33984
|
+
function normalisePath(p) {
|
|
33985
|
+
return p.trim().replace(/\\/g, "/").replace(/^(\.\/)+/, "").replace(/^\/+/, "");
|
|
33986
|
+
}
|
|
33987
|
+
function samePath(a, b) {
|
|
33988
|
+
const x = normalisePath(a);
|
|
33989
|
+
const y = normalisePath(b);
|
|
33990
|
+
return x === y || x.endsWith(`/${y}`) || y.endsWith(`/${x}`);
|
|
33991
|
+
}
|
|
33992
|
+
var FILE_EXT_RE = /\.[A-Za-z0-9]{1,6}$/;
|
|
33993
|
+
function placeOf(c) {
|
|
33994
|
+
if (c.file && c.file.trim()) return { file: c.file };
|
|
33995
|
+
const cls = c.classname?.trim();
|
|
33996
|
+
if (!cls) return null;
|
|
33997
|
+
if (/[\\/]/.test(cls) && FILE_EXT_RE.test(cls)) return { file: cls };
|
|
33998
|
+
const parts = cls.split(/[\\/.]|::/).filter(Boolean);
|
|
33999
|
+
return parts.length > 1 ? { parts } : null;
|
|
34000
|
+
}
|
|
34001
|
+
function placeMatches(c, path) {
|
|
34002
|
+
const place = placeOf(c);
|
|
34003
|
+
if (!place) return false;
|
|
34004
|
+
if ("file" in place) return samePath(place.file, path);
|
|
34005
|
+
const segs = normalisePath(path).replace(FILE_EXT_RE, "").split(/[/.]/).filter(Boolean);
|
|
34006
|
+
const cls = place.parts;
|
|
34007
|
+
for (let k2 = Math.min(cls.length, segs.length); k2 >= 1; k2--) {
|
|
34008
|
+
if (cls.slice(0, k2).join("/") === segs.slice(-k2).join("/")) return true;
|
|
34009
|
+
}
|
|
34010
|
+
const dir = segs.slice(0, -1);
|
|
34011
|
+
if (dir.length === 0) return false;
|
|
34012
|
+
const k = Math.min(dir.length, cls.length);
|
|
34013
|
+
return cls.slice(-k).join("/") === dir.slice(-k).join("/");
|
|
34014
|
+
}
|
|
34015
|
+
var TESTCASE_TAG_RE = /<testcase\b([^>]*?)(\/?>)/g;
|
|
34016
|
+
var ATTR = (name) => new RegExp(`\\b${name}="([^"]*)"`);
|
|
34017
|
+
var unescape = (s) => s.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
34018
|
+
var escape = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
34019
|
+
function tagReportXml(xml, list2 = declared) {
|
|
34020
|
+
if (list2.length === 0) return xml;
|
|
34021
|
+
const cases = [];
|
|
34022
|
+
for (const m of xml.matchAll(TESTCASE_TAG_RE)) {
|
|
34023
|
+
const attrs = m[1] ?? "";
|
|
34024
|
+
const name = ATTR("name").exec(attrs)?.[1];
|
|
34025
|
+
const classname = ATTR("classname").exec(attrs)?.[1];
|
|
34026
|
+
const file = ATTR("file").exec(attrs)?.[1];
|
|
34027
|
+
cases.push({ name: name === void 0 ? "" : unescape(name), ...classname !== void 0 ? { classname: unescape(classname) } : {}, ...file !== void 0 ? { file: unescape(file) } : {} });
|
|
34028
|
+
}
|
|
34029
|
+
const tagged = tagNames(cases, list2);
|
|
34030
|
+
if (tagged.every((n, i3) => n === cases[i3].name)) return xml;
|
|
34031
|
+
let i2 = 0;
|
|
34032
|
+
return xml.replace(TESTCASE_TAG_RE, (whole4, attrs, close) => {
|
|
34033
|
+
const index = i2++;
|
|
34034
|
+
const name = tagged[index];
|
|
34035
|
+
if (name === cases[index].name || !ATTR("name").test(attrs)) return whole4;
|
|
34036
|
+
return `<testcase${attrs.replace(ATTR("name"), () => `name="${escape(name)}"`)}${close}`;
|
|
34037
|
+
});
|
|
34038
|
+
}
|
|
34039
|
+
|
|
34040
|
+
// src/quiktest.ts
|
|
33899
34041
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git"]);
|
|
34042
|
+
var DEPENDENCY_DIRS = /* @__PURE__ */ new Set([
|
|
34043
|
+
"node_modules",
|
|
34044
|
+
".git",
|
|
34045
|
+
".venv",
|
|
34046
|
+
"venv",
|
|
34047
|
+
"vendor",
|
|
34048
|
+
"site-packages",
|
|
34049
|
+
".tox",
|
|
34050
|
+
".gradle",
|
|
34051
|
+
"__pycache__",
|
|
34052
|
+
".pytest_cache",
|
|
34053
|
+
".mypy_cache",
|
|
34054
|
+
"bower_components",
|
|
34055
|
+
// The runner's own copy of a failed run's final report (failureArtifact.ts FAILURE_ARTIFACT_DIR): never a report of a test run.
|
|
34056
|
+
"quikpilot-failure"
|
|
34057
|
+
]);
|
|
34058
|
+
var MAX_REPORTS = 500;
|
|
34059
|
+
function isJUnitXml(path) {
|
|
34060
|
+
let fd = null;
|
|
34061
|
+
try {
|
|
34062
|
+
fd = (0, import_node_fs6.openSync)(path, "r");
|
|
34063
|
+
const buf = Buffer.alloc(2048);
|
|
34064
|
+
const n = (0, import_node_fs6.readSync)(fd, buf, 0, buf.length, 0);
|
|
34065
|
+
const head = buf.subarray(0, n).toString("utf8").replace(/^\uFEFF/, "");
|
|
34066
|
+
const body = head.replace(/<\?[\s\S]*?\?>/g, "").replace(/<!--[\s\S]*?-->/g, "").trimStart();
|
|
34067
|
+
return /^<testsuites?\b/.test(body);
|
|
34068
|
+
} catch {
|
|
34069
|
+
return false;
|
|
34070
|
+
} finally {
|
|
34071
|
+
if (fd !== null) (0, import_node_fs6.closeSync)(fd);
|
|
34072
|
+
}
|
|
34073
|
+
}
|
|
34074
|
+
function findJUnitReports(cwd = process.cwd(), opts = {}) {
|
|
34075
|
+
const found = [];
|
|
34076
|
+
const walk2 = (dir) => {
|
|
34077
|
+
if (found.length >= MAX_REPORTS) return;
|
|
34078
|
+
let entries;
|
|
34079
|
+
try {
|
|
34080
|
+
entries = (0, import_node_fs6.readdirSync)(dir);
|
|
34081
|
+
} catch {
|
|
34082
|
+
return;
|
|
34083
|
+
}
|
|
34084
|
+
for (const entry of entries) {
|
|
34085
|
+
if (DEPENDENCY_DIRS.has(entry)) continue;
|
|
34086
|
+
const full = (0, import_node_path8.join)(dir, entry);
|
|
34087
|
+
let stat;
|
|
34088
|
+
try {
|
|
34089
|
+
stat = (0, import_node_fs6.statSync)(full);
|
|
34090
|
+
} catch {
|
|
34091
|
+
continue;
|
|
34092
|
+
}
|
|
34093
|
+
if (stat.isDirectory()) walk2(full);
|
|
34094
|
+
else if (/\.xml$/i.test(entry) && (opts.freshSinceMs === void 0 || stat.mtimeMs >= opts.freshSinceMs) && isJUnitXml(full)) {
|
|
34095
|
+
found.push(full);
|
|
34096
|
+
if (found.length >= MAX_REPORTS) return;
|
|
34097
|
+
}
|
|
34098
|
+
}
|
|
34099
|
+
};
|
|
34100
|
+
walk2(cwd);
|
|
34101
|
+
const named = (p) => /^junit.*\.xml$/i.test(p.split(/[\\/]/).pop() ?? "") ? 0 : 1;
|
|
34102
|
+
return found.sort((a, b) => named(a) - named(b) || a.localeCompare(b));
|
|
34103
|
+
}
|
|
34104
|
+
function mergeJUnitReports(texts) {
|
|
34105
|
+
if (texts.length === 1) return texts[0];
|
|
34106
|
+
const inner = texts.map((t) => {
|
|
34107
|
+
const body = t.replace(/^\uFEFF/, "").replace(/<\?xml[\s\S]*?\?>/, "").trim();
|
|
34108
|
+
const wrapped = /^<testsuites\b[^>]*>([\s\S]*)<\/testsuites>\s*$/.exec(body);
|
|
34109
|
+
if (wrapped) return wrapped[1].trim();
|
|
34110
|
+
return /^<testsuites\b[^>]*\/>\s*$/.test(body) ? "" : body;
|
|
34111
|
+
});
|
|
34112
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
34113
|
+
<testsuites>
|
|
34114
|
+
${inner.filter(Boolean).join("\n")}
|
|
34115
|
+
</testsuites>
|
|
34116
|
+
`;
|
|
34117
|
+
}
|
|
33900
34118
|
function walkForJUnitByName(dir) {
|
|
33901
34119
|
let entries;
|
|
33902
34120
|
try {
|
|
@@ -33934,14 +34152,16 @@ function firstXmlIn(dir, namePattern) {
|
|
|
33934
34152
|
}
|
|
33935
34153
|
function readTestReportBytes(cwd = process.cwd()) {
|
|
33936
34154
|
try {
|
|
33937
|
-
const
|
|
33938
|
-
|
|
34155
|
+
const reports = findJUnitReports(cwd);
|
|
34156
|
+
if (reports.length === 0) return null;
|
|
34157
|
+
if (reports.length === 1) return (0, import_node_fs6.readFileSync)(reports[0]);
|
|
34158
|
+
return Buffer.from(mergeJUnitReports(reports.map((r) => (0, import_node_fs6.readFileSync)(r, "utf8"))), "utf8");
|
|
33939
34159
|
} catch {
|
|
33940
34160
|
return null;
|
|
33941
34161
|
}
|
|
33942
34162
|
}
|
|
33943
34163
|
function findJUnitReport(cwd = process.cwd()) {
|
|
33944
|
-
return walkForJUnitByName(cwd) ?? firstXmlIn((0, import_node_path8.join)(cwd, "test-results"), /\.xml$/) ?? firstXmlIn((0, import_node_path8.join)(cwd, "reports"), /^junit.*\.xml$/) ?? firstXmlIn((0, import_node_path8.join)(cwd, "target", "surefire-reports"), /\.xml$/);
|
|
34164
|
+
return walkForJUnitByName(cwd) ?? findJUnitReports(cwd)[0] ?? firstXmlIn((0, import_node_path8.join)(cwd, "test-results"), /\.xml$/) ?? firstXmlIn((0, import_node_path8.join)(cwd, "reports"), /^junit.*\.xml$/) ?? firstXmlIn((0, import_node_path8.join)(cwd, "target", "surefire-reports"), /\.xml$/);
|
|
33945
34165
|
}
|
|
33946
34166
|
function buildCiUrl(serverUrl, repository, githubRunId) {
|
|
33947
34167
|
return `${serverUrl}/${repository}/actions/runs/${githubRunId}`;
|
|
@@ -33957,16 +34177,15 @@ async function reportToQuikTest(params) {
|
|
|
33957
34177
|
console.log("packet.quikTest is null \u2014 this run has no QuikTest run to report into.");
|
|
33958
34178
|
return null;
|
|
33959
34179
|
}
|
|
33960
|
-
const
|
|
33961
|
-
if (
|
|
34180
|
+
const reports = findJUnitReports(cwd);
|
|
34181
|
+
if (reports.length === 0) {
|
|
33962
34182
|
console.warn("::warning::QuikPilot found no JUnit report \u2014 no results reported to QuikTest.");
|
|
33963
34183
|
return null;
|
|
33964
34184
|
}
|
|
33965
34185
|
try {
|
|
33966
|
-
console.log(`reporting ${
|
|
34186
|
+
console.log(`reporting ${reports.length === 1 ? reports[0] : `${reports.length} reports`}`);
|
|
33967
34187
|
const ciUrl = buildCiUrl(githubServerUrl, githubRepository, githubRunId);
|
|
33968
|
-
const
|
|
33969
|
-
const body = readFileSync19(report);
|
|
34188
|
+
const body = tagReportXml(mergeJUnitReports(reports.map((r) => (0, import_node_fs6.readFileSync)(r, "utf8"))));
|
|
33970
34189
|
let url = `${resultsUrl}?ciUrl=${encodeURIComponent(ciUrl)}&automationIdFormat=bracket`;
|
|
33971
34190
|
if (generatedFiles) {
|
|
33972
34191
|
url += `&generatedFiles=${encodeURIComponent(generatedFiles.join(","))}`;
|
|
@@ -33979,7 +34198,7 @@ async function reportToQuikTest(params) {
|
|
|
33979
34198
|
if (!res.ok) {
|
|
33980
34199
|
throw new Error(`QuikTest report POST failed: ${res.status} ${res.statusText}`);
|
|
33981
34200
|
}
|
|
33982
|
-
(0, import_node_fs6.rmSync)(report, { force: true });
|
|
34201
|
+
for (const report of reports) (0, import_node_fs6.rmSync)(report, { force: true });
|
|
33983
34202
|
let unmatched = [];
|
|
33984
34203
|
try {
|
|
33985
34204
|
const json = await res.json();
|
|
@@ -34057,9 +34276,9 @@ function withoutLoop7Words(previous) {
|
|
|
34057
34276
|
var import_node_fs7 = require("node:fs");
|
|
34058
34277
|
|
|
34059
34278
|
// src/pathShape.ts
|
|
34060
|
-
var PATH_EXTENSION_RE = /\.(ts|tsx|js|jsx|mjs|cjs|py|rb|go)$/i;
|
|
34279
|
+
var PATH_EXTENSION_RE = /\.(ts|tsx|js|jsx|mjs|cjs|py|rb|go|java|kt|kts|cs|php|rs|swift|scala|ex|exs|c|cc|cpp|h|hpp|dart|lua|vue|svelte)$/i;
|
|
34061
34280
|
function looksLikeFilePath(value) {
|
|
34062
|
-
return
|
|
34281
|
+
return PATH_EXTENSION_RE.test(value.trim());
|
|
34063
34282
|
}
|
|
34064
34283
|
|
|
34065
34284
|
// src/regressionCheck.ts
|
|
@@ -34112,6 +34331,13 @@ function extractFailureDetail(inner) {
|
|
|
34112
34331
|
if (!text2) return null;
|
|
34113
34332
|
return text2.length > MAX_FAILURE_DETAIL ? `${text2.slice(0, MAX_FAILURE_DETAIL)}\u2026` : text2;
|
|
34114
34333
|
}
|
|
34334
|
+
var ANY_LOCATION_RE = /(?:File "([^"\r\n]+?\.[A-Za-z0-9]{1,6})", line (\d+))|(?:([^\s"'()\[\]<>]+?\.(?:[cm]?[jt]sx?|py|go|java|rb|rs|cs|php|kt|kts|swift|scala|exs?|c|cc|cpp|h|hpp|dart)):(?:line )?(\d+))/g;
|
|
34335
|
+
var DEPENDENCY_PATH_RE = /(^|\/)(node_modules|site-packages|dist-packages|vendor|\.venv|venv|\.cargo|\.m2|\.gradle|go\/pkg\/mod)\//;
|
|
34336
|
+
function shownPath(raw) {
|
|
34337
|
+
const path = normalizeSlashes(raw).replace(/^#\s*/, "").replace(/^\.\//, "");
|
|
34338
|
+
const root = `${normalizeSlashes(process.cwd()).replace(/\/+$/, "")}/`;
|
|
34339
|
+
return path.startsWith(root) ? path.slice(root.length) : path;
|
|
34340
|
+
}
|
|
34115
34341
|
function parseAssertionLocation(body) {
|
|
34116
34342
|
const text2 = unescapeXmlEntities(body);
|
|
34117
34343
|
STACK_FRAME_RE.lastIndex = 0;
|
|
@@ -34124,6 +34350,17 @@ function parseAssertionLocation(body) {
|
|
|
34124
34350
|
if (shown.length > MAX_FAILURE_LOCATION) return null;
|
|
34125
34351
|
return `${shown}:${frame[2]}`;
|
|
34126
34352
|
}
|
|
34353
|
+
ANY_LOCATION_RE.lastIndex = 0;
|
|
34354
|
+
let any;
|
|
34355
|
+
while (any = ANY_LOCATION_RE.exec(text2)) {
|
|
34356
|
+
const raw = any[1] ?? any[3];
|
|
34357
|
+
const line = any[2] ?? any[4];
|
|
34358
|
+
if (!raw || !line) continue;
|
|
34359
|
+
const shown = shownPath(raw);
|
|
34360
|
+
if (DEPENDENCY_PATH_RE.test(`/${shown}`) || /^(?:https?|file):/i.test(shown)) continue;
|
|
34361
|
+
if (shown.length > MAX_FAILURE_LOCATION) return null;
|
|
34362
|
+
return `${shown}:${line}`;
|
|
34363
|
+
}
|
|
34127
34364
|
return null;
|
|
34128
34365
|
}
|
|
34129
34366
|
function extractFailureText(testcaseBody) {
|
|
@@ -34154,15 +34391,27 @@ function parseJUnitOutcomes(xml) {
|
|
|
34154
34391
|
const file = FILE_ATTR_RE.exec(suiteMatch[1])?.[1];
|
|
34155
34392
|
if (file) discoveredFiles.add(normalizeSlashes(file));
|
|
34156
34393
|
}
|
|
34394
|
+
const cases = [];
|
|
34157
34395
|
let match;
|
|
34158
34396
|
TESTCASE_RE.lastIndex = 0;
|
|
34159
34397
|
while (match = TESTCASE_RE.exec(xml)) {
|
|
34160
|
-
const [, attrs, body = ""] = match;
|
|
34398
|
+
const [, attrs = "", body = ""] = match;
|
|
34161
34399
|
const rawName = NAME_ATTR_RE.exec(attrs)?.[1];
|
|
34162
34400
|
if (!rawName) continue;
|
|
34163
|
-
const name = unescapeXmlEntities(rawName);
|
|
34164
34401
|
const rawClassname = CLASSNAME_ATTR_RE.exec(attrs)?.[1];
|
|
34165
|
-
const
|
|
34402
|
+
const rawFile = FILE_ATTR_RE.exec(attrs)?.[1];
|
|
34403
|
+
cases.push({
|
|
34404
|
+
attrs,
|
|
34405
|
+
body,
|
|
34406
|
+
name: unescapeXmlEntities(rawName),
|
|
34407
|
+
...rawClassname !== void 0 ? { classname: unescapeXmlEntities(rawClassname) } : {},
|
|
34408
|
+
...rawFile !== void 0 ? { file: unescapeXmlEntities(rawFile) } : {}
|
|
34409
|
+
});
|
|
34410
|
+
}
|
|
34411
|
+
const tagged = tagNames(cases);
|
|
34412
|
+
for (const [index, c] of cases.entries()) {
|
|
34413
|
+
const { attrs, body, classname } = c;
|
|
34414
|
+
const name = tagged[index];
|
|
34166
34415
|
const id = classname ? `${classname}::${name}` : name;
|
|
34167
34416
|
const failed = FAILURE_CHILD_RE.test(body);
|
|
34168
34417
|
outcomes.set(id, !failed);
|
|
@@ -34191,17 +34440,45 @@ function parseJUnitOutcomes(xml) {
|
|
|
34191
34440
|
}
|
|
34192
34441
|
var FRESH_SLACK_MS = 2e3;
|
|
34193
34442
|
function readJUnitOutcomes(cwd, freshSinceMs) {
|
|
34194
|
-
const
|
|
34195
|
-
|
|
34196
|
-
|
|
34197
|
-
|
|
34198
|
-
|
|
34199
|
-
|
|
34200
|
-
|
|
34443
|
+
const reports = findJUnitReports(cwd, freshSinceMs === void 0 ? {} : { freshSinceMs });
|
|
34444
|
+
const parsed = [];
|
|
34445
|
+
for (const report of reports) {
|
|
34446
|
+
try {
|
|
34447
|
+
parsed.push(parseJUnitOutcomes((0, import_node_fs7.readFileSync)(report, "utf8")));
|
|
34448
|
+
} catch {
|
|
34449
|
+
}
|
|
34201
34450
|
}
|
|
34451
|
+
if (parsed.length === 0) return null;
|
|
34452
|
+
return parsed.length === 1 ? parsed[0] : mergeParsed(parsed);
|
|
34453
|
+
}
|
|
34454
|
+
function mergeParsed(all) {
|
|
34455
|
+
const out = {
|
|
34456
|
+
outcomes: /* @__PURE__ */ new Map(),
|
|
34457
|
+
automationIdResults: /* @__PURE__ */ new Map(),
|
|
34458
|
+
failureText: /* @__PURE__ */ new Map(),
|
|
34459
|
+
failureWhere: /* @__PURE__ */ new Map(),
|
|
34460
|
+
failureDetail: /* @__PURE__ */ new Map(),
|
|
34461
|
+
discoveredFiles: /* @__PURE__ */ new Set(),
|
|
34462
|
+
discoveredAutomationIds: /* @__PURE__ */ new Set(),
|
|
34463
|
+
unmappedEntries: 0
|
|
34464
|
+
};
|
|
34465
|
+
for (const p of all) {
|
|
34466
|
+
for (const [id, passed] of p.outcomes) out.outcomes.set(id, (out.outcomes.get(id) ?? true) && passed);
|
|
34467
|
+
for (const [id, r] of p.automationIdResults) {
|
|
34468
|
+
const seen = out.automationIdResults.get(id);
|
|
34469
|
+
if (!seen || RESULT_RANK[r] > RESULT_RANK[seen]) out.automationIdResults.set(id, r);
|
|
34470
|
+
}
|
|
34471
|
+
for (const [k, v] of p.failureText) out.failureText.set(k, v);
|
|
34472
|
+
for (const [k, v] of p.failureWhere) out.failureWhere.set(k, v);
|
|
34473
|
+
for (const [k, v] of p.failureDetail) out.failureDetail.set(k, v);
|
|
34474
|
+
for (const f of p.discoveredFiles) out.discoveredFiles.add(f);
|
|
34475
|
+
for (const id of p.discoveredAutomationIds) out.discoveredAutomationIds.add(id);
|
|
34476
|
+
out.unmappedEntries += p.unmappedEntries;
|
|
34477
|
+
}
|
|
34478
|
+
return out;
|
|
34202
34479
|
}
|
|
34203
|
-
function readAutomationIdResults(cwd = process.cwd()) {
|
|
34204
|
-
return readJUnitOutcomes(cwd)?.automationIdResults ?? null;
|
|
34480
|
+
function readAutomationIdResults(cwd = process.cwd(), freshSinceMs) {
|
|
34481
|
+
return readJUnitOutcomes(cwd, freshSinceMs)?.automationIdResults ?? null;
|
|
34205
34482
|
}
|
|
34206
34483
|
function snapshotOf(outcome, parsed) {
|
|
34207
34484
|
return {
|
|
@@ -34224,8 +34501,9 @@ async function captureLimited(command, cwd, limitMs) {
|
|
|
34224
34501
|
}
|
|
34225
34502
|
function captureTestSnapshot(command, cwd = process.cwd(), opts) {
|
|
34226
34503
|
if (opts) return captureLimited(command, cwd, opts.limitMs);
|
|
34504
|
+
const startedAt = Date.now();
|
|
34227
34505
|
const outcome = runTestCommand(command);
|
|
34228
|
-
const parsed = readJUnitOutcomes(cwd);
|
|
34506
|
+
const parsed = readJUnitOutcomes(cwd, startedAt - FRESH_SLACK_MS);
|
|
34229
34507
|
return {
|
|
34230
34508
|
outcome,
|
|
34231
34509
|
results: parsed?.outcomes ?? null,
|
|
@@ -34237,8 +34515,8 @@ function captureTestSnapshot(command, cwd = process.cwd(), opts) {
|
|
|
34237
34515
|
unmappedEntries: parsed?.unmappedEntries
|
|
34238
34516
|
};
|
|
34239
34517
|
}
|
|
34240
|
-
function readTestSnapshot(outcome, cwd = process.cwd()) {
|
|
34241
|
-
const parsed = readJUnitOutcomes(cwd);
|
|
34518
|
+
function readTestSnapshot(outcome, cwd = process.cwd(), freshSinceMs) {
|
|
34519
|
+
const parsed = readJUnitOutcomes(cwd, freshSinceMs);
|
|
34242
34520
|
return {
|
|
34243
34521
|
outcome,
|
|
34244
34522
|
results: parsed?.outcomes ?? null,
|
|
@@ -34262,8 +34540,9 @@ function readTestSnapshotAt(outcome, reportPath) {
|
|
|
34262
34540
|
}
|
|
34263
34541
|
async function captureBaselineSnapshot(command, cwd = process.cwd(), opts) {
|
|
34264
34542
|
if (opts) return captureLimited(command, cwd, opts.limitMs);
|
|
34543
|
+
const startedAt = Date.now();
|
|
34265
34544
|
const outcome = await runTestCommandAsync(command);
|
|
34266
|
-
const parsed = readJUnitOutcomes(cwd);
|
|
34545
|
+
const parsed = readJUnitOutcomes(cwd, startedAt - FRESH_SLACK_MS);
|
|
34267
34546
|
return {
|
|
34268
34547
|
outcome,
|
|
34269
34548
|
results: parsed?.outcomes ?? null,
|
|
@@ -34466,6 +34745,7 @@ async function runBaselineCheck(params) {
|
|
|
34466
34745
|
const reportBefore = findJUnitReport(cwd);
|
|
34467
34746
|
const mtimeBefore = reportBefore ? mtimeOf(reportBefore) : null;
|
|
34468
34747
|
const untrackedBefore = untrackedFiles(cwd);
|
|
34748
|
+
const fileRunStartedAt = Date.now();
|
|
34469
34749
|
const outcome = await runFile(buildSingleFileCommand(testFileCmd, target.path), BASELINE_CHECK_TIMEOUT_MS);
|
|
34470
34750
|
if (outcome === "timeout") {
|
|
34471
34751
|
skip(
|
|
@@ -34483,7 +34763,7 @@ async function runBaselineCheck(params) {
|
|
|
34483
34763
|
"the single-file command wrote no new JUnit report (it must write the same JUnit report as the test command), so nothing could be checked."
|
|
34484
34764
|
);
|
|
34485
34765
|
} else {
|
|
34486
|
-
const byId = readAutomationIdResults(cwd);
|
|
34766
|
+
const byId = readAutomationIdResults(cwd, fileRunStartedAt - 2e3);
|
|
34487
34767
|
for (const id of ids) if (byId?.get(id) === "pass") flagged.push(id);
|
|
34488
34768
|
}
|
|
34489
34769
|
}
|
|
@@ -36071,6 +36351,8 @@ function testTimeLimitMs(baselineMs) {
|
|
|
36071
36351
|
if (baselineMs > MAX_TEST_LIMIT_MS) return "too_slow";
|
|
36072
36352
|
return Math.min(MAX_TEST_LIMIT_MS, Math.max(MIN_TEST_LIMIT_MS, baselineMs * 3));
|
|
36073
36353
|
}
|
|
36354
|
+
var FILE_COMMAND_PASSED_SENTENCE = "The Test command passed on this file, but no JUnit report was written to say which tests ran.";
|
|
36355
|
+
var FILE_COMMAND_FAILED_SENTENCE = "The Test command failed on this file; no JUnit report was written to say which test failed. Its output is in the job log.";
|
|
36074
36356
|
var MESSAGES = {
|
|
36075
36357
|
tests_passed: "The tests passed.",
|
|
36076
36358
|
tests_failed: "Some tests failed. output lists their names, regressions first: a regression passed before your change. For a test you wrote in this run, messages gives the first line of why it failed.",
|
|
@@ -36116,10 +36398,10 @@ function wholeFailure(text2, where, max) {
|
|
|
36116
36398
|
if (firstSafe.length >= max - 1) return firstLine(text2, where, max);
|
|
36117
36399
|
return `${safe.slice(0, max - 1)}\u2026`;
|
|
36118
36400
|
}
|
|
36119
|
-
var
|
|
36401
|
+
var normalisePath2 = (p) => p.replace(/\\/g, "/").replace(/^(\.\/)+/, "");
|
|
36120
36402
|
function samePlace2(a, b) {
|
|
36121
|
-
const x =
|
|
36122
|
-
const y =
|
|
36403
|
+
const x = normalisePath2(a);
|
|
36404
|
+
const y = normalisePath2(b);
|
|
36123
36405
|
return x === y || x.endsWith(`/${y}`) || y.endsWith(`/${x}`);
|
|
36124
36406
|
}
|
|
36125
36407
|
function ownFailureIds(newFailures, changedPaths, requiredIds) {
|
|
@@ -36387,16 +36669,7 @@ var RunTestsTool = class {
|
|
|
36387
36669
|
}
|
|
36388
36670
|
const run2 = await runCommand2(command, file === void 0 || testLimitsOff() ? limit : Math.min(limit, FILE_RUN_LIMIT_MS), d.root);
|
|
36389
36671
|
if (!run2.started || run2.timedOut) return { run: run2, snapshot: null };
|
|
36390
|
-
const
|
|
36391
|
-
let fresh = false;
|
|
36392
|
-
if (report) {
|
|
36393
|
-
try {
|
|
36394
|
-
fresh = (0, import_node_fs14.statSync)(report).mtimeMs >= startedAt - FRESH_SLACK_MS2;
|
|
36395
|
-
} catch {
|
|
36396
|
-
fresh = false;
|
|
36397
|
-
}
|
|
36398
|
-
}
|
|
36399
|
-
const snapshot = fresh ? readSnapshot(run2.outcome, d.root) : null;
|
|
36672
|
+
const snapshot = readSnapshot(run2.outcome, d.root, startedAt - FRESH_SLACK_MS2);
|
|
36400
36673
|
return { run: run2, snapshot: snapshot && snapshot.results ? snapshot : null };
|
|
36401
36674
|
},
|
|
36402
36675
|
{ ...d.tree, preserve }
|
|
@@ -36448,7 +36721,8 @@ var RunTestsTool = class {
|
|
|
36448
36721
|
this.lastFailingKey = null;
|
|
36449
36722
|
this.lastFailed = null;
|
|
36450
36723
|
}
|
|
36451
|
-
|
|
36724
|
+
const byExitCode = file !== void 0 && ran.run.started && !ran.run.timedOut ? ran.run.outcome === "success" ? { reason: "test_command_passed", extra: FILE_COMMAND_PASSED_SENTENCE } : { reason: "test_command_failed", extra: FILE_COMMAND_FAILED_SENTENCE } : {};
|
|
36725
|
+
return this.answer(callId, "no_report", { seconds, scope, ...byExitCode, ...planInfo(null) ? { plan: planInfo(null) } : {} });
|
|
36452
36726
|
}
|
|
36453
36727
|
const answer = testAnswerFrom({
|
|
36454
36728
|
baseline: baseline?.snapshot ?? null,
|
|
@@ -38687,14 +38961,14 @@ function unitOf(text2, starts, node) {
|
|
|
38687
38961
|
const base = { line: lineAt2(starts, node.start), names: [], declared: [], children: [], declaration: false };
|
|
38688
38962
|
if (node.type === "ImportDeclaration") {
|
|
38689
38963
|
const names = [];
|
|
38690
|
-
const
|
|
38964
|
+
const declared3 = [];
|
|
38691
38965
|
for (const spec of node.specifiers) {
|
|
38692
|
-
|
|
38966
|
+
declared3.push(spec.local.name);
|
|
38693
38967
|
if (spec.type === "ImportSpecifier") names.push(`${spec.imported.type === "Identifier" ? spec.imported.name : String(spec.imported.value)}:${spec.local.name}`);
|
|
38694
38968
|
else if (spec.type === "ImportDefaultSpecifier") names.push(`default:${spec.local.name}`);
|
|
38695
38969
|
else names.push(`*:${spec.local.name}`);
|
|
38696
38970
|
}
|
|
38697
|
-
return { ...base, kind: "import", key: `import:${String(node.source.value)}`, names, declared:
|
|
38971
|
+
return { ...base, kind: "import", key: `import:${String(node.source.value)}`, names, declared: declared3 };
|
|
38698
38972
|
}
|
|
38699
38973
|
if (node.type === "ExpressionStatement" && node.expression.type === "CallExpression") {
|
|
38700
38974
|
const root = rootName(node.expression);
|
|
@@ -38707,16 +38981,16 @@ function unitOf(text2, starts, node) {
|
|
|
38707
38981
|
return { ...base, kind: "test", key: text2.slice(node.start, node.end) };
|
|
38708
38982
|
}
|
|
38709
38983
|
}
|
|
38710
|
-
const
|
|
38984
|
+
const declared2 = [];
|
|
38711
38985
|
let declaration = false;
|
|
38712
38986
|
if (node.type === "FunctionDeclaration" || node.type === "ClassDeclaration") {
|
|
38713
38987
|
declaration = true;
|
|
38714
|
-
|
|
38988
|
+
declared2.push(node.id.name);
|
|
38715
38989
|
} else if (node.type === "VariableDeclaration") {
|
|
38716
38990
|
declaration = true;
|
|
38717
|
-
for (const d of node.declarations) patternNames(d.id,
|
|
38991
|
+
for (const d of node.declarations) patternNames(d.id, declared2);
|
|
38718
38992
|
}
|
|
38719
|
-
return { ...base, kind: "other", key: text2.slice(node.start, node.end), declared, declaration };
|
|
38993
|
+
return { ...base, kind: "other", key: text2.slice(node.start, node.end), declared: declared2, declaration };
|
|
38720
38994
|
}
|
|
38721
38995
|
function unitsOf(text2, body) {
|
|
38722
38996
|
const starts = lineStartsOf(text2);
|
|
@@ -41415,7 +41689,7 @@ async function runCodegenLoop(args, deps) {
|
|
|
41415
41689
|
};
|
|
41416
41690
|
const anyOwnTestFails = () => {
|
|
41417
41691
|
const runs = currentRedRuns();
|
|
41418
|
-
return args.requiredAutomationIds.some((id) => runs.some((r) => r
|
|
41692
|
+
return args.requiredAutomationIds.some((id) => runs.some((r) => failsFor(r, id)));
|
|
41419
41693
|
};
|
|
41420
41694
|
const redProblem = () => {
|
|
41421
41695
|
const ids = args.redCheckIds ?? [];
|
|
@@ -41424,9 +41698,8 @@ async function runCodegenLoop(args, deps) {
|
|
|
41424
41698
|
const passing = [];
|
|
41425
41699
|
const unrun = [];
|
|
41426
41700
|
for (const id of ids) {
|
|
41427
|
-
|
|
41428
|
-
|
|
41429
|
-
const covering = runs.filter((r) => r.file === void 0 || (overlay.get(r.file)?.lf ?? "").includes(token));
|
|
41701
|
+
if (runs.some((r) => failsFor(r, id))) continue;
|
|
41702
|
+
const covering = runs.filter((r) => r.file === void 0 || fileHolds(r.file, id));
|
|
41430
41703
|
if (covering.length === 0) unrun.push(id);
|
|
41431
41704
|
else if (covering.every((r) => !r.truncated)) passing.push(id);
|
|
41432
41705
|
}
|
|
@@ -41443,6 +41716,12 @@ async function runCodegenLoop(args, deps) {
|
|
|
41443
41716
|
}
|
|
41444
41717
|
return null;
|
|
41445
41718
|
};
|
|
41719
|
+
const fileHolds = (file, id) => {
|
|
41720
|
+
if ((overlay.get(file)?.lf ?? "").includes(`[${id}]`)) return true;
|
|
41721
|
+
const declared2 = declaredFileOf(id);
|
|
41722
|
+
return declared2 !== null && sameFile2(declared2, file);
|
|
41723
|
+
};
|
|
41724
|
+
const failsFor = (r, id) => r.failing.some((name) => idCoversCase(name, id)) || r.fileFailed === true && r.file !== void 0 && fileHolds(r.file, id);
|
|
41446
41725
|
const sentSteps = () => stepsOf(transcript.slice(0, sent.entries), toolResults.slice(0, sent.results));
|
|
41447
41726
|
let turns = 0;
|
|
41448
41727
|
let noProgressStreak = 0;
|
|
@@ -41557,7 +41836,8 @@ async function runCodegenLoop(args, deps) {
|
|
|
41557
41836
|
return new CodegenLoopFailure("no_writes");
|
|
41558
41837
|
}
|
|
41559
41838
|
const texts = changed.map((p) => overlay.get(p)?.lf ?? "");
|
|
41560
|
-
const
|
|
41839
|
+
const written = new Map(changed.map((p) => [p, overlay.get(p)?.lf ?? ""]));
|
|
41840
|
+
const missing = args.requiredAutomationIds.filter((id) => !texts.some((t) => t.includes(`[${id}]`)) && !declaredIn(id, written));
|
|
41561
41841
|
if (missing.length > 0) {
|
|
41562
41842
|
if (!quiet) log({ event: "codegen.loop_refused", turn, reason: "coverage_missing", missing: missing.length });
|
|
41563
41843
|
return new CodegenLoopFailure("coverage_missing", void 0, void 0, `${missing.length} required test case(s) not written`, coverageSentence(missing));
|
|
@@ -41677,8 +41957,9 @@ async function runCodegenLoop(args, deps) {
|
|
|
41677
41957
|
const redLeft = harness && args.phase === "tests" ? redProblem() : null;
|
|
41678
41958
|
if (harness && args.phase === "tests" && currentRedRuns().some((r) => r.failing.length > 0) && handOverRefusal(turn, true) === null && (redLeft === null || redLeft.kind === "passing")) {
|
|
41679
41959
|
log({ event: "codegen.red_check", turn, outcome: "gave_up_but_red", files: overlay.changedPaths().length, ...redLeft ? { unproven: redLeft.ids.length } : {} });
|
|
41680
|
-
const red = currentRedRuns().at(-1)
|
|
41681
|
-
|
|
41960
|
+
const red = currentRedRuns().filter((r) => r.answer !== void 0).at(-1)?.answer;
|
|
41961
|
+
const kept = last ?? red;
|
|
41962
|
+
return { results: overlay.results(), summary: snapshot("gave_up_kept"), doneSummary: said ?? "", steps: sentSteps(), ...redLeft ? { redUnproven: redLeft.ids } : {}, ...kept ? { lastTestAnswer: kept } : {} };
|
|
41682
41963
|
}
|
|
41683
41964
|
if (args.keepOnGiveUp === true && last !== void 0 && last.regressions + last.newFailures > 0 && handOverRefusal(turn, true) === null) {
|
|
41684
41965
|
log({ event: "codegen.loop_kept", files: overlay.changedPaths().length, regressions: last.regressions, newFailures: last.newFailures });
|
|
@@ -41688,6 +41969,11 @@ async function runCodegenLoop(args, deps) {
|
|
|
41688
41969
|
}
|
|
41689
41970
|
if (body.outcome === "DONE") {
|
|
41690
41971
|
log({ event: "codegen.loop_turn", turn, outcome: "done", requestTokens, elapsedMs: now() - turnStarted, calls: [] });
|
|
41972
|
+
const declaredTests = readCaseTests(body.caseTests, args.requiredAutomationIds);
|
|
41973
|
+
if (declaredTests.length > 0) {
|
|
41974
|
+
addCaseTests(declaredTests);
|
|
41975
|
+
log({ event: "codegen.case_tests", turn, declared: declaredTests.length });
|
|
41976
|
+
}
|
|
41691
41977
|
if (conflictTool && conflictTool.recorded().length > 0) {
|
|
41692
41978
|
const said = typeof body.summary === "string" ? body.summary.slice(0, MAX_SUMMARY_CHARS) : void 0;
|
|
41693
41979
|
throw new TestConflictStop(conflictTool.recorded(), new CodegenLoopFailure("cannot_complete", void 0, void 0, said, said));
|
|
@@ -41760,7 +42046,7 @@ async function runCodegenLoop(args, deps) {
|
|
|
41760
42046
|
const lane = args.lane;
|
|
41761
42047
|
if (harness && args.phase === "code" && lane?.kind === "code" && !lane.amend && args.keepOnGiveUp === true) {
|
|
41762
42048
|
const red2 = currentRedRuns().filter((r) => r.failing.some((name) => lane.frozen.some((p) => samePlace3(name.split("::")[0] ?? "", p)))).at(-1);
|
|
41763
|
-
if (red2) {
|
|
42049
|
+
if (red2?.answer) {
|
|
41764
42050
|
log({ event: "codegen.loop_kept", files: overlay.changedPaths().length, regressions: red2.answer.regressions, newFailures: red2.answer.newFailures, after: "done" });
|
|
41765
42051
|
return { results: overlay.results(), summary: snapshot("gave_up_kept"), doneSummary, gaveUp: true, steps: sentSteps(), lastTestAnswer: red2.answer };
|
|
41766
42052
|
}
|
|
@@ -41830,6 +42116,8 @@ async function runCodegenLoop(args, deps) {
|
|
|
41830
42116
|
if (call.name === RUN_TESTS_TOOL && isTestAnswer(result.output) && result.status !== "duplicate") {
|
|
41831
42117
|
const file = result.output.scope === "file" && isPlainObject3(call.args) && typeof call.args.file === "string" ? call.args.file : void 0;
|
|
41832
42118
|
redRuns.push({ version: versionOfFiles(filesOnDisk()), ...file ? { file } : {}, failing: result.output.failingTests, truncated: result.output.truncated, answer: result.output });
|
|
42119
|
+
} else if (call.name === RUN_TESTS_TOOL && result.status === "no_report" && result.reason === "test_command_failed" && isPlainObject3(call.args) && typeof call.args.file === "string") {
|
|
42120
|
+
redRuns.push({ version: versionOfFiles(filesOnDisk()), file: call.args.file, failing: [], truncated: false, fileFailed: true });
|
|
41833
42121
|
}
|
|
41834
42122
|
if (read) reads.push(read);
|
|
41835
42123
|
statusCounts[result.status] = (statusCounts[result.status] ?? 0) + 1;
|
|
@@ -43891,7 +44179,7 @@ var samePlace6 = (a, b) => {
|
|
|
43891
44179
|
const y = b.replace(/\\/g, "/").replace(/^(\.\/)+/, "");
|
|
43892
44180
|
return x === y || x.endsWith(`/${y}`) || y.endsWith(`/${x}`);
|
|
43893
44181
|
};
|
|
43894
|
-
function
|
|
44182
|
+
function isRowOf2(id, test) {
|
|
43895
44183
|
const { file, name } = splitTestId(id);
|
|
43896
44184
|
return (file === null || samePlace6(file, test.path)) && nameEndsWithTitle(name, test.testTitle);
|
|
43897
44185
|
}
|
|
@@ -43903,10 +44191,10 @@ function approvedTestsFailing(input) {
|
|
|
43903
44191
|
const out = [];
|
|
43904
44192
|
const taken = /* @__PURE__ */ new Set();
|
|
43905
44193
|
for (const d of approved) {
|
|
43906
|
-
const failingIds = failing.filter((id) => !taken.has(id) &&
|
|
44194
|
+
const failingIds = failing.filter((id) => !taken.has(id) && isRowOf2(id, d));
|
|
43907
44195
|
if (failingIds.length === 0) continue;
|
|
43908
44196
|
for (const id of failingIds) taken.add(id);
|
|
43909
|
-
const totalRows = Math.max(failingIds.length, after.filter((id) =>
|
|
44197
|
+
const totalRows = Math.max(failingIds.length, after.filter((id) => isRowOf2(id, d)).length);
|
|
43910
44198
|
const examples = [];
|
|
43911
44199
|
for (const id of failingIds) {
|
|
43912
44200
|
if (examples.length >= MAX_MISFIT_EXAMPLES) break;
|
|
@@ -43927,6 +44215,31 @@ function misfitSentence(misfits, max = 600) {
|
|
|
43927
44215
|
return clip3(parts.join("; "), max);
|
|
43928
44216
|
}
|
|
43929
44217
|
|
|
44218
|
+
// src/testVerification.ts
|
|
44219
|
+
function verifyTier(i2) {
|
|
44220
|
+
if (!i2.command || i2.command.trim() === "") return { tier: "unverified", reason: "no_command" };
|
|
44221
|
+
const before = i2.baseline.results !== null;
|
|
44222
|
+
const now = i2.after.results !== null;
|
|
44223
|
+
if (before && now) return { tier: "report" };
|
|
44224
|
+
if (before !== now) return { tier: "unverified", reason: "report_one_side" };
|
|
44225
|
+
if (i2.baseline.outcome !== "success") return { tier: "unverified", reason: "failing_before" };
|
|
44226
|
+
return i2.after.outcome === "success" ? { tier: "exit_code", pass: true } : { tier: "exit_code", pass: false };
|
|
44227
|
+
}
|
|
44228
|
+
var UNVERIFIED_PREFIX = "QuikPilot could not check this change against the project's tests";
|
|
44229
|
+
var UNVERIFIED_WHY = {
|
|
44230
|
+
no_command: "the project has no Test command. Set one in the project's QuikPilot settings",
|
|
44231
|
+
failing_before: "the tests already failed before the change and no test report was found, so a failure after it cannot be told apart from the ones that were there",
|
|
44232
|
+
report_one_side: "a test report was written on one side of the change only (before it or after it, not both), so the two runs cannot be compared. Check that the Test command writes its JUnit report the same way every time"
|
|
44233
|
+
};
|
|
44234
|
+
function unverifiedMessage(reason) {
|
|
44235
|
+
return `${UNVERIFIED_PREFIX}: ${UNVERIFIED_WHY[reason]}. Nothing was pushed.`;
|
|
44236
|
+
}
|
|
44237
|
+
var EXIT_CODE_FAILED_PREFIX = "QuikPilot's change made the project's tests fail";
|
|
44238
|
+
function exitCodeFailedMessage() {
|
|
44239
|
+
return `${EXIT_CODE_FAILED_PREFIX} \u2014 the Test command passed before the change and failed after it. No test report was found to say which test, so QuikPilot could not fix it. Nothing was pushed.`;
|
|
44240
|
+
}
|
|
44241
|
+
var EXIT_CODE_ONLY_NOTE = "The change was checked by the Test command's result only: it passed before and after the change, but no test report was found, so QuikPilot could not see individual tests or confirm that its new tests ran.";
|
|
44242
|
+
|
|
43930
44243
|
// src/testPlacementCheck.ts
|
|
43931
44244
|
function isDiscovered(targetPath, discoveredFiles) {
|
|
43932
44245
|
const normalized = targetPath.replace(/\\/g, "/");
|
|
@@ -44326,6 +44639,7 @@ async function verifyChange(ctx, results, undoable) {
|
|
|
44326
44639
|
runCommand(packet.commands.lint, "Lint");
|
|
44327
44640
|
timing("lint", lintStartedAt, packet.commands.lint);
|
|
44328
44641
|
stage = "gate";
|
|
44642
|
+
if (!packet.commands.test || packet.commands.test.trim() === "") return fail(new Error(unverifiedMessage("no_command")));
|
|
44329
44643
|
const gateStartedAt = now();
|
|
44330
44644
|
const leftMs = ctx.jobStopAtMs === void 0 ? Number.NaN : ctx.jobStopAtMs - gateStartedAt;
|
|
44331
44645
|
const limit = testLimitsOff() ? null : gateLimitMs({ baselineMs: ctx.baselineMs, leftMs });
|
|
@@ -44347,6 +44661,17 @@ async function verifyChange(ctx, results, undoable) {
|
|
|
44347
44661
|
warnings.push(w);
|
|
44348
44662
|
console.warn(`QuikPilot test warning (not blocking): ${w}`);
|
|
44349
44663
|
}
|
|
44664
|
+
const verification = verifyTier({ command: packet.commands.test, baseline, after });
|
|
44665
|
+
if (verification.tier === "unverified") return fail(new Error(unverifiedMessage(verification.reason)));
|
|
44666
|
+
if (verification.tier === "exit_code") {
|
|
44667
|
+
outputs.testVerification = "exit_code";
|
|
44668
|
+
console.log(JSON.stringify({ event: "gate.verified_by", tier: "exit_code", pass: verification.pass }));
|
|
44669
|
+
if (!verification.pass) return fail(new Error(exitCodeFailedMessage()));
|
|
44670
|
+
warnings.push(EXIT_CODE_ONLY_NOTE);
|
|
44671
|
+
console.warn(`QuikPilot test warning (not blocking): ${EXIT_CODE_ONLY_NOTE}`);
|
|
44672
|
+
} else {
|
|
44673
|
+
outputs.testVerification = "report";
|
|
44674
|
+
}
|
|
44350
44675
|
const check = checkForRegressions(baseline, after);
|
|
44351
44676
|
if (check.blocked) {
|
|
44352
44677
|
const readable = Boolean(baseline.results && after.results);
|
|
@@ -44662,7 +44987,7 @@ function workspacePatterns(readText) {
|
|
|
44662
44987
|
}
|
|
44663
44988
|
function globMatcher(pattern) {
|
|
44664
44989
|
const parts = pattern.replace(/^\.\//, "").replace(/\/+$/, "").split("/");
|
|
44665
|
-
const
|
|
44990
|
+
const escape2 = (s) => s.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
|
|
44666
44991
|
let re = "";
|
|
44667
44992
|
parts.forEach((part, i2) => {
|
|
44668
44993
|
const first = i2 === 0;
|
|
@@ -44670,7 +44995,7 @@ function globMatcher(pattern) {
|
|
|
44670
44995
|
re += first ? "(?:[^/]+/)*" : "(?:/[^/]+)*";
|
|
44671
44996
|
return;
|
|
44672
44997
|
}
|
|
44673
|
-
const segment = part.split("*").map(
|
|
44998
|
+
const segment = part.split("*").map(escape2).join("[^/]*");
|
|
44674
44999
|
re += first || i2 === 1 && parts[0] === "**" ? segment : `/${segment}`;
|
|
44675
45000
|
});
|
|
44676
45001
|
return new RegExp(`^${re}$`);
|
|
@@ -44966,7 +45291,7 @@ var FAILURE_ARTIFACT_DIR = "quikpilot-failure";
|
|
|
44966
45291
|
var REPORT_COPY = "final-test-report.xml";
|
|
44967
45292
|
var MAX_REPORT_BYTES = 5 * 1024 * 1024;
|
|
44968
45293
|
var MAX_FILES = 200;
|
|
44969
|
-
var RUNNER_VERSION = true ? "9.3.0-rc.
|
|
45294
|
+
var RUNNER_VERSION = true ? "9.3.0-rc.48" : "dev";
|
|
44970
45295
|
function safeDestination(base, repoPath) {
|
|
44971
45296
|
if (!repoPath || (0, import_node_path24.isAbsolute)(repoPath)) return null;
|
|
44972
45297
|
const destination = (0, import_node_path24.resolve)(base, repoPath);
|