mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-29 17:53:39 +00:00
test(scripts): route docs i18n module changes
This commit is contained in:
@@ -2677,6 +2677,13 @@ function resolveDocsI18nBehaviorTargets(changedPath) {
|
||||
return ["test/scripts/docs-i18n-behavior.test.ts"];
|
||||
}
|
||||
|
||||
function resolveDocsI18nGoTargets(changedPath) {
|
||||
if (!/^scripts\/docs-i18n\/(?:go\.(?:mod|sum)|[^/]+\.go)$/u.test(changedPath)) {
|
||||
return null;
|
||||
}
|
||||
return ["test/scripts/docs-i18n.test.ts"];
|
||||
}
|
||||
|
||||
function resolveK8sManifestTargets(changedPath) {
|
||||
if (!/^scripts\/k8s\/manifests\/[^/]+\.yaml$/u.test(changedPath)) {
|
||||
return null;
|
||||
@@ -2714,6 +2721,7 @@ function resolveToolingTestTargets(changedPath, cwd = process.cwd()) {
|
||||
TOOLING_TEST_TARGETS.get(changedPath) ??
|
||||
resolveUpgradeSurvivorConfigRecipeTargets(changedPath) ??
|
||||
resolveDocsI18nBehaviorTargets(changedPath) ??
|
||||
resolveDocsI18nGoTargets(changedPath) ??
|
||||
resolveK8sManifestTargets(changedPath) ??
|
||||
resolveParallelsToolingTestTargets(changedPath);
|
||||
const conventionalTargets = resolveConventionalToolingTestTargets(changedPath, cwd);
|
||||
|
||||
15
test/scripts/docs-i18n.test.ts
Normal file
15
test/scripts/docs-i18n.test.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
// Docs i18n tests cover the Go module backing docs translation.
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
describe("docs-i18n Go module", () => {
|
||||
it("passes Go tests", () => {
|
||||
const result = spawnSync("go", ["test", "./...", "-count=1"], {
|
||||
cwd: "scripts/docs-i18n",
|
||||
encoding: "utf8",
|
||||
});
|
||||
|
||||
expect(result.error).toBeUndefined();
|
||||
expect(result.status, result.stderr || result.stdout).toBe(0);
|
||||
});
|
||||
});
|
||||
@@ -1084,6 +1084,19 @@ describe("scripts/test-projects changed-target routing", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps docs i18n Go module edits on Go module tests", () => {
|
||||
for (const modulePath of [
|
||||
"scripts/docs-i18n/main.go",
|
||||
"scripts/docs-i18n/main_test.go",
|
||||
"scripts/docs-i18n/go.mod",
|
||||
]) {
|
||||
expect(resolveChangedTestTargetPlan([modulePath]), modulePath).toEqual({
|
||||
mode: "targets",
|
||||
targets: ["test/scripts/docs-i18n.test.ts"],
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps k8s manifest edits on manifest tests", () => {
|
||||
expect(resolveChangedTestTargetPlan(["scripts/k8s/manifests/configmap.yaml"])).toEqual({
|
||||
mode: "targets",
|
||||
|
||||
Reference in New Issue
Block a user