Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 2475590

Browse files
committed
Add integration tests for detach mode - actually starting ganache detached. Slow tests, but probably worth it.
1 parent 784e098 commit 2475590

File tree

4 files changed

+330
-4
lines changed

4 files changed

+330
-4
lines changed

src/packages/cli/package-lock.json

Lines changed: 194 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/packages/cli/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@
5959
"cross-env": "7.0.3",
6060
"mocha": "9.1.3",
6161
"ts-node": "10.4.0",
62-
"typescript": "4.6.4"
62+
"typescript": "4.6.4",
63+
"superagent": "6.1.0"
6364
},
6465
"dependencies": {
6566
"@ganache/colors": "0.3.0",

src/packages/cli/src/detach.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { fork } from "child_process";
1+
import { fork, ForkOptions } from "child_process";
22
import createInstanceName from "./process-name";
33
import envPaths from "env-paths";
44
import psList, { ProcessDescriptor } from "@trufflesuite/ps-list";
@@ -95,7 +95,8 @@ export async function startDetachedInstance(
9595
flavor?: FlavorName;
9696
server: { host: string; port: number };
9797
},
98-
version: string
98+
version: string,
99+
forkOptions?: ForkOptions
99100
): Promise<DetachedInstance> {
100101
const [bin, module, ...args] = argv;
101102

@@ -105,6 +106,7 @@ export async function startDetachedInstance(
105106
const childArgs = [...args, "--no-detach"];
106107

107108
const child = fork(module, childArgs, {
109+
...forkOptions,
108110
stdio: ["ignore", "ignore", "pipe", "ipc"],
109111
detached: true
110112
});

0 commit comments

Comments
 (0)