mirror of
https://github.com/morluto/rea.git
synced 2026-11-29 01:46:39 +00:00
test(fixtures): use per-test cleanup in catalog suites (#14815)
This commit is contained in:
1 parent
39d3dbaac5
commit
5c49ebcf10
2 files changed
+4
-26
No files matched your search
@@ -1,8 +1,8 @@
|
||||
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
||||
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
||||
import { dirname, join, matchesGlob } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
||||
|
||||
@@ -14,20 +14,10 @@ import {
|
||||
} from "../../../scripts/lib/docs-facts.mjs";
|
||||
|
||||
const root = fileURLToPath(new URL("../../..", import.meta.url));
|
||||
const temporaryRoots: string[] = [];
|
||||
|
||||
afterEach(async () => {
|
||||
await Promise.all(
|
||||
temporaryRoots
|
||||
.splice(0)
|
||||
.map((path) => rm(path, { recursive: true, force: true })),
|
||||
);
|
||||
});
|
||||
|
||||
describe("literal tool counts", () => {
|
||||
it("refuses catalog-size restatements in living prose only", async () => {
|
||||
const directory = await createTestTempDirectory("rea-tool-count-facts-");
|
||||
temporaryRoots.push(directory);
|
||||
const write = async (path: string, content: string) => {
|
||||
await mkdir(dirname(join(directory, path)), { recursive: true });
|
||||
await writeFile(join(directory, path), content);
|
||||
@@ -88,7 +78,6 @@ describe("literal tool counts", () => {
|
||||
describe("translated README facts", () => {
|
||||
it("keeps translated readmes linked to canonical setup and tool details", async () => {
|
||||
const directory = await createTestTempDirectory("rea-readme-facts-");
|
||||
temporaryRoots.push(directory);
|
||||
const translatedPath = join(directory, "docs/readme/README_zh.md");
|
||||
const links = [
|
||||
"[Agents](docs/getting-started/installation.md#supported-agents)",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
||||
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
||||
|
||||
@@ -41,15 +41,6 @@ import {
|
||||
} from "../../../scripts/lib/product-catalog.mjs";
|
||||
|
||||
const root = fileURLToPath(new URL("../../..", import.meta.url));
|
||||
const temporaryRoots: string[] = [];
|
||||
|
||||
afterEach(async () => {
|
||||
await Promise.all(
|
||||
temporaryRoots
|
||||
.splice(0)
|
||||
.map((path) => rm(path, { recursive: true, force: true })),
|
||||
);
|
||||
});
|
||||
|
||||
describe("canonical product catalog", () => {
|
||||
it("admits every documented browser scenario through the named contract", async () => {
|
||||
@@ -209,7 +200,6 @@ describe("canonical product catalog drift", () => {
|
||||
|
||||
it("fails check mode without rewriting a stale generated artifact", async () => {
|
||||
const directory = await createTestTempDirectory("rea-generated-check-");
|
||||
temporaryRoots.push(directory);
|
||||
const path = join(directory, "catalog.json");
|
||||
await writeFile(path, "stale\n", "utf8");
|
||||
await expect(
|
||||
@@ -234,7 +224,6 @@ describe("canonical product catalog drift", () => {
|
||||
|
||||
it("accepts and preserves native generated-file line endings", async () => {
|
||||
const directory = await createTestTempDirectory("rea-generated-eol-");
|
||||
temporaryRoots.push(directory);
|
||||
const path = join(directory, "catalog.json");
|
||||
await writeFile(path, "current\r\n", "utf8");
|
||||
await expect(
|
||||
|
||||
Reference in new issue
Block a user