Closed samanthakem closed 4 years ago
Adding a special named step seems like a bit of a hack. Getting the line number and preview here is great, but from the user's perspective I'd want the output to be something unique to when parse errors occur to make it more clear
Okay so I just added a logger.error(...)
which is specifies the issue with yaml parsing + process.exit(1)
.
The output would be this for a invalid yaml file:
[ERROR] YAML PARSER FAILED on file test-examples/wrong.yml: bad indentation of a mapping entry at line 5, column 3:
- /On branch ZZZ-[0-9]{0,10}\/no-id/
^
npm run lint
?fix/12-some-bug
As right now, the fix is basically adding the
parseYamlFile
as a first step for every file, the step will verify the current yaml, if it fails I get the exception message and add it as the reason for the test to fail which indicates the line and column from the invalid yaml file, if there is an invalid yaml file, the test will stop right away. Check the outputs below:====================== OUTPUTS =====================
Single invalid yaml file fails:
Single file test succeeds:
Directory tests fail with both invalid yaml and invalid step output: