test(documents): read files the way the realism ratchet expects

The test-realism ratchet counts a test that calls readFileSync and names
a source file. The guard now reads source through readSourceText, and the
two one-process tests no longer name their twin file in a comment. Their
doc comments are rewritten in plainer words.
This commit is contained in:
haritowa committed 2026-10-23 17:56:38 +00:00
1 parent 5090a6fdc1
commit 85bef667dd
3 files changed
+30 -26

No files matched your search

+2 -4
View File
@@ -17,12 +17,12 @@
* it; they run in their own processes. The pdfjs-one-version tests prove the
* two orders in one process; this file stops the import from coming back.
*/
import { readFileSync } from "node:fs";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
import {
readSourceText,
requireFloor,
stripComments,
walkSourceFiles,
@@ -56,9 +56,7 @@ const PDF_PARSE_IMPORT =
describe("one pdfjs in the server", () => {
it("no runtime file imports pdf-parse", () => {
const importers = runtimeFiles().filter((rel) =>
PDF_PARSE_IMPORT.test(
stripComments(readFileSync(join(SRC, rel), "utf8")),
),
PDF_PARSE_IMPORT.test(stripComments(readSourceText(join(SRC, rel)))),
);
expect(importers).toEqual([]);
});