@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/index.js
CHANGED
|
@@ -164,6 +164,8 @@ var GitHubClient = class {
|
|
|
164
164
|
this.retryDelay = 1e3;
|
|
165
165
|
this.owner = options.owner;
|
|
166
166
|
this.repo = options.repo;
|
|
167
|
+
const originalConsoleError = console.error;
|
|
168
|
+
const originalConsoleWarn = console.warn;
|
|
167
169
|
this.octokit = new Octokit({
|
|
168
170
|
auth: options.token,
|
|
169
171
|
request: {
|
|
@@ -171,6 +173,8 @@ var GitHubClient = class {
|
|
|
171
173
|
retryAfter: this.retryDelay / 1e3
|
|
172
174
|
}
|
|
173
175
|
});
|
|
176
|
+
console.error = originalConsoleError;
|
|
177
|
+
console.warn = originalConsoleWarn;
|
|
174
178
|
}
|
|
175
179
|
/**
|
|
176
180
|
* Retry wrapper with exponential backoff
|
|
@@ -179,6 +183,10 @@ var GitHubClient = class {
|
|
|
179
183
|
try {
|
|
180
184
|
return await fn();
|
|
181
185
|
} catch (err) {
|
|
186
|
+
const isNotFound = err && typeof err === "object" && "status" in err && err.status === 404;
|
|
187
|
+
if (isNotFound) {
|
|
188
|
+
throw err;
|
|
189
|
+
}
|
|
182
190
|
if (retries <= 0) {
|
|
183
191
|
error(`${operation} failed after ${this.maxRetries} retries: ${err instanceof Error ? err.message : String(err)}`);
|
|
184
192
|
throw err;
|
|
@@ -365,25 +373,46 @@ var GitHubClient = class {
|
|
|
365
373
|
* Check if a file exists in the repository
|
|
366
374
|
*/
|
|
367
375
|
async fileExists(ref, path) {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
376
|
+
const originalError = console.error;
|
|
377
|
+
const originalWarn = console.warn;
|
|
378
|
+
const suppressedError = (...args) => {
|
|
379
|
+
const message = args.join(" ");
|
|
380
|
+
if (!message.includes("404") && !message.includes("Not Found")) {
|
|
381
|
+
originalError(...args);
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
const suppressedWarn = (...args) => {
|
|
385
|
+
const message = args.join(" ");
|
|
386
|
+
if (!message.includes("404") && !message.includes("Not Found")) {
|
|
387
|
+
originalWarn(...args);
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
try {
|
|
391
|
+
console.error = suppressedError;
|
|
392
|
+
console.warn = suppressedWarn;
|
|
393
|
+
await this.octokit.rest.repos.getContent({
|
|
394
|
+
owner: this.owner,
|
|
395
|
+
repo: this.repo,
|
|
396
|
+
path,
|
|
397
|
+
ref
|
|
398
|
+
});
|
|
399
|
+
return true;
|
|
400
|
+
} catch (err) {
|
|
401
|
+
const status = err && typeof err === "object" && "status" in err ? err.status : void 0;
|
|
402
|
+
if (status === 404) {
|
|
403
|
+
return false;
|
|
404
|
+
}
|
|
405
|
+
if (err instanceof Error) {
|
|
406
|
+
const message = err.message.toLowerCase();
|
|
407
|
+
if (message.includes("404") || message.includes("not found")) {
|
|
382
408
|
return false;
|
|
383
409
|
}
|
|
384
|
-
throw err;
|
|
385
410
|
}
|
|
386
|
-
|
|
411
|
+
throw err;
|
|
412
|
+
} finally {
|
|
413
|
+
console.error = originalError;
|
|
414
|
+
console.warn = originalWarn;
|
|
415
|
+
}
|
|
387
416
|
}
|
|
388
417
|
/**
|
|
389
418
|
* Get the current rate limit status
|
|
@@ -1910,21 +1939,31 @@ async function runPullRequest(context) {
|
|
|
1910
1939
|
if (testFiles.size > 0) {
|
|
1911
1940
|
const testRunner = createTestRunner(framework);
|
|
1912
1941
|
const writtenPaths = Array.from(testFiles.keys());
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1942
|
+
try {
|
|
1943
|
+
info("Running tests with coverage...");
|
|
1944
|
+
const finalTestResults = await testRunner.runTests({
|
|
1945
|
+
testFiles: writtenPaths,
|
|
1946
|
+
framework,
|
|
1947
|
+
packageManager,
|
|
1948
|
+
projectRoot,
|
|
1949
|
+
coverage: true
|
|
1950
|
+
});
|
|
1951
|
+
const coverageReport = readCoverageReport(projectRoot, framework);
|
|
1952
|
+
if (coverageReport) {
|
|
1953
|
+
info(`Coverage collected: ${coverageReport.total.lines.percentage.toFixed(1)}% lines`);
|
|
1954
|
+
summary.coverageReport = coverageReport;
|
|
1955
|
+
summary.testResults = finalTestResults;
|
|
1956
|
+
} else {
|
|
1957
|
+
warn("Could not read coverage report");
|
|
1958
|
+
}
|
|
1959
|
+
} catch (err) {
|
|
1960
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
1961
|
+
if (errorMessage.includes("coverage") || errorMessage.includes("MISSING DEPENDENCY")) {
|
|
1962
|
+
warn(`Coverage collection failed (likely missing coverage package): ${errorMessage}`);
|
|
1963
|
+
warn("Continuing without coverage report");
|
|
1964
|
+
} else {
|
|
1965
|
+
throw err;
|
|
1966
|
+
}
|
|
1928
1967
|
}
|
|
1929
1968
|
}
|
|
1930
1969
|
if (config.enableAutoCommit && testFiles.size > 0) {
|