I have the following shell script:
#!/usr/bin/env sh
./node_modules/.bin/nightwatch --env chrome --tag=enabled
exit 0
The nightwatch
command always returns the exit code 1
, doen’t matter if the nightwatch tests will fail or pass. So, I want to check if the console output of this command contains a specific string (maybe failed
) to handle on it and to return a right exit code with the shell script.
The only requirement I have is, that the nightwatch command output is visible on console because we will need it because of debugging reasons.
I want to do something like this (pseudo code):
#!/usr/bin/env sh
./node_modules/.bin/nightwatch --env chrome --tag=enabled
if lastOutput.contains("failed"); then
exit 1
else
exit 0
fi