feat: add Go migration compatibility foundation
This commit is contained in:
1 parent
7de3300034
commit
716a8031b1
27 files changed
+2582
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
describe("Go developer command contract", () => {
|
||||
it("uses one cross-platform runner without changing the caller's global Go environment", async () => {
|
||||
const packageJson = JSON.parse(await readFile(new URL("../package.json", import.meta.url), "utf8")) as {
|
||||
scripts: Record<string, string>;
|
||||
};
|
||||
expect(packageJson.scripts["go:fmt"]).toBe("node scripts/run-go-command.mjs fmt ./...");
|
||||
expect(packageJson.scripts["go:test"]).toBe("node scripts/run-go-command.mjs test ./...");
|
||||
expect(packageJson.scripts["go:vet"]).toBe("node scripts/run-go-command.mjs vet ./...");
|
||||
expect(packageJson.scripts["go:build"]).toBe("node scripts/run-go-command.mjs build ./cmd/zhinian-api");
|
||||
|
||||
const runner = await readFile(new URL("../scripts/run-go-command.mjs", import.meta.url), "utf8");
|
||||
expect(runner).toContain('CGO_ENABLED: process.env.CGO_ENABLED || "0"');
|
||||
expect(runner).toContain('new URL("../backend/", import.meta.url)');
|
||||
expect(runner).not.toContain("go env -w");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user