From 0570119b4075010dfb8b6611523e1d5c26829ccf Mon Sep 17 00:00:00 2001 From: cdetrio Date: Sat, 5 Aug 2017 17:10:03 -0400 Subject: validate.js takes schema file as argument --- .travis.yml | 2 +- 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++; } -- cgit v1.2.3