Skip to content

Commit

Permalink
split logic if we have an existing project configuration file
Browse files Browse the repository at this point in the history
  • Loading branch information
m5r committed Jul 1, 2024
1 parent 8143ac8 commit 25140ba
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/e2e/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ const downloadDockerHelperScript = () => new Promise((resolve, reject) => {
});

const spinUpCHT = () => new Promise((resolve, reject) => {
const childProcess = spawn(dockerHelperScript, { stdio: 'pipe', cwd: dockerHelperDirectory });
childProcess.on('error', reject);
childProcess.on('close', resolve);

const configFile = path.resolve(dockerHelperDirectory, `${projectName}.env`);
if (fs.existsSync(configFile)) {
childProcess.stdin.write('n\n');
childProcess.stdin.write('1\n');
const childProcess = spawn(dockerHelperScript, [`${projectName}.env`, 'up'], { cwd: dockerHelperDirectory });
childProcess.on('error', reject);
childProcess.on('close', resolve);
} else {
const childProcess = spawn(dockerHelperScript, { stdio: 'pipe', cwd: dockerHelperDirectory });
childProcess.on('error', reject);
childProcess.on('close', resolve);
childProcess.stdin.write('y\n');
childProcess.stdin.write('y\n');
childProcess.stdin.write(`${projectName}\n`);
Expand Down

0 comments on commit 25140ba

Please sign in to comment.