diff options
author | cdetrio <cdetrio@gmail.com> | 2017-08-06 05:10:03 +0800 |
---|---|---|
committer | Ubuntu <ubuntu@ip-172-31-32-43.us-west-2.compute.internal> | 2017-08-08 04:41:46 +0800 |
commit | 0570119b4075010dfb8b6611523e1d5c26829ccf (patch) | |
tree | 768da47ecb23d08d462981d9b38af8e8b1be5304 | |
parent | 8b3777057118b3157772dbe1fe9fb3404ecbb4c1 (diff) | |
download | dexon-tests-0570119b4075010dfb8b6611523e1d5c26829ccf.tar dexon-tests-0570119b4075010dfb8b6611523e1d5c26829ccf.tar.gz dexon-tests-0570119b4075010dfb8b6611523e1d5c26829ccf.tar.bz2 dexon-tests-0570119b4075010dfb8b6611523e1d5c26829ccf.tar.lz dexon-tests-0570119b4075010dfb8b6611523e1d5c26829ccf.tar.xz dexon-tests-0570119b4075010dfb8b6611523e1d5c26829ccf.tar.zst dexon-tests-0570119b4075010dfb8b6611523e1d5c26829ccf.zip |
validate.js takes schema file as argument
-rw-r--r-- | .travis.yml | 2 | ||||
-rwxr-xr-x | JSONSchema/validate.js | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/.travis.yml b/.travis.yml index 688906320..a2b9a2757 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,4 +11,4 @@ script: # will fail, if linting fails - find . -name "*.json" -not -name "*Filler.json" -print0 | xargs -I file -n1 -0 python -mjson.tool file /dev/null # run schema tests against GeneralStateTests -- echo -e "$(find GeneralStateTests -name '*.json' ! -path 'JSONSchema/schema.json')" | node JSONSchema/validate.js +- echo -e "$(find GeneralStateTests -name '*.json')" | node JSONSchema/validate.js JSONSchema/schema.json 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++; } |