mirror of
https://github.com/morluto/rea
synced 2026-10-26 06:16:17 -04:00
test(applications): import capture fixtures with file URLs (#3050)
Convert the selected filesystem path at the fixture execution boundary. Exercise spaces and hash characters without changing real execution, CLI/MCP comparisons or the test timeout. Verified the full Linux and native Windows files with real ESM-loader negative controls. Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
5b16f24310
commit
89faa863ed
@@ -3,6 +3,7 @@ import { createHash } from "node:crypto";
|
||||
import { copyFile, mkdir, writeFile } from "node:fs/promises";
|
||||
import { createRequire } from "node:module";
|
||||
import { join, relative, resolve } from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { promisify } from "node:util";
|
||||
|
||||
import { Client } from "@modelcontextprotocol/client";
|
||||
@@ -1183,7 +1184,9 @@ describe("application workflow CLI copy boundaries", () => {
|
||||
|
||||
describe("application workflow CLI and MCP capture lifetimes", () => {
|
||||
it("compares captured primitives and source values after aliases are replaced", async () => {
|
||||
const root = await createTestTempDirectory("rea-capture-lifetime-cli-");
|
||||
const parent = await createTestTempDirectory("rea-capture-lifetime-cli-");
|
||||
const root = join(parent, "fixtures # capture");
|
||||
await mkdir(root);
|
||||
const fields = [
|
||||
"rebound",
|
||||
"rest",
|
||||
@@ -1247,7 +1250,9 @@ describe("application workflow CLI and MCP capture lifetimes", () => {
|
||||
"--input-type=module",
|
||||
"--eval",
|
||||
"const module = await import(process.argv[1]); console.log(JSON.stringify(module.default()));",
|
||||
join(root, String(index), "parser.mjs"),
|
||||
// ESM import() takes a URL specifier; a Windows drive path parses as a
|
||||
// `c:` URL scheme and is rejected.
|
||||
pathToFileURL(join(root, String(index), "parser.mjs")).href,
|
||||
]);
|
||||
expect(JSON.parse(stdout)).toEqual({
|
||||
kind: "capture-boundary",
|
||||
|
||||
Reference in New Issue
Block a user