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

Commit

Permalink
Add integration tests for detach mode - actually starting ganache det…
Browse files Browse the repository at this point in the history
…ached. Slow tests, but probably worth it.
  • Loading branch information
jeffsmale90 committed Nov 24, 2022
1 parent 784e098 commit 2475590
Show file tree
Hide file tree
Showing 4 changed files with 330 additions and 4 deletions.
194 changes: 194 additions & 0 deletions src/packages/cli/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
"cross-env": "7.0.3",
"mocha": "9.1.3",
"ts-node": "10.4.0",
"typescript": "4.6.4"
"typescript": "4.6.4",
"superagent": "6.1.0"
},
"dependencies": {
"@ganache/colors": "0.3.0",
Expand Down
6 changes: 4 additions & 2 deletions src/packages/cli/src/detach.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fork } from "child_process";
import { fork, ForkOptions } from "child_process";
import createInstanceName from "./process-name";
import envPaths from "env-paths";
import psList, { ProcessDescriptor } from "@trufflesuite/ps-list";
Expand Down Expand Up @@ -95,7 +95,8 @@ export async function startDetachedInstance(
flavor?: FlavorName;
server: { host: string; port: number };
},
version: string
version: string,
forkOptions?: ForkOptions
): Promise<DetachedInstance> {
const [bin, module, ...args] = argv;

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

const child = fork(module, childArgs, {
...forkOptions,
stdio: ["ignore", "ignore", "pipe", "ipc"],
detached: true
});
Expand Down
Loading

0 comments on commit 2475590

Please sign in to comment.