How would I write a script that will search my code files for key phrases (like "fit(" in a jasmine unit test) and throw an exception if it finds one. I don't mind supplying a top folder, but it should search through subfolders. Bonus points if I can pass it the key phrases in an array. I'm also ok with installing a node package to facilitate.
I have a script in my package json file I use for "checking in" files. It builds all, runs all tests, stages files and then commits them. I'd like to add this at the beginning, and exit (not build -> test, etc) if a forbidden phrase is found. (debugging flags like fit, deprecated methods maybe).
"commit-all": "ng build core-library --prod && ng build --prod && echo Executing tests && ng test --browsers ChromeHeadless --no-watch --codeCoverage=false && git checkout tsconfig.json && git checkout src/environments/environment.ts && git add . && git commit -m "