Skip to content

Commit

Permalink
feat: add util to run-and-get watch proc
Browse files Browse the repository at this point in the history
  • Loading branch information
hemal7735 authored and evenstensberg committed Feb 5, 2019
1 parent e9e1dcb commit 1d2ccd5
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/testUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,20 @@ function runWatch(testCase, args = []) {
});
}

function runAndGetWatchProc(testCase, args = []) {
const cwd = path.resolve(testCase);

const outputPath = path.resolve(testCase, "bin");
const argsWithOutput = args.concat("--output-path", outputPath);

const webpackProc = execa(WEBPACK_PATH, argsWithOutput, {
cwd,
reject: false
});

return webpackProc;
}

function extractSummary(stdout) {
if (stdout === "") {
return "";
Expand Down Expand Up @@ -167,4 +181,4 @@ function appendDataIfFileExists(testCase, file, data) {
}
}

module.exports = { run, runWatch, extractHash, extractSummary, appendDataIfFileExists };
module.exports = { run, runWatch, runAndGetWatchProc, extractHash, extractSummary, appendDataIfFileExists };

0 comments on commit 1d2ccd5

Please sign in to comment.