Skip to content

Commit

Permalink
Merge pull request #9 from OrRosenblatt/log-file-success
Browse files Browse the repository at this point in the history
Add log on file validation success as well
  • Loading branch information
OrRosenblatt authored Nov 17, 2019
2 parents 66b97be + d810c9c commit 037cbee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/json-validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ export const validateJsons = async (
try {
const schema = await getJson(schemaPath);
const validatorFunc = await schemaValidator.prepareSchema(schema);
prettyLog(schemaPath);
return await Promise.all(
jsonRelativePaths.map(async relativePath => {
const filePath = path.join(sourceDir, relativePath);
try {
const jsonData = await getJson(filePath);
const result = await schemaValidator.validate(jsonData, validatorFunc);
prettyLog(filePath);
return { filePath, valid: result };
} catch (e) {
prettyLog(filePath, e);
Expand Down
2 changes: 1 addition & 1 deletion src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ export const prettyLog = (filePath: string, error?: Error): void => {
default:
break;
}
console.log(output);
console.log(`${output}\n`);
};

0 comments on commit 037cbee

Please sign in to comment.