I have a shell script that recursively searches for package.json from a base directory and runs npm test like so.
find "$parent_dir" -name package.json -maxdepth 2 -execdir npm test \;
I want to intercept tests failure in the form of:
npm ERR! Test failed. See above for more details.
npm ERR! not ok code 0
So I can have the shell script exit with an error status.
Any help is appreciated.