mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-12 15:42:59 +00:00
fix(test): avoid empty script changed runs
This commit is contained in:
@@ -1647,8 +1647,11 @@ function resolveToolingChangedTestTargets(changedPaths, cwd = process.cwd()) {
|
||||
return [...new Set(targets)];
|
||||
}
|
||||
|
||||
const TOOLING_SCRIPT_PATH_PATTERN =
|
||||
/^scripts\/(.+)\.(?:mjs|cjs|js|mts|cts|ts|sh|py|ps1)$/u;
|
||||
|
||||
function resolveConventionalToolingTestTargets(changedPath, cwd = process.cwd()) {
|
||||
const match = /^scripts\/(.+)\.(?:mjs|ts|js|sh|py)$/u.exec(changedPath);
|
||||
const match = TOOLING_SCRIPT_PATH_PATTERN.exec(changedPath);
|
||||
if (!match) {
|
||||
return null;
|
||||
}
|
||||
@@ -1667,6 +1670,10 @@ function resolveConventionalToolingTestTargets(changedPath, cwd = process.cwd())
|
||||
return targets.length > 0 ? targets : null;
|
||||
}
|
||||
|
||||
function isToolingScriptPath(changedPath) {
|
||||
return TOOLING_SCRIPT_PATH_PATTERN.test(changedPath);
|
||||
}
|
||||
|
||||
function resolveParallelsToolingTestTargets(changedPath) {
|
||||
if (!/^scripts\/e2e\/parallels\/[^/]+\.ts$/u.test(changedPath)) {
|
||||
return null;
|
||||
@@ -1697,7 +1704,11 @@ function resolveToolingTestTargets(changedPath, cwd = process.cwd()) {
|
||||
if (explicitTargets && conventionalTargets) {
|
||||
return uniqueOrdered([...explicitTargets, ...conventionalTargets]);
|
||||
}
|
||||
return explicitTargets ?? conventionalTargets;
|
||||
return (
|
||||
explicitTargets ??
|
||||
conventionalTargets ??
|
||||
(isToolingScriptPath(changedPath) ? [TOOLING_VITEST_CONFIG] : null)
|
||||
);
|
||||
}
|
||||
|
||||
function shouldUseBroadChangedTargets(env = process.env) {
|
||||
|
||||
Reference in New Issue
Block a user