diff --git a/.buddyrc b/.buddyrc index b872402..d999451 100644 --- a/.buddyrc +++ b/.buddyrc @@ -1,6 +1,5 @@ { - "detectObjects": false, - "enforceConst": false, - "ignore": [0, 1, 2, 3], - "reporter": "detailed" + "detectObjects": true, + "enforceConst": true, + "reporter": "detailed" } \ No newline at end of file diff --git a/.eslintrc b/.eslintrc.json similarity index 92% rename from .eslintrc rename to .eslintrc.json index 90db2be..15627c1 100644 --- a/.eslintrc +++ b/.eslintrc.json @@ -7,6 +7,7 @@ "rules": { "max-lines-per-function" : ["error", 30], "no-plusplus" : ["error", { "allowForLoopAfterthoughts": true }], + "no-console" : ["off"], "no-unused-vars": [ "error", { diff --git a/.gitignore b/.gitignore index 20b89ca..0b8ed8c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules/ .nyc_output/ coverage/ coverage.lcov +module-depencency.svg \ No newline at end of file diff --git a/.madgerc b/.madgerc new file mode 100644 index 0000000..c96c4fc --- /dev/null +++ b/.madgerc @@ -0,0 +1,12 @@ +{ + "fontSize": "10px", + "backgroundColor" : "#ffffff", + "nodeColor": "#000000", + "edgeColor" : "#000000", + "noDependencyColor" : "#7f7f7f", + "graphVizOptions": { + "G": { + "rankdir": "LR" + } + } +} \ No newline at end of file diff --git a/lib/cli/output/init.js b/lib/cli/output/init.js index 45820d2..a62f767 100644 --- a/lib/cli/output/init.js +++ b/lib/cli/output/init.js @@ -30,9 +30,11 @@ const sendError = (error) => { }; const handleResponse = (status) => { - if (status.code === 200) { + const httpOK = 200; + const httpFailure = 4; + if (status.code === httpOK) { sendSuccessWelcome(status.name); - } else if (status.code === 4) { + } else if (status.code === httpFailure) { sendError('\nPlease check your network connection'); } else { sendError('\nInvalid Username or Password'); diff --git a/lib/model/eval.js b/lib/model/eval.js index a49bf16..f20f836 100644 --- a/lib/model/eval.js +++ b/lib/model/eval.js @@ -21,7 +21,8 @@ const getRequestArray = (evalOptions) => { return [idNo, lab, commitHash, lang]; }; -const socketEventHandler = (event, socket, data, callback) => { +/* eslint-disable max-lines-per-function */ +const socketEventHandler = (event, socket, data, callback) => { let response; switch (event) { case 'invalid': diff --git a/lib/model/init.js b/lib/model/init.js index 7f6ec5f..f18c0cd 100644 --- a/lib/model/init.js +++ b/lib/model/init.js @@ -10,6 +10,7 @@ const fetchPrivateToken = async (host, username, password) => { }; logger.moduleLog('debug', 'Init Model', `POST request to ${options.uri}`); + console.log(options.uri); const response = await requestPromise(options).json(); return { @@ -30,12 +31,14 @@ const updateCredentials = (credentials, privateToken) => { }; const authenticate = async (credentials) => { + const httpOK = 200; + const httpFailure = 4; try { const { privateToken, name } = await fetchPrivateToken(preferenceManager.getPreference({ name: 'cliPrefs' }).gitlab.host, credentials.username, credentials.password); logger.moduleLog('debug', 'Init Model', `Authenticated ${name}.`); updateCredentials(credentials, privateToken); return { - code: 200, + code: httpOK, name, }; } catch (e) { @@ -43,7 +46,7 @@ const authenticate = async (credentials) => { if (!e.statusCode) { logger.moduleLog('error', 'Init Model', 'Error code = 4'); return { - code: 4, + code: httpFailure, }; } return { diff --git a/lib/utils/preference-manager.js b/lib/utils/preference-manager.js index 1aa2bab..5c3cc5c 100644 --- a/lib/utils/preference-manager.js +++ b/lib/utils/preference-manager.js @@ -1,4 +1,3 @@ -/* eslint no-use-before-define: "warn" */ const Preferences = require('preferences'); const _ = require('lodash'); const path = require('path'); @@ -32,51 +31,66 @@ const deleteCredentials = () => { gitLabPrefs.storedTime = -1; }; +const storeGitlabPrefs = (values) => { + _.assign(gitLabPrefs, values); + + gitLabPrefs.storedTime = Date.now(); +}; + +const assignValidtor = (objValue, srcValue) => (srcValue || objValue); + +const storeLoggerPrefs = (values) => { + const modValues = values; + const { blacklist } = modValues.logger; + if (blacklist && blacklist.keyword) { + if (_.isArray(blacklist.keyword)) { + _.assign(cliPrefs, { + logger: { + blacklist: blacklist.keyword, + }, + }); + } else { + cliPrefs.logger.blacklist.push(blacklist.keyword); + } + } + + modValues.logger = _.omit(modValues.logger, 'blacklist'); + _.assignWith(cliPrefs.logger, modValues.logger, assignValidtor); +}; + const setDefaultGitlabHost = () => { - setPreference({ - name: 'cliPrefs', - values: { - gitlab: { - host: defaultGitlab.host, - }, + _.assign(cliPrefs, { + gitlab: { + host: defaultGitlab.host, }, }); }; const setDefaultLanguage = () => { - setPreference({ - name: 'cliPrefs', - values: { - submission: { - language: defaultLang, - }, + _.assign(cliPrefs, { + submission: { + language: defaultLang, }, }); }; const setDefaultMainServer = () => { - setPreference({ - name: 'cliPrefs', - values: { - main_server: { - host: defaultMainServer.host, - port: defaultMainServer.port, - }, + _.assign(cliPrefs, { + main_server: { + host: defaultMainServer.host, + port: defaultMainServer.port, }, }); }; const setDefaultLogger = () => { - setPreference({ - name: 'loggerPrefs', - values: { - logger: { - maxSize: defaultLogger.maxSize, - logDirectory: defaultLogger.logDirectory, - logLocation: defaultLogger.logLocation, - blacklist: { - keyword: defaultLogger.blacklist, - }, + storeLoggerPrefs({ + logger: { + maxSize: defaultLogger.maxSize, + logDirectory: defaultLogger.logDirectory, + logLocation: defaultLogger.logLocation, + blacklist: { + keyword: defaultLogger.blacklist, }, }, }); @@ -97,33 +111,6 @@ const setDefaultPreferences = () => { } }; -const storeGitlabPrefs = (values) => { - _.assign(gitLabPrefs, values); - - gitLabPrefs.storedTime = Date.now(); -}; - -const assignValidtor = (objValue, srcValue) => (srcValue || objValue); - -const storeLoggerPrefs = (values) => { - const modValues = values; - const { blacklist } = modValues.logger; - if (blacklist && blacklist.keyword) { - if (_.isArray(blacklist.keyword)) { - _.assign(cliPrefs, { - logger: { - blacklist: blacklist.keyword, - }, - }); - } else { - cliPrefs.logger.blacklist.push(blacklist.keyword); - } - } - - modValues.logger = _.omit(modValues.logger, 'blacklist'); - _.assignWith(cliPrefs.logger, modValues.logger, assignValidtor); -}; - const getPreference = (options) => { switch (options.name) { case 'gitLabPrefs': diff --git a/package-lock.json b/package-lock.json index 3496a70..334352a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,12 @@ "js-tokens": "^4.0.0" } }, + "@babel/parser": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.1.3.tgz", + "integrity": "sha512-gqmspPZOMW3MIRb9HlrnbZHXI1/KHTOroBwN1NcLL6pWxzqzEKGvRTq0W/PxS45OtQGbaFikSQpkS5zbnsQm2w==", + "dev": true + }, "acorn": { "version": "5.7.3", "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", @@ -84,6 +90,12 @@ "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=", "dev": true }, + "app-module-path": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/app-module-path/-/app-module-path-2.2.0.tgz", + "integrity": "sha1-ZBqlXft9am8KgUHEucCqULbCTdU=", + "dev": true + }, "are-we-there-yet": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", @@ -163,6 +175,12 @@ "repeat-string": "^1.6.1" } }, + "ast-module-types": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/ast-module-types/-/ast-module-types-2.4.0.tgz", + "integrity": "sha512-fAa+ZUKT0q5GPnC/sa8+X3jYY1t3Rw3jT3CxEwBfrZLTzWUtXOWQK9EiSPycvHgUpI1ygSfJZWFki66UdbXL8Q==", + "dev": true + }, "async": { "version": "2.6.1", "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", @@ -592,6 +610,12 @@ "resolved": "https://registry.npmjs.org/cli-spinner/-/cli-spinner-0.2.8.tgz", "integrity": "sha512-Z4l0jljucEUsW/5GNaVYOpGgVmnB/Sq4l2vG9k7RbJYRZ97hVncP+BqRMemTZNBHZ4aYUPJPU/wl6zt/ZSqzPQ==" }, + "cli-spinners": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-1.3.1.tgz", + "integrity": "sha512-1QL4544moEsDVH9T/l6Cemov/37iv1RtoKf7NJ04A60+4MREXNfx/QvavbH6QoGdsD4N4Mwy49cmaINR/o2mdg==", + "dev": true + }, "cli-table": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/cli-table/-/cli-table-0.3.1.tgz", @@ -629,6 +653,12 @@ "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=" }, + "clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", + "dev": true + }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -920,6 +950,12 @@ "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", "dev": true }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, "component-bind": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz", @@ -1097,12 +1133,27 @@ "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=", "dev": true }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true + }, "deep-is": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, + "defaults": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", + "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", + "dev": true, + "requires": { + "clone": "^1.0.2" + } + }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -1137,6 +1188,41 @@ "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" }, + "dependency-tree": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/dependency-tree/-/dependency-tree-6.2.1.tgz", + "integrity": "sha512-XkQ6KFHiO+VTM71zLtZ1KuCL6BWMW7GXvFWTCWOPOMgccYp68CBpSSqKR8trw8HsniSAi7hBjPcBqNCYMVzUWQ==", + "dev": true, + "requires": { + "commander": "^2.17.1", + "debug": "^4.0.1", + "filing-cabinet": "^2.0.1", + "precinct": "^5.0.0" + }, + "dependencies": { + "commander": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", + "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==", + "dev": true + }, + "debug": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz", + "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, "detect-indent": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", @@ -1146,6 +1232,167 @@ "repeating": "^2.0.0" } }, + "detective-amd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/detective-amd/-/detective-amd-3.0.0.tgz", + "integrity": "sha512-kOpKHyabdSKF9kj7PqYHLeHPw+TJT8q2u48tZYMkIcas28el1CYeLEJ42Nm+563/Fq060T5WknfwDhdX9+kkBQ==", + "dev": true, + "requires": { + "ast-module-types": "^2.3.1", + "escodegen": "^1.8.0", + "get-amd-module-type": "^3.0.0", + "node-source-walk": "^4.0.0" + } + }, + "detective-cjs": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/detective-cjs/-/detective-cjs-3.1.1.tgz", + "integrity": "sha512-JQtNTBgFY6h8uT6pgph5QpV3IyxDv+z3qPk/FZRDT9TlFfm5dnRtpH39WtQEr1khqsUxVqXzKjZHpdoQvQbllg==", + "dev": true, + "requires": { + "ast-module-types": "^2.4.0", + "node-source-walk": "^4.0.0" + } + }, + "detective-es6": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/detective-es6/-/detective-es6-2.0.0.tgz", + "integrity": "sha512-lo2kHVepcq3v39Q/t5uY6sy3cK1g29Kgi4Sj4KpR/15WGwecwma1yaEzZoofyJg/QyeOz36DZhouJ3eD46efCg==", + "dev": true, + "requires": { + "node-source-walk": "^4.0.0" + } + }, + "detective-less": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/detective-less/-/detective-less-1.0.2.tgz", + "integrity": "sha512-Rps1xDkEEBSq3kLdsdnHZL1x2S4NGDcbrjmd4q+PykK5aJwDdP5MBgrJw1Xo+kyUHuv3JEzPqxr+Dj9ryeDRTA==", + "dev": true, + "requires": { + "debug": "^4.0.0", + "gonzales-pe": "^4.2.3", + "node-source-walk": "^4.0.0" + }, + "dependencies": { + "debug": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz", + "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, + "detective-postcss": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/detective-postcss/-/detective-postcss-3.0.0.tgz", + "integrity": "sha512-Dq4pza3UAT5gXHmNjinxhTydKGd9m3Tr6d0epP9VBipQfQl/ipe3ml7ybxpHk4TRwT2RPXKRsnCHhXfEdpksAQ==", + "dev": true, + "requires": { + "debug": "^3.1.0", + "is-url": "^1.2.4", + "postcss": "^7.0.2", + "postcss-values-parser": "^1.5.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, + "detective-sass": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/detective-sass/-/detective-sass-3.0.0.tgz", + "integrity": "sha512-f03DULR4EipUpb1HCTHNGUWoRuLi9SDMgMdp+JiSVAWD5kwjI2NY1IOUiqmGbA3C/zQIWXBrC8+U2C3bMJqCFQ==", + "dev": true, + "requires": { + "debug": "^3.1.0", + "gonzales-pe": "^4.2.3", + "node-source-walk": "^4.0.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, + "detective-scss": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/detective-scss/-/detective-scss-2.0.0.tgz", + "integrity": "sha512-44cNM76EcT3ImnuMJQHi6q2ldYl+obXHuU6OtpcPfqJg4aH4F4mjHcCyQfn0ohwqYE8FQY64jSThgZwfDjMkdQ==", + "dev": true, + "requires": { + "debug": "^3.1.0", + "gonzales-pe": "^4.2.3", + "node-source-walk": "^4.0.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, + "detective-stylus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/detective-stylus/-/detective-stylus-1.0.0.tgz", + "integrity": "sha1-UK7n24uruZA4HwEMY/q7pbWOVM0=", + "dev": true + }, + "detective-typescript": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/detective-typescript/-/detective-typescript-4.1.1.tgz", + "integrity": "sha512-iXvTH248pjxKsvSren1t2bHCGoSYgk8k9PeqPEuaz8AP11zoVMivE/lVpp8GpurOtIX9XGFCHloEsQ4RbWXd9Q==", + "dev": true, + "requires": { + "node-source-walk": "^4.0.0", + "typescript": "^3.0.3", + "typescript-eslint-parser": "^18.0.0" + } + }, "diagnostics": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/diagnostics/-/diagnostics-1.1.1.tgz", @@ -1238,11 +1485,31 @@ "has-binary2": "~1.0.2" } }, + "enhanced-resolve": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz", + "integrity": "sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "memory-fs": "^0.4.0", + "tapable": "^1.0.0" + } + }, "env-variable": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/env-variable/-/env-variable-0.0.4.tgz", "integrity": "sha512-+jpGxSWG4vr6gVxUHOc4p+ilPnql7NzZxOZBxNldsKGjCF+97df3CbuX7XMaDa5oAVkKQj4rKp38rYdC4VcpDg==" }, + "errno": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", + "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", + "dev": true, + "requires": { + "prr": "~1.0.1" + } + }, "error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -1343,6 +1610,34 @@ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, + "escodegen": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.11.0.tgz", + "integrity": "sha512-IeMV45ReixHS53K/OmfKAIztN/igDHzTJUhZM3k1jMhIZWjk45SMwAtBsEXiJp3vSPmTcu6CXn7mDvFHRN66fw==", + "dev": true, + "requires": { + "esprima": "^3.1.3", + "estraverse": "^4.2.0", + "esutils": "^2.0.2", + "optionator": "^0.8.1", + "source-map": "~0.6.1" + }, + "dependencies": { + "esprima": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "optional": true + } + } + }, "eslint": { "version": "5.7.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.7.0.tgz", @@ -1768,12 +2063,70 @@ "object-assign": "^4.0.1" } }, + "file-exists": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/file-exists/-/file-exists-2.0.0.tgz", + "integrity": "sha1-okFQZlFQ5i1VvFRJKB2I0rCBDco=", + "dev": true + }, "filepaths": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/filepaths/-/filepaths-0.3.0.tgz", "integrity": "sha1-ocmkYBturn+4dvwayYR5zrVXwXc=", "dev": true }, + "filing-cabinet": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/filing-cabinet/-/filing-cabinet-2.0.2.tgz", + "integrity": "sha512-W7n/5ufqakk+w+hnZrah57bAxvruOgLnAHSboFdGzVOUrFaSyci4nMfGJmKBEE3STQKnG7t4DnwtVI34gsDDCg==", + "dev": true, + "requires": { + "app-module-path": "^2.2.0", + "commander": "^2.13.0", + "debug": "^3.1.0", + "enhanced-resolve": "^4.1.0", + "is-relative-path": "^1.0.2", + "module-definition": "^3.0.0", + "module-lookup-amd": "^5.0.1", + "resolve": "^1.5.0", + "resolve-dependency-path": "^1.0.2", + "sass-lookup": "^2.0.0", + "stylus-lookup": "^2.0.0", + "typescript": "^3.0.3" + }, + "dependencies": { + "commander": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", + "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==", + "dev": true + }, + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, + "find": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/find/-/find-0.2.9.tgz", + "integrity": "sha1-S3Px/55WrZG3bnFkB/5f/mVUu4w=", + "dev": true, + "requires": { + "traverse-chain": "~0.1.0" + } + }, "find-up": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", @@ -1796,6 +2149,12 @@ "write": "^0.2.1" } }, + "flatten": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/flatten/-/flatten-1.0.2.tgz", + "integrity": "sha1-2uRqnXj74lKSJYzB54CkHZXAN4I=", + "dev": true + }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -1830,6 +2189,17 @@ "samsam": "1.x" } }, + "fs-extra": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-5.0.0.tgz", + "integrity": "sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -1875,12 +2245,28 @@ "is-property": "^1.0.0" } }, + "get-amd-module-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-amd-module-type/-/get-amd-module-type-3.0.0.tgz", + "integrity": "sha512-99Q7COuACPfVt18zH9N4VAMyb81S6TUgJm2NgV6ERtkh9VIkAaByZkW530wl3lLN5KTtSrK9jVLxYsoP5hQKsw==", + "dev": true, + "requires": { + "ast-module-types": "^2.3.2", + "node-source-walk": "^4.0.0" + } + }, "get-func-name": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", "dev": true }, + "get-own-enumerable-property-symbols": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.0.tgz", + "integrity": "sha512-CIJYJC4GGF06TakLg8z4GQKvDsx9EMspVxOYih7LerEL/WosUnFIww45CGfxfeKHqlg3twgUrYRT1O3WQqjGCg==", + "dev": true + }, "get-stdin": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", @@ -1935,6 +2321,23 @@ "pinkie-promise": "^2.0.0" } }, + "gonzales-pe": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/gonzales-pe/-/gonzales-pe-4.2.3.tgz", + "integrity": "sha512-Kjhohco0esHQnOiqqdJeNz/5fyPkOMD/d6XVjwTAoPGUFh0mCollPUTUTa2OZy4dYNAqlPIQdTiNzJTWdd9Htw==", + "dev": true, + "requires": { + "minimist": "1.1.x" + }, + "dependencies": { + "minimist": { + "version": "1.1.3", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.1.3.tgz", + "integrity": "sha1-O+39kaktOQFvz6ocaB6Pqhoe/ag=", + "dev": true + } + } + }, "graceful-fs": { "version": "4.1.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", @@ -1946,6 +2349,15 @@ "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", "dev": true }, + "graphviz": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/graphviz/-/graphviz-0.0.8.tgz", + "integrity": "sha1-5ZnkBzPvgOFlO/6JpfAx7PKqSqo=", + "dev": true, + "requires": { + "temp": "~0.4.0" + } + }, "growl": { "version": "1.10.3", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", @@ -2072,6 +2484,12 @@ "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", "dev": true }, + "indexes-of": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz", + "integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc=", + "dev": true + }, "indexof": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", @@ -2092,6 +2510,12 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, + "ini": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "dev": true + }, "inquirer": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-5.0.0.tgz", @@ -2250,6 +2674,12 @@ "xtend": "^4.0.0" } }, + "is-obj": { + "version": "1.0.1", + "resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", + "dev": true + }, "is-path-cwd": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", @@ -2294,6 +2724,18 @@ "has": "^1.0.1" } }, + "is-regexp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-1.0.0.tgz", + "integrity": "sha1-/S2INUXEa6xaYz57mgnof6LLUGk=", + "dev": true + }, + "is-relative-path": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-relative-path/-/is-relative-path-1.0.2.tgz", + "integrity": "sha1-CRtGoNZ8HtD+hfH4z93gBrslHUY=", + "dev": true + }, "is-resolvable": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz", @@ -2319,6 +2761,12 @@ "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, + "is-url": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/is-url/-/is-url-1.2.4.tgz", + "integrity": "sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww==", + "dev": true + }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -2432,6 +2880,15 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + }, "jsonpointer": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", @@ -2555,6 +3012,12 @@ "resolved": "https://registry.npmjs.org/lodash.padstart/-/lodash.padstart-4.6.1.tgz", "integrity": "sha1-0uPuv/DZ05rVD1y9G1KnvOa7YRs=" }, + "lodash.unescape": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.unescape/-/lodash.unescape-4.0.1.tgz", + "integrity": "sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw=", + "dev": true + }, "lodash.uniq": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", @@ -2566,6 +3029,15 @@ "integrity": "sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==", "dev": true }, + "log-symbols": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz", + "integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==", + "dev": true, + "requires": { + "chalk": "^2.0.1" + } + }, "logform": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/logform/-/logform-1.9.1.tgz", @@ -2586,31 +3058,125 @@ "ms": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" + } + } + }, + "lolex": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.3.1.tgz", + "integrity": "sha512-mQuW55GhduF3ppo+ZRUTz1PRjEh1hS5BbqU7d8D0ez2OKxHDod7StPPeAVKisZR5aLkHZjdGWSL42LSONUJsZw==", + "dev": true + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "lower-case": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", + "integrity": "sha1-miyr0bno4K6ZOkv31YdcOcQujqw=", + "dev": true + }, + "madge": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/madge/-/madge-3.3.0.tgz", + "integrity": "sha512-AWRUIyir+ufyBgueZL+AfvsHPcATNQcwgndwC2bcdIEb57xK54YXmx3ECKCg9PK1zxp9Uc0LMSE1roO+foX7NQ==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "commander": "^2.15.1", + "commondir": "^1.0.1", + "debug": "^4.0.1", + "dependency-tree": "^6.1.0", + "graphviz": "^0.0.8", + "ora": "^3.0.0", + "pify": "^4.0.0", + "pluralize": "^7.0.0", + "pretty-ms": "^4.0.0", + "rc": "^1.2.7", + "walkdir": "^0.0.12" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "commander": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", + "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==", + "dev": true + }, + "debug": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz", + "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } } } }, - "lolex": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.3.1.tgz", - "integrity": "sha512-mQuW55GhduF3ppo+ZRUTz1PRjEh1hS5BbqU7d8D0ez2OKxHDod7StPPeAVKisZR5aLkHZjdGWSL42LSONUJsZw==", - "dev": true - }, - "loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "memory-fs": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", + "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", "dev": true, "requires": { - "js-tokens": "^3.0.0 || ^4.0.0" + "errno": "^0.1.3", + "readable-stream": "^2.0.1" } }, - "lower-case": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", - "integrity": "sha1-miyr0bno4K6ZOkv31YdcOcQujqw=", - "dev": true - }, "micromist": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/micromist/-/micromist-1.1.0.tgz", @@ -2710,6 +3276,47 @@ "integrity": "sha1-xlfZZC2QeGQ1xkyl6Zu9TQm9fdM=", "dev": true }, + "module-definition": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/module-definition/-/module-definition-3.1.0.tgz", + "integrity": "sha512-XtgUeQUi/4UshwxWlCxCjt4SoJC+LJbjHvhGopOskzZOH3GSy2X6KC96APK3rgA9p9hekHcVP87qdwQpSvhNlQ==", + "dev": true, + "requires": { + "ast-module-types": "^2.4.0", + "node-source-walk": "^4.0.0" + } + }, + "module-lookup-amd": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/module-lookup-amd/-/module-lookup-amd-5.0.1.tgz", + "integrity": "sha512-rmljyiMrPqEfeOD1myMULVgnv1pRUqq1Dv/Xn0f9g36wCDWvqj07arG0fCEbKqU1sYFXptnaC1o+0oR7JpwOtg==", + "dev": true, + "requires": { + "commander": "^2.8.1", + "debug": "^3.1.0", + "file-exists": "^2.0.0", + "find": "^0.2.8", + "requirejs": "^2.3.5", + "requirejs-config-file": "^3.0.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -2816,6 +3423,15 @@ "file": "0.2.2" } }, + "node-source-walk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/node-source-walk/-/node-source-walk-4.1.0.tgz", + "integrity": "sha512-aR9GdKa9LT7sk00Z3V0c569Vx71n4KSS13be7EapoZGRFNXby/JNA0/3J+U50GaDOKKISw2HX3A3prunX4EEZw==", + "dev": true, + "requires": { + "@babel/parser": "^7.0.0" + } + }, "normalize-package-data": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", @@ -4469,6 +5085,72 @@ "wordwrap": "~1.0.0" } }, + "ora": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ora/-/ora-3.0.0.tgz", + "integrity": "sha512-LBS97LFe2RV6GJmXBi6OKcETKyklHNMV0xw7BtsVn2MlsgsydyZetSCbCANr+PFLmDyv4KV88nn0eCKza665Mg==", + "dev": true, + "requires": { + "chalk": "^2.3.1", + "cli-cursor": "^2.1.0", + "cli-spinners": "^1.1.0", + "log-symbols": "^2.2.0", + "strip-ansi": "^4.0.0", + "wcwidth": "^1.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "os-homedir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", @@ -4526,6 +5208,12 @@ "error-ex": "^1.2.0" } }, + "parse-ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-2.0.0.tgz", + "integrity": "sha512-AddiXFSLLCqj+tCRJ9MrUtHZB4DWojO3tk0NVZ+g5MaMQHF2+p2ktqxuoXyPFLljz/aUK0Nfhd/uGWnhXVXEyA==", + "dev": true + }, "parseqs": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz", @@ -4646,6 +5334,115 @@ "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", "dev": true }, + "postcss": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.5.tgz", + "integrity": "sha512-HBNpviAUFCKvEh7NZhw1e8MBPivRszIiUnhrJ+sBFVSYSqubrzwX3KG51mYgcRHX8j/cAgZJedONZcm5jTBdgQ==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "source-map": "^0.6.1", + "supports-color": "^5.5.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "postcss-values-parser": { + "version": "1.5.0", + "resolved": "http://registry.npmjs.org/postcss-values-parser/-/postcss-values-parser-1.5.0.tgz", + "integrity": "sha512-3M3p+2gMp0AH3da530TlX8kiO1nxdTnc3C6vr8dMxRLIlh8UYkz0/wcwptSXjhtx2Fr0TySI7a+BHDQ8NL7LaQ==", + "dev": true, + "requires": { + "flatten": "^1.0.2", + "indexes-of": "^1.0.1", + "uniq": "^1.0.1" + } + }, + "precinct": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/precinct/-/precinct-5.1.0.tgz", + "integrity": "sha512-nQFQZNtvywHdU2nxf9sYgAbZz2TFo6UHQY0rbwLmQApBQHJ3kthajrvFmSMKqEi46oDCMcuQIiS8nOJiNAoDUw==", + "dev": true, + "requires": { + "commander": "^2.17.0", + "debug": "^3.1.0", + "detective-amd": "^3.0.0", + "detective-cjs": "^3.1.0", + "detective-es6": "^2.0.0", + "detective-less": "^1.0.1", + "detective-postcss": "^3.0.0", + "detective-sass": "^3.0.0", + "detective-scss": "^2.0.0", + "detective-stylus": "^1.0.0", + "detective-typescript": "^4.0.0", + "module-definition": "^3.1.0", + "node-source-walk": "^4.0.0" + }, + "dependencies": { + "commander": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", + "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==", + "dev": true + }, + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, "preferences": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/preferences/-/preferences-1.0.2.tgz", @@ -4664,6 +5461,15 @@ "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", "dev": true }, + "pretty-ms": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-4.0.0.tgz", + "integrity": "sha512-qG66ahoLCwpLXD09ZPHSCbUWYTqdosB7SMP4OffgTgL2PBKXMuUsrk5Bwg8q4qPkjTXsKBMr+YK3Ltd/6F9s/Q==", + "dev": true, + "requires": { + "parse-ms": "^2.0.0" + } + }, "prettyjson": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prettyjson/-/prettyjson-1.2.1.tgz", @@ -4690,6 +5496,12 @@ "integrity": "sha1-AMLa7t2iDofjeCs0Stuhzd1q1wk=", "dev": true }, + "prr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", + "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", + "dev": true + }, "psl": { "version": "1.1.29", "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", @@ -4706,6 +5518,18 @@ "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", "dev": true }, + "rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + } + }, "read-pkg": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", @@ -4904,6 +5728,23 @@ "resolve-from": "^1.0.0" } }, + "requirejs": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.6.tgz", + "integrity": "sha512-ipEzlWQe6RK3jkzikgCupiTbTvm4S0/CAU5GlgptkN5SO6F3u0UD0K18wy6ErDqiCyP4J4YYe1HuAShvsxePLg==", + "dev": true + }, + "requirejs-config-file": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/requirejs-config-file/-/requirejs-config-file-3.0.0.tgz", + "integrity": "sha512-pssKfw0KhafnpOHA1+qWlDXcCEgf0p+qfTI8xOhqOhhdtz7m7VqhEorauKZOqv1GGA8ML3eKFU3sxGq5p4ZaEw==", + "dev": true, + "requires": { + "esprima": "^4.0.0", + "fs-extra": "^5.0.0", + "stringify-object": "^3.2.1" + } + }, "resolve": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz", @@ -4913,6 +5754,12 @@ "path-parse": "^1.0.5" } }, + "resolve-dependency-path": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/resolve-dependency-path/-/resolve-dependency-path-1.0.2.tgz", + "integrity": "sha1-ar6Tpt4+T53Oe16CYeH0eqGvTcI=", + "dev": true + }, "resolve-from": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", @@ -4974,6 +5821,23 @@ "integrity": "sha512-1HwIYD/8UlOtFS3QO3w7ey+SdSDFE4HRNLZoZRYVQefrOY3l17epswImeB1ijgJFQJodIaHcwkp3r/myBjFVbg==", "dev": true }, + "sass-lookup": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/sass-lookup/-/sass-lookup-2.0.0.tgz", + "integrity": "sha512-DZEg7g605XNZX3rxQMkndPmlSzaGR3ld33Rvx3XPTxP8hXBPErmCTrL2CPItzjCJqvjgt9kXhxQrzkbdJZToaA==", + "dev": true, + "requires": { + "commander": "^2.16.0" + }, + "dependencies": { + "commander": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", + "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==", + "dev": true + } + } + }, "semver": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", @@ -5275,6 +6139,17 @@ "safe-buffer": "~5.1.0" } }, + "stringify-object": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-3.3.0.tgz", + "integrity": "sha512-rHqiFh1elqCQ9WPLIC8I0Q/g/wj5J1eMkyoiD6eoQApWHP0FtlK7rqnhmabL5VUY9JQCcqwwvlOaSuutekgyrw==", + "dev": true, + "requires": { + "get-own-enumerable-property-symbols": "^3.0.0", + "is-obj": "^1.0.1", + "is-regexp": "^1.0.0" + } + }, "stringstream": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", @@ -5310,6 +6185,33 @@ "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "dev": true }, + "stylus-lookup": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/stylus-lookup/-/stylus-lookup-2.0.0.tgz", + "integrity": "sha512-ZPwVUITlzCIgq1NBNl1xVX1grfFnJUBq9zzG9YOj/V3GrOCnpWuxGh6zUL8JTaVs0nMS9Eyok1qgOW9mUFx9kg==", + "dev": true, + "requires": { + "commander": "^2.8.1", + "debug": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + } + } + }, "supports-color": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", @@ -5517,6 +6419,18 @@ } } }, + "tapable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.0.tgz", + "integrity": "sha512-IlqtmLVaZA2qab8epUXbVWRn3aB1imbDMJtjB3nu4X0NqPkcY/JH9ZtCBWKHWPxs8Svi9tyo8w2dBoi07qZbBA==", + "dev": true + }, + "temp": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/temp/-/temp-0.4.0.tgz", + "integrity": "sha1-ZxrWPVe+D+nXKUZks/xABjZnimA=", + "dev": true + }, "text-encoding": { "version": "0.6.4", "resolved": "https://registry.npmjs.org/text-encoding/-/text-encoding-0.6.4.tgz", @@ -5594,6 +6508,12 @@ "punycode": "^1.4.1" } }, + "traverse-chain": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/traverse-chain/-/traverse-chain-0.1.0.tgz", + "integrity": "sha1-YdvC1Ttp/2CRoSoWj9fUMxB+QPE=", + "dev": true + }, "trim-right": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", @@ -5644,11 +6564,39 @@ "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, + "typescript": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.1.4.tgz", + "integrity": "sha512-JZHJtA6ZL15+Q3Dqkbh8iCUmvxD3iJ7ujXS+fVkKnwIVAdHc5BJTDNM0aTrnr2luKulFjU7W+SRhDZvi66Ru7Q==", + "dev": true + }, + "typescript-eslint-parser": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/typescript-eslint-parser/-/typescript-eslint-parser-18.0.0.tgz", + "integrity": "sha512-Pn/A/Cw9ysiXSX5U1xjBmPQlxtWGV2o7jDNiH/u7KgBO2yC/y37wNFl2ogSrGZBQFuglLzGq0Xl0Bt31Jv44oA==", + "dev": true, + "requires": { + "lodash.unescape": "4.0.1", + "semver": "5.5.0" + } + }, "ultron": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" }, + "uniq": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz", + "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=", + "dev": true + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true + }, "upper-case": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz", @@ -5720,6 +6668,21 @@ "extsprintf": "^1.2.0" } }, + "walkdir": { + "version": "0.0.12", + "resolved": "https://registry.npmjs.org/walkdir/-/walkdir-0.0.12.tgz", + "integrity": "sha512-HFhaD4mMWPzFSqhpyDG48KDdrjfn409YQuVW7ckZYhW4sE87mYtWifdB/+73RA7+p4s4K18n5Jfx1kHthE1gBw==", + "dev": true + }, + "wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", + "dev": true, + "requires": { + "defaults": "^1.0.3" + } + }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", diff --git a/package.json b/package.json index b8fc10e..909c55f 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "post-integration": "nyc report --reporter=lcov > coverage.lcov && codecov -F integration && rm -rf ~/.autolabjs", "feature": "nyc --reporter=lcov --reporter=text-lcov -s --all cucumber-js 'test/feature/features' -r 'test/feature/steps'", "post-feature": "nyc report --reporter=lcov > coverage.lcov && codecov -F feature", - "quality": "eslint . & jsinspect . & buddy ." + "quality": "eslint ./lib/ ./test/ index.js && jsinspect ./lib ./test/ index.js && buddy ./lib ./test/ index.js;", + "module-depencency": "madge --image module-depencency.svg ./lib/ index.js" }, "bin": { "autolabjs": "./index.js" @@ -52,6 +53,7 @@ "eslint-config-airbnb-base": "^13.1.0", "eslint-plugin-import": "^2.14.0", "jsinspect": "^0.12.7", + "madge": "^3.3.0", "mocha": "^4.1.0", "mock-stdin": "^0.3.1", "nock": "^9.2.3", diff --git a/test/.eslintrc b/test/.eslintrc.json similarity index 100% rename from test/.eslintrc rename to test/.eslintrc.json diff --git a/test/integration/prefs.js b/test/integration/prefs.js index 5aaafad..e32d972 100644 --- a/test/integration/prefs.js +++ b/test/integration/prefs.js @@ -76,34 +76,38 @@ describe('Integration test for prefs command', () => { it('should be able to change the logger file size', async () => { const logSpy = sandbox.stub(console, 'log'); + const testSize = 786770; + const testOutput = { + maxSize: testSize, + logDirectory: '.autolabjs', + logLocation: 'cli.log', + blacklist: ['log', 'password', 'privateToken'], + }; process.argv = ['/usr/local/nodejs/bin/node', '/usr/local/nodejs/bin/autolabjs', 'prefs', 'logger', - '--maxsize', '786770']; + '--maxsize', testSize.toString()]; await controller.start(); - preferenceManager.getPreference({ name: 'cliPrefs' }).logger.should.deep.equal({ - maxSize: 786770, - logDirectory: '.autolabjs', - logLocation: 'cli.log', - blacklist: ['log', 'password', 'privateToken'], - }); + preferenceManager.getPreference({ name: 'cliPrefs' }).logger.should.deep.equal(testOutput); logSpy.should.have.been.calledWith(chalk.green('Your logger preferences have been updated.')); sandbox.restore(); }); it('should be able to add to logger blacklist', async () => { const logSpy = sandbox.stub(console, 'log'); + const testSize = 786770; + const testOutput = { + maxSize: testSize, + logDirectory: '.autolabjs', + logLocation: 'cli.log', + blacklist: ['log', 'password', 'privateToken', 'usrname'], + }; process.argv = ['/usr/local/nodejs/bin/node', '/usr/local/nodejs/bin/autolabjs', 'prefs', 'logger', '--blacklist', 'usrname']; await controller.start(); - preferenceManager.getPreference({ name: 'cliPrefs' }).logger.should.deep.equal({ - maxSize: 786770, - logDirectory: '.autolabjs', - logLocation: 'cli.log', - blacklist: ['log', 'password', 'privateToken', 'usrname'], - }); + preferenceManager.getPreference({ name: 'cliPrefs' }).logger.should.deep.equal(testOutput); logSpy.should.have.been.calledWith(chalk.green('Your logger preferences have been updated.')); sandbox.restore(); }); @@ -212,7 +216,8 @@ describe('Integration test for prefs command', () => { process.argv = ['/usr/local/nodejs/bin/node', '/usr/local/nodejs/bin/autolabjs', 'prefs', 'changeserver', '--type', 'ms']; const mockInquirer = sandbox.mock(inquirer); - mockInquirer.expects('prompt').resolves({ host: 'abc.com', port: 5687 }); + const testPort = 5687; + mockInquirer.expects('prompt').resolves({ host: 'abc.com', port: testPort }); await controller.start(); logSpy.should.have.been.calledWith(chalk.green('Your main server has been changed to abc.com at port 5687')); @@ -235,12 +240,13 @@ describe('Integration test for prefs command', () => { }); it('should be able to add to log file size using prompt', async () => { const logSpy = sandbox.stub(console, 'log'); + const testSize = 797291; process.argv = ['/usr/local/nodejs/bin/node', '/usr/local/nodejs/bin/autolabjs', 'prefs', 'logger']; const mockInquirer = sandbox.stub(inquirer, 'prompt'); mockInquirer.onCall(0).returns({ type: 'maxsize' }); - mockInquirer.onCall(1).returns({ maxSize: '797291' }); + mockInquirer.onCall(1).returns({ maxSize: testSize.toString() }); await controller.start(); logSpy.should.have.been.calledWith(chalk.green('Your logger preferences have been updated.')); diff --git a/test/unit/lib/cli/input/prefs.js b/test/unit/lib/cli/input/prefs.js index d39d653..6f5a98e 100644 --- a/test/unit/lib/cli/input/prefs.js +++ b/test/unit/lib/cli/input/prefs.js @@ -179,17 +179,18 @@ describe('for prefs input', () => { }); it('should send the right event when logger prefs are changed', async () => { + const testSize = 65759; const ret = await prefsInput.getInput({ preference: 'logger', }, { blacklist: 'adder', - maxsize: 65759, + maxsize: testSize, }); ret.should.deep.equal({ name: 'logger_pref_changed', details: { keyword: 'adder', - maxSize: 65759, + maxSize: testSize, }, }); }); @@ -212,8 +213,9 @@ describe('for prefs input', () => { it('should prompt when logger prefs are not given, maxsize', async () => { const mockInquirer = sandbox.stub(inquirer, 'prompt'); + const testSize = 723000; mockInquirer.onCall(0).returns({ type: 'maxsize' }); - mockInquirer.onCall(1).returns({ maxsize: 723000 }); + mockInquirer.onCall(1).returns({ maxsize: testSize }); const ret = await prefsInput.getInput({ preference: 'logger', @@ -221,7 +223,7 @@ describe('for prefs input', () => { ret.should.deep.equal({ name: 'logger_pref_changed', details: { - maxSize: 723000, + maxSize: testSize, }, }); }); diff --git a/test/unit/lib/cli/output/init.js b/test/unit/lib/cli/output/init.js index 354b0cc..f9b3cec 100644 --- a/test/unit/lib/cli/output/init.js +++ b/test/unit/lib/cli/output/init.js @@ -43,11 +43,11 @@ describe('For init output', () => { it('should display sucess message for status code as 200', () => { const logStub = sandbox.stub(console, 'log'); - + const httpOK = 200; initOutput.sendOutput({ name: 'authentication_ended', details: { - code: 200, + code: httpOK, name: 'test_user', }, }); @@ -59,11 +59,11 @@ describe('For init output', () => { it('should display error message for invalid credentials', () => { const logStub = sandbox.stub(console, 'log'); - + const httpUnauth = 401; initOutput.sendOutput({ name: 'authentication_ended', details: { - code: 401, + code: httpUnauth, }, }); @@ -74,11 +74,11 @@ describe('For init output', () => { it('should display appropriate error message for no connection', () => { const logStub = sandbox.stub(console, 'log'); - + const httpFailure = 4; initOutput.sendOutput({ name: 'authentication_ended', details: { - code: 4, + code: httpFailure, }, }); diff --git a/test/unit/lib/controller/init.js b/test/unit/lib/controller/init.js index 89168b8..e3e21d8 100644 --- a/test/unit/lib/controller/init.js +++ b/test/unit/lib/controller/init.js @@ -29,6 +29,8 @@ describe('For init controller', () => { const mockInitOutput = sandbox.mock(initOutput); const mockInitModel = sandbox.mock(initModel); + const httpOK = 200; + mockInitOutput.expects('sendOutput').withExactArgs({ name: 'welcome', }); @@ -41,13 +43,13 @@ describe('For init controller', () => { password: '123', }).resolves({ name: 'test_user1', - code: 200, + code: httpOK, }); mockInitOutput.expects('sendOutput').withExactArgs({ name: 'authentication_ended', details: { name: 'test_user1', - code: 200, + code: httpOK, }, }); diff --git a/test/unit/lib/controller/prefs.js b/test/unit/lib/controller/prefs.js index 64fe7bb..abb40a8 100644 --- a/test/unit/lib/controller/prefs.js +++ b/test/unit/lib/controller/prefs.js @@ -29,12 +29,14 @@ describe('For prefs controller', () => { const mockprefsOutput = sandbox.mock(prefsOutput); const mockprefsModel = sandbox.mock(prefsModel); + const testMsPort = 8999; + const changedPrefs = { name: 'server_changed', details: { type: 'ms', host: 'abc', - port: 8999, + port: testMsPort, }, }; mockprefsInput.expects('getInput').once().withExactArgs({ preference: 'changeserver' }, { diff --git a/test/unit/lib/model/prefs.js b/test/unit/lib/model/prefs.js index 745dfda..8b9a031 100644 --- a/test/unit/lib/model/prefs.js +++ b/test/unit/lib/model/prefs.js @@ -58,12 +58,13 @@ describe('for prefsModel', () => { it('should change the main server', async () => { const mockPreferenceManager = sinon.mock(preferenceManager); + const testMsPort = 3333; mockPreferenceManager.expects('setPreference').withExactArgs({ name: 'cliPrefs', values: { main_server: { host: 'abc', - port: 3333, + port: testMsPort, }, }, }); @@ -73,7 +74,7 @@ describe('for prefsModel', () => { details: { type: 'ms', host: 'abc', - port: 3333, + port: testMsPort, }, }); @@ -82,6 +83,7 @@ describe('for prefsModel', () => { it('should change the logger file size', async () => { const mockPreferenceManager = sinon.mock(preferenceManager); + const testSize = 72000; mockPreferenceManager.expects('setPreference').withExactArgs({ name: 'loggerPrefs', values: { @@ -89,7 +91,7 @@ describe('for prefsModel', () => { blacklist: { keyword: undefined, }, - maxSize: 72000, + maxSize: testSize, }, }, }); @@ -97,7 +99,7 @@ describe('for prefsModel', () => { prefsModel.storePrefs({ name: 'logger_pref_changed', details: { - maxSize: 72000, + maxSize: testSize, }, }); @@ -130,19 +132,21 @@ describe('for prefsModel', () => { it('should send the stored preferences on show', async () => { const mockPreferenceManager = sinon.mock(preferenceManager); + const testSize = 52457; + const testMsPort = 3333; mockPreferenceManager.expects('getPreference').withExactArgs({ name: 'cliPrefs' }).returns({ submission: { language: 'java', }, main_server: { host: 'abc', - port: 3333, + port: testMsPort, }, gitlab: { host: 'bcd.com', }, logger: { - maxSize: 52457, + maxSize: testSize, logDirectory: '.xys', logLocation: 'all.log', blacklist: ['log'],