Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Interrupt shell script when some test case fail? #7026

Closed
tsaohucn opened this issue May 10, 2019 · 4 comments
Closed

How to Interrupt shell script when some test case fail? #7026

tsaohucn opened this issue May 10, 2019 · 4 comments

Comments

@tsaohucn
Copy link

I have a shell like below, and I hope it Interrupt itself when the test coverage going fail, it work when I use react-scripts in version2.1.8, but it doesn't work after I update react-scripts to version3.0.0, I found the variable $? return 1 even my tests have some fail case, is it a bug or just some function be changed? How could I get my hope function?

react-scripts test --silent --coverage --watchAll=false
if [[ $? > 0 ]]; then 
   echo $?
   echo "do something" ; exit 1;
else
   echo $?
   echo "do something" 
fi
@tsaohucn tsaohucn changed the title How to Interrupt shell script when test fail How to Interrupt shell script when some test case fail May 10, 2019
@tsaohucn tsaohucn changed the title How to Interrupt shell script when some test case fail How to Interrupt shell script when some test case fail? May 10, 2019
@heyimalex
Copy link
Contributor

Hm, yeah it looks like it returns a zero exit code even when tests fail, at least for me on windows. I think that should probably be a bug? I found jest/5841, and putting CI=1 before the call seems to work.

@tsaohucn
Copy link
Author

@heyimalex your way work, but the colors of word in thermal disappear when I use CI=1

@goranefbl
Copy link

@tsaohucn try using --bail instead, it should keep the styling/pretty output.

@mrmckeb
Copy link
Contributor

mrmckeb commented Jul 26, 2019

Closing in favour of #7180. We'll try to work this out ASAP.

@mrmckeb mrmckeb closed this as completed Jul 26, 2019
@lock lock bot locked and limited conversation to collaborators Jul 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants