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