aboutsummaryrefslogtreecommitdiff
path: root/dev
diff options
context:
space:
mode:
Diffstat (limited to 'dev')
-rw-r--r--dev/schema-validate.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/dev/schema-validate.js b/dev/schema-validate.js
index 1cb69618..45285700 100644
--- a/dev/schema-validate.js
+++ b/dev/schema-validate.js
@@ -16,6 +16,7 @@
*/
const fs = require('fs');
+const {performance} = require('perf_hooks');
const {VM} = require('./vm');
const vm = new VM();
@@ -41,13 +42,17 @@ function main() {
const schema = JSON.parse(schemaSource);
for (const dataFileName of args.slice(1)) {
+ const start = performance.now();
try {
console.log(`Validating ${dataFileName}...`);
const dataSource = fs.readFileSync(dataFileName, {encoding: 'utf8'});
const data = JSON.parse(dataSource);
new JsonSchemaValidator().validate(data, schema);
- console.log('No issues found');
+ const end = performance.now();
+ console.log(`No issues detected (${((end - start) / 1000).toFixed(2)}s)`);
} catch (e) {
+ const end = performance.now();
+ console.log(`Encountered an error (${((end - start) / 1000).toFixed(2)}s)`);
console.warn(e);
}
}