Created
May 22, 2019 12:35
-
-
Save mattpocock/f4f1f2eb449302d983498126ac0232e6 to your computer and use it in GitHub Desktop.
Running jsinspect with an accepted number of errors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { execSync } = require('child_process'); | |
| const path = require('path'); | |
| const pathToInspect = path.resolve(__dirname, '../../../app'); | |
| const acceptedNumberOfErrors = 0; | |
| console.log(`Running jsinspect with accepted number of errors: ${acceptedNumberOfErrors}`) | |
| try { | |
| execSync(`jsinspect ${pathToInspect} -r json`); | |
| process.exit(); | |
| } catch(e) { | |
| const output = e.stdout.toString(); | |
| const parsedOutput = JSON.parse(output); | |
| if (parsedOutput.length && parsedOutput.length > acceptedNumberOfErrors) { | |
| console.log('Found errors:') | |
| console.log(JSON.stringify(parsedOutput, null, 2)); | |
| process.exit(2); | |
| } | |
| }; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment