@kakarot-ci/core 0.6.0 → 0.6.1
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 +11 -2
- package/dist/cli/index.js.map +2 -2
- package/dist/index.cjs +11 -2
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +11 -2
- package/dist/index.js.map +2 -2
- package/dist/src/utils/test-target-extractor.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -772,15 +772,24 @@ async function analyzeFile(filePath, content, changedRanges, ref, githubClient,
|
|
|
772
772
|
async function extractTestTargets(files, githubClient, prHeadRef, config) {
|
|
773
773
|
info(`Analyzing ${files.length} file(s) for test targets`);
|
|
774
774
|
const diffs = parsePullRequestFiles(files);
|
|
775
|
+
const globToRegex = (pattern) => {
|
|
776
|
+
let regexStr = pattern.replace(/\./g, "\\.");
|
|
777
|
+
regexStr = regexStr.replace(/\*\*\//g, "__DOUBLE_STAR_SLASH__");
|
|
778
|
+
regexStr = regexStr.replace(/\*\*/g, "__DOUBLE_STAR__");
|
|
779
|
+
regexStr = regexStr.replace(/\*/g, "[^/]*");
|
|
780
|
+
regexStr = regexStr.replace(/__DOUBLE_STAR_SLASH__/g, "(.*/)?");
|
|
781
|
+
regexStr = regexStr.replace(/__DOUBLE_STAR__/g, ".*");
|
|
782
|
+
return new RegExp(`^${regexStr}$`);
|
|
783
|
+
};
|
|
775
784
|
const filteredDiffs = diffs.filter((diff) => {
|
|
776
785
|
const matchesInclude = config.includePatterns.some((pattern) => {
|
|
777
|
-
const regex =
|
|
786
|
+
const regex = globToRegex(pattern);
|
|
778
787
|
return regex.test(diff.filename);
|
|
779
788
|
});
|
|
780
789
|
if (!matchesInclude)
|
|
781
790
|
return false;
|
|
782
791
|
const matchesExclude = config.excludePatterns.some((pattern) => {
|
|
783
|
-
const regex =
|
|
792
|
+
const regex = globToRegex(pattern);
|
|
784
793
|
return regex.test(diff.filename);
|
|
785
794
|
});
|
|
786
795
|
return !matchesExclude;
|