mirror of
https://github.com/morluto/rea.git
synced 2026-12-04 05:51:06 +00:00
test(javascript): share CLI and MCP session app fixtures (#16368)
* test(javascript): share CLI and MCP session app fixtures * test(mcp): remove unused session fixture import
This commit is contained in:
1 parent
efa6e16286
commit
b352b301c7
3 files changed
+22
-29
No files matched your search
@@ -18,7 +18,10 @@ import {
|
||||
encodeCliSessionFrame,
|
||||
MAX_CLI_SESSION_FRAME_BYTES,
|
||||
} from "../../support/cli/cliCommandSessionFrames.mjs";
|
||||
import { analyzeJavaScriptDirectory } from "../../support/cli/javascriptApplication.js";
|
||||
import {
|
||||
analyzeJavaScriptDirectory,
|
||||
writeSessionApp,
|
||||
} from "../../support/cli/javascriptApplication.js";
|
||||
import { writeFixtureFiles } from "../../support/workspace/writeFixtureFiles.js";
|
||||
|
||||
// Inert process models exercise escalation without waiting for real I/O.
|
||||
@@ -960,17 +963,6 @@ const analyzeArguments = (root: string): readonly string[] => [
|
||||
"json",
|
||||
];
|
||||
|
||||
const writeApplication = async (prefix: string): Promise<string> => {
|
||||
const root = await createTestTempDirectory(prefix);
|
||||
await writeFixtureFiles(root, {
|
||||
"package.json": JSON.stringify({ main: "main.cjs" }),
|
||||
"main.cjs":
|
||||
'const { BrowserWindow } = require("electron"); new BrowserWindow().loadFile("index.html");',
|
||||
"index.html": "page",
|
||||
});
|
||||
return root;
|
||||
};
|
||||
|
||||
cliTest(
|
||||
"matches a fresh CLI process and reuses that process for the same environment",
|
||||
async ({ cli, cliCommandSession }) => {
|
||||
@@ -1023,7 +1015,7 @@ cliTest(
|
||||
cliTest(
|
||||
"reuses one CLI process across JavaScript application directories",
|
||||
async ({ cli, cliCommandSession }) => {
|
||||
const firstRoot = await writeApplication("rea-shared-cli-");
|
||||
const firstRoot = await writeSessionApp("rea-shared-cli-");
|
||||
const fresh = await cli.run({
|
||||
freshProcess: true,
|
||||
arguments: analyzeArguments(firstRoot),
|
||||
@@ -1038,7 +1030,7 @@ cliTest(
|
||||
const pid = cliCommandSession.processId();
|
||||
expect(pid).toEqual(expect.any(Number));
|
||||
|
||||
const secondRoot = await writeApplication("rea-shared-cli-next-");
|
||||
const secondRoot = await writeSessionApp("rea-shared-cli-next-");
|
||||
const freshNext = await cli.run({
|
||||
freshProcess: true,
|
||||
arguments: analyzeArguments(secondRoot),
|
||||
|
||||
Reference in new issue
Block a user