@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.js
CHANGED
|
@@ -706,15 +706,24 @@ async function analyzeFile(filePath, content, changedRanges, ref, githubClient,
|
|
|
706
706
|
async function extractTestTargets(files, githubClient, prHeadRef, config) {
|
|
707
707
|
info(`Analyzing ${files.length} file(s) for test targets`);
|
|
708
708
|
const diffs = parsePullRequestFiles(files);
|
|
709
|
+
const globToRegex = (pattern) => {
|
|
710
|
+
let regexStr = pattern.replace(/\./g, "\\.");
|
|
711
|
+
regexStr = regexStr.replace(/\*\*\//g, "__DOUBLE_STAR_SLASH__");
|
|
712
|
+
regexStr = regexStr.replace(/\*\*/g, "__DOUBLE_STAR__");
|
|
713
|
+
regexStr = regexStr.replace(/\*/g, "[^/]*");
|
|
714
|
+
regexStr = regexStr.replace(/__DOUBLE_STAR_SLASH__/g, "(.*/)?");
|
|
715
|
+
regexStr = regexStr.replace(/__DOUBLE_STAR__/g, ".*");
|
|
716
|
+
return new RegExp(`^${regexStr}$`);
|
|
717
|
+
};
|
|
709
718
|
const filteredDiffs = diffs.filter((diff) => {
|
|
710
719
|
const matchesInclude = config.includePatterns.some((pattern) => {
|
|
711
|
-
const regex =
|
|
720
|
+
const regex = globToRegex(pattern);
|
|
712
721
|
return regex.test(diff.filename);
|
|
713
722
|
});
|
|
714
723
|
if (!matchesInclude)
|
|
715
724
|
return false;
|
|
716
725
|
const matchesExclude = config.excludePatterns.some((pattern) => {
|
|
717
|
-
const regex =
|
|
726
|
+
const regex = globToRegex(pattern);
|
|
718
727
|
return regex.test(diff.filename);
|
|
719
728
|
});
|
|
720
729
|
return !matchesExclude;
|