@kakarot-ci/core 0.6.3 → 0.6.5
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/dist/cli/index.js +70 -31
- package/dist/cli/index.js.map +2 -2
- package/dist/index.cjs +70 -31
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +70 -31
- package/dist/index.js.map +2 -2
- package/dist/src/core/orchestrator.d.ts.map +1 -1
- package/dist/src/github/client.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -69,6 +69,8 @@ var GitHubClient = class {
|
|
|
69
69
|
this.retryDelay = 1e3;
|
|
70
70
|
this.owner = options.owner;
|
|
71
71
|
this.repo = options.repo;
|
|
72
|
+
const originalConsoleError = console.error;
|
|
73
|
+
const originalConsoleWarn = console.warn;
|
|
72
74
|
this.octokit = new Octokit({
|
|
73
75
|
auth: options.token,
|
|
74
76
|
request: {
|
|
@@ -76,6 +78,8 @@ var GitHubClient = class {
|
|
|
76
78
|
retryAfter: this.retryDelay / 1e3
|
|
77
79
|
}
|
|
78
80
|
});
|
|
81
|
+
console.error = originalConsoleError;
|
|
82
|
+
console.warn = originalConsoleWarn;
|
|
79
83
|
}
|
|
80
84
|
/**
|
|
81
85
|
* Retry wrapper with exponential backoff
|
|
@@ -84,6 +88,10 @@ var GitHubClient = class {
|
|
|
84
88
|
try {
|
|
85
89
|
return await fn();
|
|
86
90
|
} catch (err) {
|
|
91
|
+
const isNotFound = err && typeof err === "object" && "status" in err && err.status === 404;
|
|
92
|
+
if (isNotFound) {
|
|
93
|
+
throw err;
|
|
94
|
+
}
|
|
87
95
|
if (retries <= 0) {
|
|
88
96
|
error(`${operation} failed after ${this.maxRetries} retries: ${err instanceof Error ? err.message : String(err)}`);
|
|
89
97
|
throw err;
|
|
@@ -270,25 +278,46 @@ var GitHubClient = class {
|
|
|
270
278
|
* Check if a file exists in the repository
|
|
271
279
|
*/
|
|
272
280
|
async fileExists(ref, path) {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
281
|
+
const originalError = console.error;
|
|
282
|
+
const originalWarn = console.warn;
|
|
283
|
+
const suppressedError = (...args) => {
|
|
284
|
+
const message = args.join(" ");
|
|
285
|
+
if (!message.includes("404") && !message.includes("Not Found")) {
|
|
286
|
+
originalError(...args);
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
const suppressedWarn = (...args) => {
|
|
290
|
+
const message = args.join(" ");
|
|
291
|
+
if (!message.includes("404") && !message.includes("Not Found")) {
|
|
292
|
+
originalWarn(...args);
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
try {
|
|
296
|
+
console.error = suppressedError;
|
|
297
|
+
console.warn = suppressedWarn;
|
|
298
|
+
await this.octokit.rest.repos.getContent({
|
|
299
|
+
owner: this.owner,
|
|
300
|
+
repo: this.repo,
|
|
301
|
+
path,
|
|
302
|
+
ref
|
|
303
|
+
});
|
|
304
|
+
return true;
|
|
305
|
+
} catch (err) {
|
|
306
|
+
const status = err && typeof err === "object" && "status" in err ? err.status : void 0;
|
|
307
|
+
if (status === 404) {
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
310
|
+
if (err instanceof Error) {
|
|
311
|
+
const message = err.message.toLowerCase();
|
|
312
|
+
if (message.includes("404") || message.includes("not found")) {
|
|
287
313
|
return false;
|
|
288
314
|
}
|
|
289
|
-
throw err;
|
|
290
315
|
}
|
|
291
|
-
|
|
316
|
+
throw err;
|
|
317
|
+
} finally {
|
|
318
|
+
console.error = originalError;
|
|
319
|
+
console.warn = originalWarn;
|
|
320
|
+
}
|
|
292
321
|
}
|
|
293
322
|
/**
|
|
294
323
|
* Get the current rate limit status
|
|
@@ -1920,21 +1949,31 @@ async function runPullRequest(context) {
|
|
|
1920
1949
|
if (testFiles.size > 0) {
|
|
1921
1950
|
const testRunner = createTestRunner(framework);
|
|
1922
1951
|
const writtenPaths = Array.from(testFiles.keys());
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1952
|
+
try {
|
|
1953
|
+
info("Running tests with coverage...");
|
|
1954
|
+
const finalTestResults = await testRunner.runTests({
|
|
1955
|
+
testFiles: writtenPaths,
|
|
1956
|
+
framework,
|
|
1957
|
+
packageManager,
|
|
1958
|
+
projectRoot,
|
|
1959
|
+
coverage: true
|
|
1960
|
+
});
|
|
1961
|
+
const coverageReport = readCoverageReport(projectRoot, framework);
|
|
1962
|
+
if (coverageReport) {
|
|
1963
|
+
info(`Coverage collected: ${coverageReport.total.lines.percentage.toFixed(1)}% lines`);
|
|
1964
|
+
summary.coverageReport = coverageReport;
|
|
1965
|
+
summary.testResults = finalTestResults;
|
|
1966
|
+
} else {
|
|
1967
|
+
warn("Could not read coverage report");
|
|
1968
|
+
}
|
|
1969
|
+
} catch (err) {
|
|
1970
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
1971
|
+
if (errorMessage.includes("coverage") || errorMessage.includes("MISSING DEPENDENCY")) {
|
|
1972
|
+
warn(`Coverage collection failed (likely missing coverage package): ${errorMessage}`);
|
|
1973
|
+
warn("Continuing without coverage report");
|
|
1974
|
+
} else {
|
|
1975
|
+
throw err;
|
|
1976
|
+
}
|
|
1938
1977
|
}
|
|
1939
1978
|
}
|
|
1940
1979
|
if (config.enableAutoCommit && testFiles.size > 0) {
|