Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Jul 5, 2021
1 parent 1614b04 commit 5b01260
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 11 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"@types/node": "^15.0.3",
"@typescript-eslint/eslint-plugin": "^4.14.1",
"@typescript-eslint/parser": "^4.14.1",
"@webpack-cli/generators": "^2.2.0",
"@webpack-cli/migrate": "^1.1.2",
"coffeescript": "^2.5.1",
"colorette": "^1.2.1",
Expand Down
8 changes: 1 addition & 7 deletions smoketests/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ const runTest = (package, cliArgs = [], logMessage, isSubPackage = false) => {
proc.kill();
}, 30000);

const prompt = "Would you like to install";
let hasLogMessage = false,
hasPrompt = false,
hasPassed = false;

proc.stderr.on("data", (chunk) => {
Expand All @@ -56,11 +54,7 @@ const runTest = (package, cliArgs = [], logMessage, isSubPackage = false) => {
hasLogMessage = true;
}

if (data.includes(prompt)) {
hasPrompt = true;
}

if (hasLogMessage && hasPrompt) {
if (hasLogMessage) {
hasPassed = true;
proc.kill();
}
Expand Down
2 changes: 1 addition & 1 deletion smoketests/missing-command-packages/configtest.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const isSubPackage = true;
const configTest = () => {
const args = ["configtest"];
const logMessage =
"For using this command you need to install: '@webpack-cli/configtest' package";
"For using this command webpack-cli will need to install: '@webpack-cli/configtest' package";

return runTest(packageName, args, logMessage, isSubPackage);
};
Expand Down
2 changes: 1 addition & 1 deletion smoketests/missing-command-packages/generator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const isSubPackage = true;
const initTest = () => {
const args = ["init"];
const logMessage =
"For using this command you need to install: '@webpack-cli/generators' package";
"For using this command webpack-cli will need to install: '@webpack-cli/generators' package";

return runTest(packageName, args, logMessage, isSubPackage);
};
Expand Down
3 changes: 2 additions & 1 deletion smoketests/missing-command-packages/info.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const isSubPackage = true;

const infoTest = () => {
const args = ["info"];
const logMessage = "For using this command you need to install: '@webpack-cli/info' package";
const logMessage =
"For using this command webpack-cli will need to install: '@webpack-cli/info' package";

return runTest(packageName, args, logMessage, isSubPackage);
};
Expand Down
3 changes: 2 additions & 1 deletion smoketests/missing-command-packages/serve.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const isSubPackage = true;

const serveTest = () => {
const args = ["serve"];
const logMessage = "For using this command you need to install: '@webpack-cli/serve' package";
const logMessage =
"For using this command webpack-cli will need to install: '@webpack-cli/serve' package";

return runTest(packageName, args, logMessage, isSubPackage);
};
Expand Down

0 comments on commit 5b01260

Please sign in to comment.