@kakarot-ci/core 0.6.5 → 0.7.0
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 +18 -19
- package/dist/cli/index.js.map +2 -2
- package/dist/index.cjs +18 -19
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +18 -19
- 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/dist/src/types/config.d.ts +3 -0
- package/dist/src/types/config.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -87,6 +87,7 @@ var KakarotConfigSchema = import_zod.z.object({
|
|
|
87
87
|
enableAutoCommit: import_zod.z.boolean().default(true),
|
|
88
88
|
commitStrategy: import_zod.z.enum(["direct", "branch-pr"]).default("direct"),
|
|
89
89
|
enablePRComments: import_zod.z.boolean().default(true),
|
|
90
|
+
enableCoverage: import_zod.z.boolean().default(false),
|
|
90
91
|
debug: import_zod.z.boolean().default(false)
|
|
91
92
|
});
|
|
92
93
|
|
|
@@ -230,8 +231,6 @@ var GitHubClient = class {
|
|
|
230
231
|
this.retryDelay = 1e3;
|
|
231
232
|
this.owner = options.owner;
|
|
232
233
|
this.repo = options.repo;
|
|
233
|
-
const originalConsoleError = console.error;
|
|
234
|
-
const originalConsoleWarn = console.warn;
|
|
235
234
|
this.octokit = new import_rest.Octokit({
|
|
236
235
|
auth: options.token,
|
|
237
236
|
request: {
|
|
@@ -239,8 +238,6 @@ var GitHubClient = class {
|
|
|
239
238
|
retryAfter: this.retryDelay / 1e3
|
|
240
239
|
}
|
|
241
240
|
});
|
|
242
|
-
console.error = originalConsoleError;
|
|
243
|
-
console.warn = originalConsoleWarn;
|
|
244
241
|
}
|
|
245
242
|
/**
|
|
246
243
|
* Retry wrapper with exponential backoff
|
|
@@ -441,21 +438,23 @@ var GitHubClient = class {
|
|
|
441
438
|
async fileExists(ref, path) {
|
|
442
439
|
const originalError = console.error;
|
|
443
440
|
const originalWarn = console.warn;
|
|
444
|
-
const
|
|
445
|
-
const message = args
|
|
446
|
-
if (
|
|
447
|
-
|
|
441
|
+
const suppress404 = (...args) => {
|
|
442
|
+
const message = String(args[0] || "");
|
|
443
|
+
if (message.includes("404") || message.includes("Not Found")) {
|
|
444
|
+
return;
|
|
448
445
|
}
|
|
446
|
+
originalError(...args);
|
|
449
447
|
};
|
|
450
|
-
const
|
|
451
|
-
const message = args
|
|
452
|
-
if (
|
|
453
|
-
|
|
448
|
+
const suppress404Warn = (...args) => {
|
|
449
|
+
const message = String(args[0] || "");
|
|
450
|
+
if (message.includes("404") || message.includes("Not Found")) {
|
|
451
|
+
return;
|
|
454
452
|
}
|
|
453
|
+
originalWarn(...args);
|
|
455
454
|
};
|
|
456
455
|
try {
|
|
457
|
-
console.error =
|
|
458
|
-
console.warn =
|
|
456
|
+
console.error = suppress404;
|
|
457
|
+
console.warn = suppress404Warn;
|
|
459
458
|
await this.octokit.rest.repos.getContent({
|
|
460
459
|
owner: this.owner,
|
|
461
460
|
repo: this.repo,
|
|
@@ -2002,7 +2001,7 @@ async function runPullRequest(context) {
|
|
|
2002
2001
|
})),
|
|
2003
2002
|
errors
|
|
2004
2003
|
};
|
|
2005
|
-
if (testFiles.size > 0) {
|
|
2004
|
+
if (config.enableCoverage && testFiles.size > 0) {
|
|
2006
2005
|
const testRunner = createTestRunner(framework);
|
|
2007
2006
|
const writtenPaths = Array.from(testFiles.keys());
|
|
2008
2007
|
try {
|
|
@@ -2020,13 +2019,12 @@ async function runPullRequest(context) {
|
|
|
2020
2019
|
summary.coverageReport = coverageReport;
|
|
2021
2020
|
summary.testResults = finalTestResults;
|
|
2022
2021
|
} else {
|
|
2023
|
-
warn("Could not read coverage report");
|
|
2022
|
+
warn("Could not read coverage report (coverage package may be missing)");
|
|
2024
2023
|
}
|
|
2025
2024
|
} catch (err) {
|
|
2026
2025
|
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
2027
2026
|
if (errorMessage.includes("coverage") || errorMessage.includes("MISSING DEPENDENCY")) {
|
|
2028
|
-
warn(`Coverage collection failed (
|
|
2029
|
-
warn("Continuing without coverage report");
|
|
2027
|
+
warn(`Coverage collection failed (coverage package may be missing): ${errorMessage.split("\n")[0]}`);
|
|
2030
2028
|
} else {
|
|
2031
2029
|
throw err;
|
|
2032
2030
|
}
|
|
@@ -2123,7 +2121,8 @@ async function commitTests(githubClient, pr, testFiles, config, summary) {
|
|
|
2123
2121
|
info(`Committing ${testFiles.length} test file(s)`);
|
|
2124
2122
|
try {
|
|
2125
2123
|
if (config.commitStrategy === "branch-pr") {
|
|
2126
|
-
const
|
|
2124
|
+
const timestamp = Date.now();
|
|
2125
|
+
const branchName = `kakarot-ci/tests-pr-${pr.number}-${timestamp}`;
|
|
2127
2126
|
const baseSha = await githubClient.createBranch(branchName, pr.head.ref);
|
|
2128
2127
|
await githubClient.commitFiles({
|
|
2129
2128
|
files: testFiles.map((file) => ({
|