Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | 1x 1x 1x 1x 11x 1x 51x 51x 51x 92x 92x 21x 21x 21x 71x 1x | const Validator = require('jsonschema').Validator; const AppUI = require('./ui').AppUI; const util = require('util') Validator.prototype.customFormats.isFunction = function(input) { return typeof input === "function" }; const configSchema = { id: "/solcoverjs", type: "object", properties: { client: {type: "object"}, cwd: {type: "string"}, host: {type: "string"}, abiOutputPath: {type: "string"}, matrixOutputPath: {type: "string"}, matrixReporterPath: {type: "string"}, port: {type: "number"}, providerOptions: {type: "object"}, silent: {type: "boolean"}, autoLaunchServer: {type: "boolean"}, istanbulFolder: {type: "string"}, measureStatementCoverage: {type: "boolean"}, measureFunctionCoverage: {type: "boolean"}, measureModifierCoverage: {type: "boolean"}, measureLineCoverage: {type: "boolean"}, measureBranchCoverage: {type: "boolean"}, // Hooks: onServerReady: {type: "function", format: "isFunction"}, onCompileComplete: {type: "function", format: "isFunction"}, onTestComplete: {type: "function", format: "isFunction"}, onIstanbulComplete: {type: "function", format: "isFunction"}, // Arrays skipFiles: { type: "array", items: {type: "string"} }, istanbulReporter: { type: "array", items: {type: "string"} }, modifierWhitelist: { type: "array", items: {type: "string"} } }, }; class ConfigValidator { constructor(){ this.validator = new Validator(); this.validator.addSchema(configSchema); this.ui = new AppUI(); } validate(config){ let result = this.validator.validate(config, configSchema); if (result.errors.length){ let msg; const option = `"${result.errors[0].property.replace('instance.', '')}"`; (result.errors[0].argument === 'isFunction') ? msg = `${option} is not a function` : msg = `${option} ${result.errors[0].message}`; throw new Error(this.ui.generate('config-fail', [msg])); } return true; } } module.exports = ConfigValidator; |