Skip to content

Commit

Permalink
chore: handle undefined case
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabh3112 committed Mar 9, 2021
1 parent 827ab81 commit 203064b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion smoketests/missing-command-help/generator.test.js
Expand Up @@ -37,7 +37,10 @@ const runTest = () => {
}, 30000);

const logMessage = "For using 'init' command you need to install '@webpack-cli/generators' package";
const undefinedLogMessage = "Can't find and load command";

let hasLogMessage = false,
hasUndefinedLogMessage = false,
hasPassed = false;

proc.stderr.on('data', (chunk) => {
Expand All @@ -48,7 +51,11 @@ const runTest = () => {
hasLogMessage = true;
}

if (hasLogMessage) {
if (data.includes(undefinedLogMessage)) {
hasUndefinedLogMessage = true;
}

if (hasLogMessage || hasUndefinedLogMessage) {
hasPassed = true;
proc.kill();
}
Expand Down

0 comments on commit 203064b

Please sign in to comment.