test(scripts): route docs i18n module changes · openclaw/openclaw@cbbb466
vincentkoc
·
2026-06-21
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2677,6 +2677,13 @@ function resolveDocsI18nBehaviorTargets(changedPath) {
|
2677 | 2677 | return ["test/scripts/docs-i18n-behavior.test.ts"]; |
2678 | 2678 | } |
2679 | 2679 | |
| 2680 | +function resolveDocsI18nGoTargets(changedPath) { |
| 2681 | +if (!/^scripts\/docs-i18n\/(?:go\.(?:mod|sum)|[^/]+\.go)$/u.test(changedPath)) { |
| 2682 | +return null; |
| 2683 | +} |
| 2684 | +return ["test/scripts/docs-i18n.test.ts"]; |
| 2685 | +} |
| 2686 | + |
2680 | 2687 | function resolveK8sManifestTargets(changedPath) { |
2681 | 2688 | if (!/^scripts\/k8s\/manifests\/[^/]+\.yaml$/u.test(changedPath)) { |
2682 | 2689 | return null; |
@@ -2714,6 +2721,7 @@ function resolveToolingTestTargets(changedPath, cwd = process.cwd()) {
|
2714 | 2721 | TOOLING_TEST_TARGETS.get(changedPath) ?? |
2715 | 2722 | resolveUpgradeSurvivorConfigRecipeTargets(changedPath) ?? |
2716 | 2723 | resolveDocsI18nBehaviorTargets(changedPath) ?? |
| 2724 | +resolveDocsI18nGoTargets(changedPath) ?? |
2717 | 2725 | resolveK8sManifestTargets(changedPath) ?? |
2718 | 2726 | resolveParallelsToolingTestTargets(changedPath); |
2719 | 2727 | const conventionalTargets = resolveConventionalToolingTestTargets(changedPath, cwd); |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Docs i18n tests cover the Go module backing docs translation. |
| 2 | +import { spawnSync } from "node:child_process"; |
| 3 | +import { describe, expect, it } from "vitest"; |
| 4 | + |
| 5 | +describe("docs-i18n Go module", () => { |
| 6 | +it("passes Go tests", () => { |
| 7 | +const result = spawnSync("go", ["test", "./...", "-count=1"], { |
| 8 | +cwd: "scripts/docs-i18n", |
| 9 | +encoding: "utf8", |
| 10 | +}); |
| 11 | + |
| 12 | +expect(result.error).toBeUndefined(); |
| 13 | +expect(result.status, result.stderr || result.stdout).toBe(0); |
| 14 | +}); |
| 15 | +}); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1084,6 +1084,19 @@ describe("scripts/test-projects changed-target routing", () => {
|
1084 | 1084 | } |
1085 | 1085 | }); |
1086 | 1086 | |
| 1087 | +it("keeps docs i18n Go module edits on Go module tests", () => { |
| 1088 | +for (const modulePath of [ |
| 1089 | +"scripts/docs-i18n/main.go", |
| 1090 | +"scripts/docs-i18n/main_test.go", |
| 1091 | +"scripts/docs-i18n/go.mod", |
| 1092 | +]) { |
| 1093 | +expect(resolveChangedTestTargetPlan([modulePath]), modulePath).toEqual({ |
| 1094 | +mode: "targets", |
| 1095 | +targets: ["test/scripts/docs-i18n.test.ts"], |
| 1096 | +}); |
| 1097 | +} |
| 1098 | +}); |
| 1099 | + |
1087 | 1100 | it("keeps k8s manifest edits on manifest tests", () => { |
1088 | 1101 | expect(resolveChangedTestTargetPlan(["scripts/k8s/manifests/configmap.yaml"])).toEqual({ |
1089 | 1102 | mode: "targets", |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。