aboutsummaryrefslogtreecommitdiffstats
path: root/JSONSchema/validate.js
diff options
context:
space:
mode:
authorcdetrio <cdetrio@gmail.com>2017-08-06 05:10:03 +0800
committerUbuntu <ubuntu@ip-172-31-32-43.us-west-2.compute.internal>2017-08-08 04:41:46 +0800
commit0570119b4075010dfb8b6611523e1d5c26829ccf (patch)
tree768da47ecb23d08d462981d9b38af8e8b1be5304 /JSONSchema/validate.js
parent8b3777057118b3157772dbe1fe9fb3404ecbb4c1 (diff)
downloaddexon-tests-0570119b4075010dfb8b6611523e1d5c26829ccf.tar.gz
dexon-tests-0570119b4075010dfb8b6611523e1d5c26829ccf.tar.zst
dexon-tests-0570119b4075010dfb8b6611523e1d5c26829ccf.zip
validate.js takes schema file as argument
Diffstat (limited to 'JSONSchema/validate.js')
-rwxr-xr-xJSONSchema/validate.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/JSONSchema/validate.js b/JSONSchema/validate.js
index fa46ac39c..1a1a605db 100755
--- a/JSONSchema/validate.js
+++ b/JSONSchema/validate.js
@@ -4,6 +4,7 @@ var fs = require('fs');
var validate = require('jsonschema').validate;
var readline = require('readline');
+var schemaFile = process.argv[2];
var schema = '';
var testCode = '';
var success = true;
@@ -23,7 +24,7 @@ rl.on('line', function(line) {
});
rl.on('close', function() {
- schema = JSON.parse(fs.readFileSync('JSONSchema/schema.json'));
+ schema = JSON.parse(fs.readFileSync(schemaFile));
//sort file names alphabetically so that log output ordering is consistent
fileNames.sort(function(a,b) {
@@ -40,6 +41,7 @@ rl.on('close', function() {
try {
testCode = JSON.parse(fs.readFileSync(fileNames[i]));
} catch(e) {
+ console.log('error on file:', fileNames[i])
console.log(e);
numFailed++;
}