scratch-www/test/localization/check_valid_json.js
Ray 0db93fcc81 Don't create a separate test for each l10n json
Reduces the spam in Travis for visibility
2019-01-11 12:15:58 -05:00

23 lines
541 B
JavaScript

var fs = require('fs');
var glob = require('glob');
var tap = require('tap');
var TRANSLATIONS_PATTERN = './node_modules/scratchr2_translations/www/**/*.json';
var files = glob.sync(TRANSLATIONS_PATTERN);
const checkJson = (data, name) => {
try {
JSON.parse(data);
} catch (e) {
tap.fail(name + ' has invalid Json.\n');
}
};
tap.test('check valid json', function (t) {
files.forEach(function (f) {
const data = fs.readFileSync(f);
checkJson(data, f);
});
t.pass();
t.end();
});