Skip to content

Commit 1d2ccd5

Browse files
hemal7735evenstensberg
authored andcommittedFeb 5, 2019
feat: add util to run-and-get watch proc
1 parent e9e1dcb commit 1d2ccd5

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed
 

‎test/testUtils.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,20 @@ function runWatch(testCase, args = []) {
5959
});
6060
}
6161

62+
function runAndGetWatchProc(testCase, args = []) {
63+
const cwd = path.resolve(testCase);
64+
65+
const outputPath = path.resolve(testCase, "bin");
66+
const argsWithOutput = args.concat("--output-path", outputPath);
67+
68+
const webpackProc = execa(WEBPACK_PATH, argsWithOutput, {
69+
cwd,
70+
reject: false
71+
});
72+
73+
return webpackProc;
74+
}
75+
6276
function extractSummary(stdout) {
6377
if (stdout === "") {
6478
return "";
@@ -167,4 +181,4 @@ function appendDataIfFileExists(testCase, file, data) {
167181
}
168182
}
169183

170-
module.exports = { run, runWatch, extractHash, extractSummary, appendDataIfFileExists };
184+
module.exports = { run, runWatch, runAndGetWatchProc, extractHash, extractSummary, appendDataIfFileExists };

0 commit comments

Comments
 (0)
Please sign in to comment.