diff --git a/.travis.yml b/.travis.yml index bed544b0a..b360fe833 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ node_js: - 8 - 6 matrix: -## An ENOMEM error occurs with 11.6.0 under Travis-CI for Windows. +## An ENOMEM error occurs with 10+ under Travis-CI for Windows. ## Disable until we can determine the cause. # include: # - os: windows @@ -17,6 +17,8 @@ matrix: exclude: - os: windows node_js: "node" + - os: windows + node_js: 10 git: depth: 1 diff --git a/package-lock.json b/package-lock.json index dacc990f1..41875ddaf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,11 +13,11 @@ } }, "@babel/generator": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.4.0.tgz", - "integrity": "sha512-/v5I+a1jhGSKLgZDcmAUZ4K/VePi43eRkUs3yePW1HB1iANOD5tqJXwGSG4BZhSksP8J9ejSlwGeTiiOFZOrXQ==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.4.4.tgz", + "integrity": "sha512-53UOLK6TVNqKxf7RUh8NE851EHRxOOeVXKbK2bivdb+iziMyk03Sr4eaE9OELCbyZAAafAKPDwF2TPUES5QbxQ==", "requires": { - "@babel/types": "^7.4.0", + "@babel/types": "^7.4.4", "jsesc": "^2.5.1", "lodash": "^4.17.11", "source-map": "^0.5.0", @@ -43,11 +43,11 @@ } }, "@babel/helper-split-export-declaration": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.0.tgz", - "integrity": "sha512-7Cuc6JZiYShaZnybDmfwhY4UYHzI6rlqhWjaIqbsJGsIqPimEYy5uh3akSRLMg65LSdSEnJ8a8/bWQN6u2oMGw==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.4.4.tgz", + "integrity": "sha512-Ro/XkzLf3JFITkW6b+hNxzZ1n5OQ80NvIUdmHspih1XAhtN3vPTuUFT4eQnela+2MaZ5ulH+iyP513KJrxbN7Q==", "requires": { - "@babel/types": "^7.4.0" + "@babel/types": "^7.4.4" } }, "@babel/highlight": { @@ -61,40 +61,40 @@ } }, "@babel/parser": { - "version": "7.4.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.4.3.tgz", - "integrity": "sha512-gxpEUhTS1sGA63EGQGuA+WESPR/6tz6ng7tSHFCmaTJK/cGK8y37cBTspX+U2xCAue2IQVvF6Z0oigmjwD8YGQ==" + "version": "7.4.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.4.5.tgz", + "integrity": "sha512-9mUqkL1FF5T7f0WDFfAoDdiMVPWsdD1gZYzSnaXsxUCUqzuch/8of9G3VUSNiZmMBoRxT3neyVsqeiL/ZPcjew==" }, "@babel/template": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.4.0.tgz", - "integrity": "sha512-SOWwxxClTTh5NdbbYZ0BmaBVzxzTh2tO/TeLTbF6MO6EzVhHTnff8CdBXx3mEtazFBoysmEM6GU/wF+SuSx4Fw==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.4.4.tgz", + "integrity": "sha512-CiGzLN9KgAvgZsnivND7rkA+AeJ9JB0ciPOD4U59GKbQP2iQl+olF1l76kJOupqidozfZ32ghwBEJDhnk9MEcw==", "requires": { "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.4.0", - "@babel/types": "^7.4.0" + "@babel/parser": "^7.4.4", + "@babel/types": "^7.4.4" } }, "@babel/traverse": { - "version": "7.4.3", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.4.3.tgz", - "integrity": "sha512-HmA01qrtaCwwJWpSKpA948cBvU5BrmviAief/b3AVw936DtcdsTexlbyzNuDnthwhOQ37xshn7hvQaEQk7ISYQ==", + "version": "7.4.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.4.5.tgz", + "integrity": "sha512-Vc+qjynwkjRmIFGxy0KYoPj4FdVDxLej89kMHFsWScq999uX+pwcX4v9mWRjW0KcAYTPAuVQl2LKP1wEVLsp+A==", "requires": { "@babel/code-frame": "^7.0.0", - "@babel/generator": "^7.4.0", + "@babel/generator": "^7.4.4", "@babel/helper-function-name": "^7.1.0", - "@babel/helper-split-export-declaration": "^7.4.0", - "@babel/parser": "^7.4.3", - "@babel/types": "^7.4.0", + "@babel/helper-split-export-declaration": "^7.4.4", + "@babel/parser": "^7.4.5", + "@babel/types": "^7.4.4", "debug": "^4.1.0", "globals": "^11.1.0", "lodash": "^4.17.11" } }, "@babel/types": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.4.0.tgz", - "integrity": "sha512-aPvkXyU2SPOnztlgo8n9cEiXW755mgyvueUPcpStqdzoSPm0fjO0vQBjLkt3JKJW7ufikfcnMTTPsN1xaTsBPA==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.4.4.tgz", + "integrity": "sha512-dOllgYdnEFOebhkKCjzSVFqw/PmmB8pH6RGOWkY4GsboQNd47b1fBThBSwlHAq9alF9vc1M3+6oqR47R50L0tQ==", "requires": { "esutils": "^2.0.2", "lodash": "^4.17.11", @@ -148,9 +148,9 @@ "dev": true }, "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" }, "ansi-styles": { "version": "3.2.1", @@ -486,30 +486,20 @@ "dev": true }, "cliui": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", - "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", "requires": { - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0", - "wrap-ansi": "^2.0.0" - }, - "dependencies": { - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - } + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" } }, "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true }, "color-convert": { "version": "1.9.3", @@ -531,9 +521,9 @@ "dev": true }, "combined-stream": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz", - "integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "dev": true, "requires": { "delayed-stream": "~1.0.0" @@ -584,15 +574,15 @@ "dev": true }, "conventional-changelog": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/conventional-changelog/-/conventional-changelog-3.1.3.tgz", - "integrity": "sha512-JBfdDSdSGasTNaBRZbOeFn8CJTIpP/sB/kiawmWAiLapLZ+wCDVDZR6Q+Hh9rjh3dxNAFR03bWTeqjKajXvPYA==", + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/conventional-changelog/-/conventional-changelog-3.1.8.tgz", + "integrity": "sha512-fb3/DOLLrQdNqN0yYn/lT6HcNsAa9A+VTDBqlZBMQcEPPIeJIMI+DBs3yu+eiYOLi22w9oShq3nn/zN6qm1Hmw==", "dev": true, "requires": { "conventional-changelog-angular": "^5.0.3", "conventional-changelog-atom": "^2.0.1", "conventional-changelog-codemirror": "^2.0.1", - "conventional-changelog-conventionalcommits": "^1.1.1", + "conventional-changelog-conventionalcommits": "^3.0.2", "conventional-changelog-core": "^3.2.2", "conventional-changelog-ember": "^2.0.2", "conventional-changelog-eslint": "^3.0.2", @@ -631,9 +621,9 @@ } }, "conventional-changelog-conventionalcommits": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-1.1.1.tgz", - "integrity": "sha512-21BcbiSfvYIon7sF80Rwn6vnfhaiuZUyHHFYr9Zz8H2B+O/3grud5TbEYpU1/SFXD5aD48IdSme/KkJl9wCsCw==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-3.0.2.tgz", + "integrity": "sha512-w1+fQSDnm/7+sPKIYC5nfRVYDszt+6HdWizrigSqWFVIiiBVzkHGeqDLMSHc+Qq9qssHVAxAak5206epZyK87A==", "dev": true, "requires": { "compare-func": "^1.3.1", @@ -769,9 +759,9 @@ "dev": true }, "conventional-changelog-writer": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-4.0.5.tgz", - "integrity": "sha512-g/Myp4MaJ1A+f7Ai+SnVhkcWtaHk6flw0SYN7A+vQ+MTu0+gSovQWs4Pg4NtcNUcIztYQ9YHsoxHP+GGQplI7Q==", + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-4.0.6.tgz", + "integrity": "sha512-ou/sbrplJMM6KQpR5rKFYNVQYesFjN7WpNGdudQSWNi6X+RgyFUcSv871YBYkrUYV9EX8ijMohYVzn9RUb+4ag==", "dev": true, "requires": { "compare-func": "^1.3.1", @@ -781,9 +771,17 @@ "json-stringify-safe": "^5.0.1", "lodash": "^4.2.1", "meow": "^4.0.0", - "semver": "^5.5.0", + "semver": "^6.0.0", "split": "^1.0.0", "through2": "^3.0.0" + }, + "dependencies": { + "semver": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.1.1.tgz", + "integrity": "sha512-rWYq2e5iYW+fFe/oPPtYJxYgjBm8sC4rmoGdUOgBB7VnwKt6HrL793l2voH1UlsyYZpJ4g0wfjnTEO1s1NP2eQ==", + "dev": true + } } }, "conventional-commits-filter": { @@ -797,13 +795,13 @@ } }, "conventional-commits-parser": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-3.0.2.tgz", - "integrity": "sha512-y5eqgaKR0F6xsBNVSQ/5cI5qIF3MojddSUi1vKIggRkqUTbkqFKH9P5YX/AT1BVZp9DtSzBTIkvjyVLotLsVog==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-3.0.3.tgz", + "integrity": "sha512-KaA/2EeUkO4bKjinNfGUyqPTX/6w9JGshuQRik4r/wJz7rUw3+D3fDG6sZSEqJvKILzKXFQuFkpPLclcsAuZcg==", "dev": true, "requires": { "JSONStream": "^1.0.4", - "is-text-path": "^1.0.0", + "is-text-path": "^2.0.0", "lodash": "^4.2.1", "meow": "^4.0.0", "split2": "^2.0.0", @@ -842,9 +840,9 @@ "dev": true }, "coveralls": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.0.3.tgz", - "integrity": "sha512-viNfeGlda2zJr8Gj1zqXpDMRjw9uM54p7wzZdvLRyOgnAfCe974Dq4veZkjJdxQXbmdppu6flEajFYseHYaUhg==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-3.0.4.tgz", + "integrity": "sha512-eyqUWA/7RT0JagiL0tThVhjbIjoiEUyWCjtUJoOPcWoeofP5WK/jb2OJYoBFrR6DvplR+AxOyuBqk4JHkk5ykA==", "dev": true, "requires": { "growl": "~> 1.10.0", @@ -1203,6 +1201,12 @@ "text-table": "^0.2.0" }, "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 + }, "cross-spawn": { "version": "6.0.5", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", @@ -1224,6 +1228,15 @@ "requires": { "ms": "^2.1.1" } + }, + "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" + } } } }, @@ -1562,9 +1575,9 @@ "dev": true }, "esm": { - "version": "3.2.22", - "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.22.tgz", - "integrity": "sha512-z8YG7U44L82j1XrdEJcqZOLUnjxco8pO453gKOlaMD1/md1n/5QrscAmYG+oKUspsmDLuBFZrpbxI6aQ67yRxA==", + "version": "3.2.25", + "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", + "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==", "dev": true }, "espree": { @@ -2150,9 +2163,9 @@ } }, "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", + "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -2163,9 +2176,9 @@ } }, "globals": { - "version": "11.11.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.11.0.tgz", - "integrity": "sha512-WHq43gS+6ufNOEqlrDBxVEbb8ntfXrfAUU2ZOpCxrBdGKW3gyv8mCxAfIBD0DroPKGrJ2eSsXsLtY9MPntsyTw==" + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==" }, "graceful-fs": { "version": "4.1.15", @@ -2309,9 +2322,9 @@ } }, "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "ini": { "version": "1.3.5", @@ -2340,6 +2353,12 @@ "through": "^2.3.6" }, "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 + }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -2349,6 +2368,15 @@ "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^4.0.0" } + }, + "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" + } } } }, @@ -2436,12 +2464,12 @@ } }, "is-text-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-1.0.1.tgz", - "integrity": "sha1-Thqg+1G/vLPpJogAE5cgLBd1tm4=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-2.0.0.tgz", + "integrity": "sha512-+oDTluR6WEjdXEJMnC2z6A4FRwFoYuvShVVEGsS7ewc0UTi2QtAKMDJuL4BDEVt+5T7MjFo12RP8ghOM75oKJw==", "dev": true, "requires": { - "text-extensions": "^1.0.0" + "text-extensions": "^2.0.0" } }, "is-typedarray": { @@ -2507,9 +2535,9 @@ }, "dependencies": { "semver": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.0.0.tgz", - "integrity": "sha512-0UewU+9rFapKFnlbirLi3byoOuhrSsli/z/ihNnvM24vgF+8sNBiI1LZPBSH9wJKUwaUbw+s3hToDLCXkrghrQ==" + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.1.1.tgz", + "integrity": "sha512-rWYq2e5iYW+fFe/oPPtYJxYgjBm8sC4rmoGdUOgBB7VnwKt6HrL793l2voH1UlsyYZpJ4g0wfjnTEO1s1NP2eQ==" } } }, @@ -2553,9 +2581,9 @@ } }, "istanbul-reports": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.2.4.tgz", - "integrity": "sha512-QCHGyZEK0bfi9GR215QSm+NJwFKEShbtc7tfbUdLAEzn3kKhLDDZqvljn8rPZM9v8CEOhzL1nlYoO4r1ryl67w==", + "version": "2.2.6", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.2.6.tgz", + "integrity": "sha512-SKi4rnMyLBKe0Jy2uUdx28h8oG7ph2PPuQPvIAh31d+Ci+lSiEu4C+h3oBPuJ9+mPKhOyW0M8gY4U5NM1WLeXA==", "requires": { "handlebars": "^4.1.2" } @@ -2982,9 +3010,9 @@ "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==" + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "mute-stream": { "version": "0.0.7", @@ -2999,9 +3027,9 @@ "dev": true }, "neo-async": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.0.tgz", - "integrity": "sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA==" + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", + "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==" }, "nested-error-stacks": { "version": "2.1.0", @@ -3047,12 +3075,13 @@ "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=" + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true }, "nyc": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/nyc/-/nyc-14.0.0.tgz", - "integrity": "sha512-R1zC6UZak6pzn5BZQorkSH5GdOGafrwyeja+eimS5Tu+KJ/hCgBc8qA1QWSzxQmT2FDl2lbpqPw7tBDbSvhAHg==", + "version": "14.1.1", + "resolved": "https://registry.npmjs.org/nyc/-/nyc-14.1.1.tgz", + "integrity": "sha512-OI0vm6ZGUnoGZv/tLdZ2esSVzDwUC88SNs+6JoSOMVxA+gKMB8Tk7jBwgemLx4O40lhhvZCVw1C+OYLOBOPXWw==", "dev": true, "requires": { "archy": "^1.0.0", @@ -3063,19 +3092,20 @@ "find-up": "^3.0.0", "foreground-child": "^1.5.6", "glob": "^7.1.3", - "istanbul-lib-coverage": "^2.0.4", - "istanbul-lib-hook": "^2.0.6", - "istanbul-lib-instrument": "^3.2.0", - "istanbul-lib-report": "^2.0.7", - "istanbul-lib-source-maps": "^3.0.5", - "istanbul-reports": "^2.2.2", + "istanbul-lib-coverage": "^2.0.5", + "istanbul-lib-hook": "^2.0.7", + "istanbul-lib-instrument": "^3.3.0", + "istanbul-lib-report": "^2.0.8", + "istanbul-lib-source-maps": "^3.0.6", + "istanbul-reports": "^2.2.4", + "js-yaml": "^3.13.1", "make-dir": "^2.1.0", "merge-source-map": "^1.1.0", "resolve-from": "^4.0.0", "rimraf": "^2.6.3", "signal-exit": "^3.0.2", "spawn-wrap": "^1.4.2", - "test-exclude": "^5.2.2", + "test-exclude": "^5.2.3", "uuid": "^3.3.2", "yargs": "^13.2.2", "yargs-parser": "^13.0.0" @@ -3447,9 +3477,9 @@ "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" }, "psl": { - "version": "1.1.31", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.31.tgz", - "integrity": "sha512-/6pt4+C+T+wZUieKR620OpzN/LlnNKuWjy1iFLQ/UG35JqHlR/89MP1d96dUfkf6Dne3TuLQzOYEYshJ+Hx8mw==", + "version": "1.1.32", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.32.tgz", + "integrity": "sha512-MHACAkHpihU/REGGPLj4sEfc/XKW2bheigvHO1dUqjaKigMp1C8+WLQYRGgeKFMsw5PMfegZcaN8IDXK/cD0+g==", "dev": true }, "pump": { @@ -3511,9 +3541,9 @@ } }, "readable-stream": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.3.0.tgz", - "integrity": "sha512-EsI+s3k3XsW+fU8fQACLN59ky34AZ14LoeVZpYwmZvldCFo0r0gnelwF2TcMjLor/BTL5aDJVBMkss0dthToPw==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz", + "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==", "dev": true, "requires": { "inherits": "^2.0.3", @@ -3617,9 +3647,9 @@ "dev": true }, "resolve": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.1.tgz", - "integrity": "sha512-KuIe4mf++td/eFb6wkaPbMDnP6kObCaEtIDuHOUED6MNUo4K670KZUHuuvYPZDxNF0WVLw49n06M2m2dXphEzA==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.0.tgz", + "integrity": "sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==", "requires": { "path-parse": "^1.0.6" } @@ -3931,6 +3961,23 @@ "yargs": "^12.0.2" }, "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 + }, + "cliui": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", + "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "dev": true, + "requires": { + "string-width": "^2.1.1", + "strip-ansi": "^4.0.0", + "wrap-ansi": "^2.0.0" + } + }, "get-caller-file": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", @@ -3953,6 +4000,62 @@ "strip-ansi": "^4.0.0" } }, + "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" + } + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + } + } + }, "yargs": { "version": "12.0.5", "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", @@ -3993,21 +4096,6 @@ "emoji-regex": "^7.0.1", "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^5.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "requires": { - "ansi-regex": "^4.1.0" - } - } } }, "string_decoder": { @@ -4026,11 +4114,11 @@ "dev": true }, "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "requires": { - "ansi-regex": "^3.0.0" + "ansi-regex": "^4.1.0" } }, "strip-bom": { @@ -4083,6 +4171,12 @@ "string-width": "^2.1.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 + }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -4092,13 +4186,22 @@ "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^4.0.0" } + }, + "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" + } } } }, "tap": { - "version": "12.6.5", - "resolved": "https://registry.npmjs.org/tap/-/tap-12.6.5.tgz", - "integrity": "sha512-3/RBi1m3cHcBQihlczSrV+uDSpcfkgNGMdaQVoGxUBNGdGoxvf8/BmXYat6zV9S6hjtcNbvZJ6K0OstWKauejA==", + "version": "12.7.0", + "resolved": "https://registry.npmjs.org/tap/-/tap-12.7.0.tgz", + "integrity": "sha512-SjglJmRv0pqrQQ7d5ZBEY8ZOqv3nYDBXEX51oyycOH7piuhn82JKT/yDNewwmOsodTD/RZL9MccA96EjDgK+Eg==", "dev": true, "requires": { "bind-obj-methods": "^2.0.0", @@ -4231,9 +4334,9 @@ } }, "text-extensions": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-1.9.0.tgz", - "integrity": "sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-2.0.0.tgz", + "integrity": "sha512-F91ZqLgvi1E0PdvmxMgp+gcf6q8fMH7mhdwWfzXnl1k+GbpQDmi8l7DzLC5JTASKbwpY3TfxajAUzAXcv2NmsQ==", "dev": true }, "text-table": { @@ -4328,22 +4431,22 @@ } }, "ts-node": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.1.0.tgz", - "integrity": "sha512-34jpuOrxDuf+O6iW1JpgTRDFynUZ1iEqtYruBqh35gICNjN8x+LpVcPAcwzLPi9VU6mdA3ym+x233nZmZp445A==", + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.3.0.tgz", + "integrity": "sha512-dyNS/RqyVTDcmNM4NIBAeDMpsAdaQ+ojdf0GOLqE6nwJOgzEkdRNzJywhDfwnuvB10oa6NLVG1rUJQCpRN7qoQ==", "dev": true, "requires": { "arg": "^4.1.0", - "diff": "^3.1.0", + "diff": "^4.0.1", "make-error": "^1.1.1", "source-map-support": "^0.5.6", "yn": "^3.0.0" }, "dependencies": { "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz", + "integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==", "dev": true } } @@ -4391,15 +4494,15 @@ "dev": true }, "typescript": { - "version": "3.4.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.4.5.tgz", - "integrity": "sha512-YycBxUb49UUhdNMU5aJ7z5Ej2XGmaIBL0x34vZ82fn3hGvD+bgrMrVDpatgz2f7YxUMJxMkbWxJZeAvDxVe7Vw==", + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.5.2.tgz", + "integrity": "sha512-7KxJovlYhTX5RaRbUdkAXN1KUZ8PwWlTzQdHV6xNqvuFOs7+WBo10TQUqT19Q/Jz2hk5v9TQDIhyLhhJY4p5AA==", "dev": true }, "uglify-js": { - "version": "3.5.7", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.5.7.tgz", - "integrity": "sha512-GCgJx3BBuaf/QMvBBkhoHDh4SVsHCC3ILEzriPw4FgJJKCuxVBSYLRkDlmT3uhXyGWKs3VN5r0mCkBIZaHWu3w==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.0.tgz", + "integrity": "sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==", "optional": true, "requires": { "commander": "~2.20.0", @@ -4518,45 +4621,13 @@ "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=" }, "wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "requires": { - "ansi-regex": "^2.0.0" - } - } + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" } }, "wrappy": { @@ -4574,9 +4645,9 @@ } }, "write-file-atomic": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.2.tgz", - "integrity": "sha512-s0b6vB3xIVRLWywa6X9TOMA7k9zio0TMOsl9ZnDkliA/cfJlpHXAscj0gbHVJiTdIuAYpIyqS5GW91fqm6gG5g==", + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.4.3.tgz", + "integrity": "sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ==", "requires": { "graceful-fs": "^4.1.11", "imurmurhash": "^0.1.4", @@ -4606,11 +4677,11 @@ "dev": true }, "yargs": { - "version": "13.2.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.2.2.tgz", - "integrity": "sha512-WyEoxgyTD3w5XRpAQNYUB9ycVH/PQrToaTXdYXRdOXvEy1l19br+VJsc0vcO8PTGg5ro/l/GY7F/JMEBmI0BxA==", + "version": "13.2.4", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.2.4.tgz", + "integrity": "sha512-HG/DWAJa1PAnHT9JAhNa8AbAv3FPaiLzioSjCcmuXXhP8MlpHO5vwls4g4j6n30Z74GVQj8Xa62dWVx1QCGklg==", "requires": { - "cliui": "^4.0.0", + "cliui": "^5.0.0", "find-up": "^3.0.0", "get-caller-file": "^2.0.1", "os-locale": "^3.1.0", @@ -4620,13 +4691,13 @@ "string-width": "^3.0.0", "which-module": "^2.0.0", "y18n": "^4.0.0", - "yargs-parser": "^13.0.0" + "yargs-parser": "^13.1.0" } }, "yargs-parser": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.0.0.tgz", - "integrity": "sha512-w2LXjoL8oRdRQN+hOyppuXs+V/fVAYtpcrRxZuF7Kt/Oc+Jr2uAcVntaUTNT6w5ihoWfFDpNY8CPx1QskxZ/pw==", + "version": "13.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz", + "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", "requires": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" diff --git a/package.json b/package.json index a9e06609d..89a192eca 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,6 @@ "source-map-support": "^0.5.12", "standard": "^12.0.1", "standard-version": "^5.0.2", - "strip-indent": "^2.0.0", "tap": "^12.6.5", "which": "^1.3.1", "zero-fill": "^2.2.3" diff --git a/tap-snapshots/test-nyc-integration.js-TAP.test.js b/tap-snapshots/test-nyc-integration.js-TAP.test.js index 937a3e807..9a88c8159 100644 --- a/tap-snapshots/test-nyc-integration.js-TAP.test.js +++ b/tap-snapshots/test-nyc-integration.js-TAP.test.js @@ -5,6 +5,27 @@ * Make sure to inspect the output below. Do not ignore changes! */ 'use strict' +exports[`test/nyc-integration.js TAP --all includes files with both .map files and inline source-maps > stdout 1`] = ` +----------|----------|----------|----------|----------|-------------------| +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | +----------|----------|----------|----------|----------|-------------------| +All files | 44.44 | 100 | 33.33 | 44.44 | | + s1.js | 80 | 100 | 50 | 80 | 7 | + s2.js | 0 | 100 | 0 | 0 | 1,2,4,6 | +----------|----------|----------|----------|----------|-------------------| + +` + +exports[`test/nyc-integration.js TAP --all uses source-maps to exclude original sources from reports > stdout 1`] = ` +----------|----------|----------|----------|----------|-------------------| +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | +----------|----------|----------|----------|----------|-------------------| +All files | 0 | 100 | 0 | 0 | | + s2.js | 0 | 100 | 0 | 0 | 1,2,4,6 | +----------|----------|----------|----------|----------|-------------------| + +` + exports[`test/nyc-integration.js TAP --check-coverage fails in any case when the underlying test failed > stderr 1`] = ` ERROR: Coverage for lines (33.33%) does not meet global threshold (49%) @@ -218,6 +239,26 @@ end_of_record ` +exports[`test/nyc-integration.js TAP allows alternative high and low watermarks to be configured > stdout 1`] = ` +-----------------|----------|----------|----------|----------|-------------------| +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | +-----------------|----------|----------|----------|----------|-------------------| +All files  | 50 | 50 | 100 | 50 |  | + half-covered.js | 50 | 50 | 100 | 50 | 6,7,8 | +-----------------|----------|----------|----------|----------|-------------------| + +` + +exports[`test/nyc-integration.js TAP allows an alternative cache folder to be specified > stdout 1`] = ` +-----------------|----------|----------|----------|----------|-------------------| +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | +-----------------|----------|----------|----------|----------|-------------------| +All files | 50 | 50 | 100 | 50 | | + half-covered.js | 50 | 50 | 100 | 50 | 6,7,8 | +-----------------|----------|----------|----------|----------|-------------------| + +` + exports[`test/nyc-integration.js TAP allows nyc.config.js configuration to be overridden with command line args > stdout 1`] = ` TN: SF:./ignore.js @@ -291,6 +332,72 @@ end_of_record ` +exports[`test/nyc-integration.js TAP allows reserved word when es-modules is disabled > stdout 1`] = ` +---------------|----------|----------|----------|----------|-------------------| +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | +---------------|----------|----------|----------|----------|-------------------| +All files | 100 | 100 | 100 | 100 | | + not-strict.js | 100 | 100 | 100 | 100 | | +---------------|----------|----------|----------|----------|-------------------| + +` + +exports[`test/nyc-integration.js TAP appropriately instruments file with corresponding .map file > stdout 1`] = ` +----------|----------|----------|----------|----------|-------------------| +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | +----------|----------|----------|----------|----------|-------------------| +All files | 80 | 100 | 50 | 80 | | + s1.js | 80 | 100 | 50 | 80 | 7 | +----------|----------|----------|----------|----------|-------------------| + +` + +exports[`test/nyc-integration.js TAP appropriately instruments file with inline source-map > stdout 1`] = ` +----------|----------|----------|----------|----------|-------------------| +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | +----------|----------|----------|----------|----------|-------------------| +All files | 100 | 100 | 100 | 100 | | + s2.js | 100 | 100 | 100 | 100 | | +----------|----------|----------|----------|----------|-------------------| + +` + +exports[`test/nyc-integration.js TAP can run "npm test" which directly invokes a test file > stdout 1`] = ` + +> @ test . +> node ./half-covered.js + +-----------------|----------|----------|----------|----------|-------------------| +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | +-----------------|----------|----------|----------|----------|-------------------| +All files | 50 | 50 | 100 | 50 | | + half-covered.js | 50 | 50 | 100 | 50 | 6,7,8 | +-----------------|----------|----------|----------|----------|-------------------| + +` + +exports[`test/nyc-integration.js TAP can run "npm test" which indirectly invokes a test file > stdout 1`] = ` + +> @ test . +> npm run test:deeper + + +> @ test:deeper . +> npm run test:even-deeper + + +> @ test:even-deeper . +> node ./half-covered.js + +-----------------|----------|----------|----------|----------|-------------------| +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | +-----------------|----------|----------|----------|----------|-------------------| +All files | 50 | 50 | 100 | 50 | | + half-covered.js | 50 | 50 | 100 | 50 | 6,7,8 | +-----------------|----------|----------|----------|----------|-------------------| + +` + exports[`test/nyc-integration.js TAP check-coverage command is equivalent to the flag > stderr 1`] = ` ERROR: Coverage for lines (50%) does not meet global threshold (51%) @@ -310,10 +417,120 @@ exports[`test/nyc-integration.js TAP check-coverage command is equivalent to the ` +exports[`test/nyc-integration.js TAP does not create .cache folder if cache is "false" > stdout 1`] = ` +-----------------|----------|----------|----------|----------|-------------------| +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | +-----------------|----------|----------|----------|----------|-------------------| +All files | 50 | 50 | 100 | 50 | | + half-covered.js | 50 | 50 | 100 | 50 | 6,7,8 | +-----------------|----------|----------|----------|----------|-------------------| + +` + exports[`test/nyc-integration.js TAP does not interpret args intended for instrumented bin > undefined 1`] = ` [ '--help', '--version' ] ` +exports[`test/nyc-integration.js TAP execute with exclude-node-modules=false > stderr 1`] = ` +ERROR: Coverage for lines (0%) does not meet threshold (90%) for ./node_modules/@istanbuljs/fake-module-1/index.js + +` + +exports[`test/nyc-integration.js TAP execute with exclude-node-modules=false > stderr 2`] = ` +ERROR: Coverage for lines (0%) does not meet threshold (90%) for ./node_modules/@istanbuljs/fake-module-1/index.js + +` + +exports[`test/nyc-integration.js TAP execute with exclude-node-modules=false > stderr 3`] = ` +ERROR: Coverage for lines (0%) does not meet threshold (90%) for ./node_modules/@istanbuljs/fake-module-1/index.js + +` + +exports[`test/nyc-integration.js TAP execute with exclude-node-modules=false > stdout 1`] = ` +----------|----------|----------|----------|----------|-------------------| +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | +----------|----------|----------|----------|----------|-------------------| +All files | 0 | 100 | 100 | 0 | | + index.js | 0 | 100 | 100 | 0 | 1 | +----------|----------|----------|----------|----------|-------------------| + +` + +exports[`test/nyc-integration.js TAP execute with exclude-node-modules=false > stdout 2`] = ` +----------|----------|----------|----------|----------|-------------------| +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | +----------|----------|----------|----------|----------|-------------------| +All files | 0 | 100 | 100 | 0 | | + index.js | 0 | 100 | 100 | 0 | 1 | +----------|----------|----------|----------|----------|-------------------| + +` + +exports[`test/nyc-integration.js TAP execute with exclude-node-modules=false > stdout 3`] = ` + +` + +exports[`test/nyc-integration.js TAP extracts coverage headers from unexecuted files > undefined 1`] = ` +[ + [ + "all", + true + ], + [ + "instrument", + false + ], + [ + "instrumenter", + "./lib/instrumenters/noop" + ], + [ + "silent", + true + ], + [ + "sourceMap", + false + ] +] +` + +exports[`test/nyc-integration.js TAP forbids reserved word when es-modules is not disabled > stderr 1`] = ` +Failed to instrument ./not-strict.js + +` + +exports[`test/nyc-integration.js TAP forbids reserved word when es-modules is not disabled > stdout 1`] = ` +----------|----------|----------|----------|----------|-------------------| +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | +----------|----------|----------|----------|----------|-------------------| +All files | 0 | 0 | 0 | 0 | | +----------|----------|----------|----------|----------|-------------------| + +` + +exports[`test/nyc-integration.js TAP handles --clean / --no-clean properly > stdout 1`] = ` +1 +------------|----------|----------|----------|----------|-------------------| +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | +------------|----------|----------|----------|----------|-------------------| +All files | 50 | 25 | 100 | 50 | | + by-arg2.js | 50 | 25 | 100 | 50 | 4,5,7 | +------------|----------|----------|----------|----------|-------------------| + +` + +exports[`test/nyc-integration.js TAP handles --clean / --no-clean properly > stdout 2`] = ` +2 +------------|----------|----------|----------|----------|-------------------| +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | +------------|----------|----------|----------|----------|-------------------| +All files | 83.33 | 75 | 100 | 83.33 | | + by-arg2.js | 83.33 | 75 | 100 | 83.33 | 7 | +------------|----------|----------|----------|----------|-------------------| + +` + exports[`test/nyc-integration.js TAP hooks provide coverage for requireJS and AMD modules > stdout 1`] = ` ----------|----------|----------|----------|----------|-------------------| File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | @@ -526,6 +743,15 @@ end_of_record ` +exports[`test/nyc-integration.js TAP nyc instrument fails on file with \`package\` keyword when es-modules is enabled > stderr 1`] = ` +Failed to instrument ./not-strict.js + +` + +exports[`test/nyc-integration.js TAP nyc instrument fails on file with \`package\` keyword when es-modules is enabled > stdout 1`] = ` + +` + exports[`test/nyc-integration.js TAP passes configuration via environment variables > undefined 1`] = ` [ [ @@ -597,3 +823,42 @@ All files | 62.5 | 100 | 40 | 62.5 | | ----------|----------|----------|----------|----------|-------------------| ` + +exports[`test/nyc-integration.js TAP setting instrument to "false" configures noop instrumenter > undefined 1`] = ` +[ + [ + "instrument", + false + ], + [ + "instrumenter", + "./lib/instrumenters/noop" + ], + [ + "silent", + true + ], + [ + "sourceMap", + false + ] +] +` + +exports[`test/nyc-integration.js TAP skip-empty does not display 0-line files > stdout 1`] = ` +----------|----------|----------|----------|----------|-------------------| +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | +----------|----------|----------|----------|----------|-------------------| +----------|----------|----------|----------|----------|-------------------| + +` + +exports[`test/nyc-integration.js TAP skip-full does not display files with 100% statement, branch, and function coverage > stdout 1`] = ` +-----------------|----------|----------|----------|----------|-------------------| +File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | +-----------------|----------|----------|----------|----------|-------------------| +All files | 62.5 | 50 | 100 | 62.5 | | + half-covered.js | 50 | 50 | 100 | 50 | 6,7,8 | +-----------------|----------|----------|----------|----------|-------------------| + +` diff --git a/test/helpers/env-check-config.js b/test/helpers/env-check-config.js new file mode 100644 index 000000000..23d4c4f1a --- /dev/null +++ b/test/helpers/env-check-config.js @@ -0,0 +1,27 @@ +'use strict' + +const runNYC = require('./run-nyc') + +module.exports = function envCheckConfig (t, { configArgs, checkOptions }) { + return runNYC({ + tempDir: t.tempDir, + leavePathSep: true, + args: [ + ...configArgs, + process.execPath, + './env.js' + ] + }).then(({ stdout, stderr, status }) => { + const config = JSON.parse(JSON.parse(stdout).NYC_CONFIG) + + t.is(status, 0) + t.is(stderr, '') + t.matchSnapshot( + JSON.stringify( + checkOptions.sort().map(option => [option, config[option]]), + null, + 2 + ) + ) + }) +} diff --git a/test/helpers/index.js b/test/helpers/index.js index 78297caf8..683a4a68a 100644 --- a/test/helpers/index.js +++ b/test/helpers/index.js @@ -8,5 +8,6 @@ module.exports = { testSuccess: require('./test-success'), testFailure: require('./test-failure'), runNYC: require('./run-nyc'), - tempDirSetup: require('./temp-dir-setup') + tempDirSetup: require('./temp-dir-setup'), + envCheckConfig: require('./env-check-config') } diff --git a/test/helpers/run-nyc.js b/test/helpers/run-nyc.js index c8ac93d1d..716ed3f0e 100644 --- a/test/helpers/run-nyc.js +++ b/test/helpers/run-nyc.js @@ -3,7 +3,7 @@ const { nycBin, fixturesCLI } = require('./paths') const spawn = require('./spawn') -const env = { +const envPath = { PATH: process.env.PATH } @@ -25,13 +25,17 @@ function sanitizeString (str, cwd, leavePathSep) { return str } -function runNYC ({ args, tempDir, leavePathSep, cwd = fixturesCLI }) { +function runNYC ({ args, tempDir, leavePathSep, cwd = fixturesCLI, env = {} }) { const runArgs = [nycBin].concat(tempDir ? ['--temp-dir', tempDir] : [], args) return spawn(process.execPath, runArgs, { cwd: cwd, - env + env: Object.assign({}, envPath, env) }).then(({ status, stderr, stdout }) => ({ status, + originalText: { + stderr, + stdout + }, stderr: sanitizeString(stderr, cwd, leavePathSep), stdout: sanitizeString(stdout, cwd, leavePathSep) })) diff --git a/test/nyc-integration-old.js b/test/nyc-integration-old.js index ca7c28a43..6190dc005 100644 --- a/test/nyc-integration-old.js +++ b/test/nyc-integration-old.js @@ -1,19 +1,15 @@ /* global describe, it, beforeEach, afterEach */ // TODO: finish migrating these tests to use snapshots -const _ = require('lodash') const path = require('path') const bin = path.resolve(__dirname, '../self-coverage/bin/nyc') const fixturesCLI = path.resolve(__dirname, './fixtures/cli') -const fixturesSourceMaps = path.resolve(__dirname, './fixtures/source-maps') const fakebin = path.resolve(fixturesCLI, 'fakebin') const fs = require('fs') -const glob = require('glob') const isWindows = require('is-windows')() const rimraf = require('rimraf') const makeDir = require('make-dir') -const { spawn, spawnSync } = require('child_process') -const si = require('strip-indent') +const { spawn } = require('child_process') require('chai').should() require('tap').mochaGlobals() @@ -28,34 +24,6 @@ describe('the nyc cli', function () { // https://github.com/bcoe/nyc/issues/190 describe('running "npm test"', function () { - it('can run "npm test" which directly invokes a test file', function (done) { - var args = [bin, 'npm', 'test'] - var directory = path.resolve(fixturesCLI, 'run-npm-test') - var proc = spawn(process.execPath, args, { - cwd: directory, - env: env - }) - - proc.on('close', function (code) { - code.should.equal(0) - done() - }) - }) - - it('can run "npm test" which indirectly invokes a test file', function (done) { - var args = [bin, 'npm', 'test'] - var directory = path.resolve(fixturesCLI, 'run-npm-test-recursive') - var proc = spawn(process.execPath, args, { - cwd: directory, - env: env - }) - - proc.on('close', function (code) { - code.should.equal(0) - done() - }) - }) - function writeFakeNPM (shebang) { var targetPath = path.resolve(fakebin, 'npm') var source = fs.readFileSync(path.resolve(fakebin, 'npm-template.js')) @@ -111,70 +79,6 @@ describe('the nyc cli', function () { rimraf.sync(path.resolve(fixturesCLI, 'subdir', 'output-dir')) }) - describe('no output folder', function () { - it('allows a single file to be instrumented', function (done) { - var args = [bin, 'instrument', './half-covered.js'] - - var proc = spawn(process.execPath, args, { - cwd: fixturesCLI, - env: env - }) - - var stdout = '' - proc.stdout.on('data', function (chunk) { - stdout += chunk - }) - - proc.on('close', function (code) { - code.should.equal(0) - stdout.should.contain(`path:${JSON.stringify(path.resolve(fixturesCLI, 'half-covered.js'))}`) - done() - }) - }) - - it('allows a directory of files to be instrumented', function (done) { - var args = [bin, 'instrument', './'] - - var proc = spawn(process.execPath, args, { - cwd: fixturesCLI, - env: env - }) - - var stdout = '' - proc.stdout.on('data', function (chunk) { - stdout += chunk - }) - - proc.on('close', function (code) { - code.should.equal(0) - stdout.should.match(/half-covered\.js"/) - stdout.should.match(/half-covered-failing\.js"/) - stdout.should.not.match(/spawn\.js"/) - done() - }) - }) - - it('returns unmodified source if there is no transform', function (done) { - const args = [bin, 'instrument', './no-transform/half-covered.xjs'] - - const proc = spawn(process.execPath, args, { - cwd: fixturesCLI, - env: env - }) - - let stdout = '' - proc.stdout.on('data', function (chunk) { - stdout += chunk - }) - - proc.on('close', function (code) { - code.should.equal(0) - stdout.should.contain(`var a = 0`) - done() - }) - }) - }) - describe('output folder specified', function () { afterEach(function () { rimraf.sync(path.resolve(fixturesCLI, 'output')) @@ -460,53 +364,6 @@ describe('the nyc cli', function () { }) }) - describe('es-modules', function () { - afterEach(function () { - rimraf.sync(path.resolve(fixturesCLI, './output')) - }) - - it('instruments file with `package` keyword when es-modules is disabled', function (done) { - const args = [bin, 'instrument', '--no-es-modules', './not-strict.js', './output'] - - const proc = spawn(process.execPath, args, { - cwd: fixturesCLI, - env: env - }) - - proc.on('close', function (code) { - code.should.equal(0) - const subdirExists = fs.existsSync(path.resolve(fixturesCLI, './output')) - subdirExists.should.equal(true) - const files = fs.readdirSync(path.resolve(fixturesCLI, './output')) - files.should.include('not-strict.js') - done() - }) - }) - - it('fails on file with `package` keyword when es-modules is enabled', function (done) { - const args = [bin, 'instrument', '--exit-on-error', './not-strict.js', './output'] - - const proc = spawn(process.execPath, args, { - cwd: fixturesCLI, - env: env - }) - - let stderr = '' - proc.stderr.on('data', function (chunk) { - stderr += chunk - }) - - proc.on('close', function (code) { - code.should.equal(1) - stdoutShouldEqual(stderr, ` - Failed to instrument ${path.resolve(fixturesCLI, 'not-strict.js')}`) - const subdirExists = fs.existsSync(path.resolve(fixturesCLI, './output')) - subdirExists.should.equal(false) - done() - }) - }) - }) - describe('delete', function () { beforeEach(function () { makeDir.sync(path.resolve(fixturesCLI, 'output', 'removed-by-clean')) @@ -592,23 +449,6 @@ describe('the nyc cli', function () { }) }) - it('help shows to stderr when main command doesn\'t know what to do', () => { - const opts = { - cwd: fixturesCLI, - env, - encoding: 'utf8' - } - - const help = spawnSync(process.execPath, [bin, '--help'], opts) - const unknown = spawnSync(process.execPath, [bin], opts) - help.status.should.equal(0) - unknown.status.should.equal(1) - help.stderr.should.equal('') - unknown.stdout.should.equal('') - help.stdout.should.not.equal('') - help.stdout.should.equal(unknown.stderr) - }) - describe('--temp-dir', function () { beforeEach(() => { rimraf.sync(path.resolve(fixturesCLI, '.nyc_output')) @@ -678,486 +518,6 @@ describe('the nyc cli', function () { }) }) - it('handles --clean / --no-clean properly', () => { - rimraf.sync(path.resolve(fixturesCLI, '.nyc_output')) - const args = (doClean, arg) => [ - bin, - doClean ? '--clean' : '--no-clean', - process.execPath, - './by-arg2.js', - arg - ] - const opts = { - cwd: fixturesCLI, - env: env, - encoding: 'utf8' - } - - const proc1 = spawnSync(process.execPath, args(true, '1'), opts) - proc1.status.should.equal(0) - stdoutShouldEqual(proc1.stdout, ` - 1 - ------------|----------|----------|----------|----------|-------------------| - File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | - ------------|----------|----------|----------|----------|-------------------| - All files | 50 | 25 | 100 | 50 | | - by-arg2.js | 50 | 25 | 100 | 50 | 4,5,7 | - ------------|----------|----------|----------|----------|-------------------|` - ) - proc1.stderr.should.equal('') - - const proc2 = spawnSync(process.execPath, args(false, '2'), opts) - proc2.status.should.equal(0) - stdoutShouldEqual(proc2.stdout, ` - 2 - ------------|----------|----------|----------|----------|-------------------| - File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | - ------------|----------|----------|----------|----------|-------------------| - All files | 83.33 | 75 | 100 | 83.33 | | - by-arg2.js | 83.33 | 75 | 100 | 83.33 | 7 | - ------------|----------|----------|----------|----------|-------------------|` - ) - proc2.stderr.should.equal('') - }) - - describe('noop instrumenter', function () { - it('setting instrument to "false" configures noop instrumenter', function (done) { - var args = [ - bin, - '--silent', - '--no-instrument', - '--no-source-map', - process.execPath, - './env.js' - ] - var expected = { - silent: true, - instrument: false, - sourceMap: false, - instrumenter: './lib/instrumenters/noop' - } - - var proc = spawn(process.execPath, args, { - cwd: fixturesCLI, - env: env - }) - - var stdout = '' - proc.stdout.on('data', function (chunk) { - stdout += chunk - }) - - proc.on('close', function (code) { - code.should.equal(0) - var env = JSON.parse(stdout) - var config = JSON.parse(env.NYC_CONFIG, null, 2) - config.should.include(expected) - done() - }) - }) - - describe('--all', function () { - it('extracts coverage headers from unexecuted files', function (done) { - var nycOutput = path.resolve(fixturesCLI, '.nyc_output') - rimraf.sync(nycOutput) - - var args = [ - bin, - '--all', - '--silent', - '--no-instrument', - '--no-source-map', - process.execPath, - // any file other than external-instrument.js, which we - // want to ensure has its header loaded. - './env.js' - ] - - var proc = spawn(process.execPath, args, { - cwd: fixturesCLI, - env: env - }) - - proc.on('close', function (code) { - code.should.equal(0) - glob(nycOutput + '/*.json', function (_err, files) { - // we should have extracted the coverage header from external-instrumenter.js. - var coverage = {} - files.forEach(function (file) { - _.assign(coverage, JSON.parse( - fs.readFileSync(file, 'utf-8') - )) - }) - Object.keys(coverage).should.include('./external-instrumenter.js') - - // we should not have executed file, so all counts sould be 0. - var sum = 0 - Object.keys(coverage['./external-instrumenter.js'].s).forEach(function (k) { - sum += coverage['./external-instrumenter.js'].s[k] - }) - sum.should.equal(0) - - return done() - }) - }) - }) - }) - }) - - it('allows an alternative cache folder to be specified', function (done) { - var args = [bin, '--cache-dir=./foo-cache', '--cache=true', process.execPath, './half-covered.js'] - - var proc = spawn(process.execPath, args, { - cwd: fixturesCLI, - env: env - }) - proc.on('close', function (code) { - code.should.equal(0) - // we should have created ./foo-cache rather - // than the default ./node_modules/.cache. - fs.readdirSync(path.resolve( - fixturesCLI, './foo-cache' - )).length.should.equal(1) - rimraf.sync(path.resolve(fixturesCLI, 'foo-cache')) - done() - }) - }) - - // see: https://github.com/istanbuljs/nyc/issues/563 - it('does not create .cache folder if cache is "false"', function (done) { - var args = [bin, '--cache=false', process.execPath, './index.js'] - - var proc = spawn(process.execPath, args, { - cwd: process.cwd(), - env: env - }) - - rimraf.sync('./node_modules/.cache') - - proc.on('close', function (code) { - code.should.equal(0) - fs.existsSync('./node_modules/.cache').should.equal(false) - done() - }) - }) - - it('allows alternative high and low watermarks to be configured', function (done) { - var args = [ - bin, - '--watermarks.lines=90', - '--watermarks.lines=100', - '--watermarks.statements=30', - '--watermarks.statements=40', - '--cache=true', - process.execPath, - './half-covered.js' - ] - - var proc = spawn(process.execPath, args, { - cwd: fixturesCLI, - env: { - PATH: process.env.PATH, - FORCE_COLOR: true - } - }) - - var stdout = '' - proc.stdout.on('data', function (chunk) { - stdout += chunk - }) - - proc.on('close', function (code) { - code.should.equal(0) - // 50% line coverage is below our low watermark (so it's red). - stdout.should.match(/\[31;1m\W+50\W+/) - // 50% statement coverage is above our high-watermark (so it's green). - stdout.should.match(/\[32;1m\W+50\W+/) - done() - }) - }) - - // the following tests exercise nyc's behavior around source-maps - // that have been included with pre-instrumented files. Perhaps, as an - // example, unit tests are being run against minified JavaScript. - // --exclude-after-remap will likely need to be set to false when - // using nyc with this type of configuration. - describe('source-maps', () => { - describe('--all', () => { - it('includes files with both .map files and inline source-maps', (done) => { - const args = [ - bin, - '--all', - '--cache', 'false', - '--exclude-after-remap', 'false', - '--exclude', 'original', - process.execPath, './instrumented/s1.min.js' - ] - - const proc = spawn(process.execPath, args, { - cwd: fixturesSourceMaps, - env: env - }) - - var stdout = '' - proc.stdout.on('data', function (chunk) { - stdout += chunk - }) - - proc.on('close', function (code) { - code.should.equal(0) - stdoutShouldEqual(stdout, ` - ----------|----------|----------|----------|----------|-------------------| - File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | - ----------|----------|----------|----------|----------|-------------------| - All files | 44.44 | 100 | 33.33 | 44.44 | | - s1.js | 80 | 100 | 50 | 80 | 7 | - s2.js | 0 | 100 | 0 | 0 | 1,2,4,6 | - ----------|----------|----------|----------|----------|-------------------|` - ) - done() - }) - }) - - it('uses source-maps to exclude original sources from reports', (done) => { - const args = [ - bin, - '--all', - '--cache', 'false', - '--exclude', 'original/s1.js', - process.execPath, './instrumented/s1.min.js' - ] - - const proc = spawn(process.execPath, args, { - cwd: fixturesSourceMaps, - env: env - }) - - var stdout = '' - proc.stdout.on('data', function (chunk) { - stdout += chunk - }) - - proc.on('close', function (code) { - code.should.equal(0) - stdoutShouldEqual(stdout, ` - ----------|----------|----------|----------|----------|-------------------| - File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | - ----------|----------|----------|----------|----------|-------------------| - All files | 0 | 100 | 0 | 0 | | - s2.js | 0 | 100 | 0 | 0 | 1,2,4,6 | - ----------|----------|----------|----------|----------|-------------------|` - ) - done() - }) - }) - }) - - describe('.map file', () => { - it('appropriately instruments file with corresponding .map file', (done) => { - const args = [ - bin, - '--cache', 'false', - '--exclude-after-remap', 'false', - '--exclude', 'original', - process.execPath, './instrumented/s1.min.js' - ] - - const proc = spawn(process.execPath, args, { - cwd: fixturesSourceMaps, - env: env - }) - - var stdout = '' - proc.stdout.on('data', function (chunk) { - stdout += chunk - }) - - proc.on('close', function (code) { - code.should.equal(0) - stdoutShouldEqual(stdout, ` - ----------|----------|----------|----------|----------|-------------------| - File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | - ----------|----------|----------|----------|----------|-------------------| - All files | 80 | 100 | 50 | 80 | | - s1.js | 80 | 100 | 50 | 80 | 7 | - ----------|----------|----------|----------|----------|-------------------|`) - done() - }) - }) - }) - - describe('inline', () => { - it('appropriately instruments a file with an inline source-map', (done) => { - const args = [ - bin, - '--cache', 'false', - '--exclude-after-remap', 'false', - '--exclude', 'original', - process.execPath, './instrumented/s2.min.js' - ] - - const proc = spawn(process.execPath, args, { - cwd: fixturesSourceMaps, - env: env - }) - - var stdout = '' - proc.stdout.on('data', function (chunk) { - stdout += chunk - }) - - proc.on('close', function (code) { - code.should.equal(0) - stdoutShouldEqual(stdout, ` - ----------|----------|----------|----------|----------|-------------------| - File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | - ----------|----------|----------|----------|----------|-------------------| - All files | 100 | 100 | 100 | 100 | | - s2.js | 100 | 100 | 100 | 100 | | - ----------|----------|----------|----------|----------|-------------------|`) - done() - }) - }) - }) - }) - - describe('skip-empty', () => { - it('does not display 0-line files in coverage output', (done) => { - const args = [ - bin, - '--cache', 'false', - '--skip-empty', 'true', - process.execPath, './empty.js' - ] - - const proc = spawn(process.execPath, args, { - cwd: fixturesCLI, - env: env - }) - - var stdout = '' - proc.stdout.on('data', function (chunk) { - stdout += chunk - }) - - proc.stdout.on('error', function (chunk) { - stdout += chunk - }) - - proc.on('close', function (code) { - code.should.equal(0) - stdoutShouldEqual(stdout, ` - ----------|----------|----------|----------|----------|-------------------| - File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | - ----------|----------|----------|----------|----------|-------------------| - ----------|----------|----------|----------|----------|-------------------|`) - done() - }) - }) - }) - - describe('skip-full', () => { - it('does not display files with 100% statement, branch, and function coverage', (done) => { - const args = [ - bin, - '--skip-full', - process.execPath, './skip-full.js' - ] - - const proc = spawn(process.execPath, args, { - cwd: fixturesCLI, - env: env - }) - - var stdout = '' - proc.stdout.on('data', function (chunk) { - stdout += chunk - }) - - proc.on('close', function (code) { - code.should.equal(0) - stdoutShouldEqual(stdout, ` - -----------------|----------|----------|----------|----------|-------------------| - File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | - -----------------|----------|----------|----------|----------|-------------------| - All files | 62.5 | 50 | 100 | 62.5 | | - half-covered.js | 50 | 50 | 100 | 50 | 6,7,8 | - -----------------|----------|----------|----------|----------|-------------------|`) - done() - }) - }) - }) - - describe('es-modules', () => { - it('allows reserved word when es-modules is disabled', (done) => { - const args = [ - bin, - '--cache', 'false', - '--es-modules', 'false', - process.execPath, './not-strict.js' - ] - - const proc = spawn(process.execPath, args, { - cwd: fixturesCLI, - env: env - }) - - var stdout = '' - proc.stdout.on('data', function (chunk) { - stdout += chunk - }) - - proc.on('close', function (code) { - code.should.equal(0) - stdoutShouldEqual(stdout, ` - ---------------|----------|----------|----------|----------|-------------------| - File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | - ---------------|----------|----------|----------|----------|-------------------| - All files | 100 | 100 | 100 | 100 | | - not-strict.js | 100 | 100 | 100 | 100 | | - ---------------|----------|----------|----------|----------|-------------------|`) - done() - }) - }) - - it('forbids reserved word when es-modules is not disabled', (done) => { - const args = [ - bin, - '--cache', 'false', - '--exit-on-error', 'true', - process.execPath, './not-strict.js' - ] - - const proc = spawn(process.execPath, args, { - cwd: fixturesCLI, - env: env - }) - - var stdout = '' - proc.stdout.on('data', function (chunk) { - stdout += chunk - }) - - var stderr = '' - proc.stderr.on('data', function (chunk) { - stderr += chunk - }) - - proc.on('close', function (code) { - code.should.equal(1) - stdoutShouldEqual(stderr, ` - Failed to instrument ${path.join(fixturesCLI, 'not-strict.js')}`) - stdoutShouldEqual(stdout, ` - ----------|----------|----------|----------|----------|-------------------| - File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | - ----------|----------|----------|----------|----------|-------------------| - All files | 0 | 0 | 0 | 0 | | - ----------|----------|----------|----------|----------|-------------------|`) - done() - }) - }) - }) - describe('merge', () => { it('combines multiple coverage reports', (done) => { const args = [ @@ -1233,138 +593,6 @@ describe('the nyc cli', function () { }) }) - describe('exclude-node-modules', () => { - const fixturesENM = path.resolve(__dirname, './fixtures/exclude-node-modules') - const globalArgs = [ - bin, - '--all=true', - '--cache=false', - '--per-file=true', - '--exclude-node-modules=false', - '--include=node_modules/@istanbuljs/fake-module-1/**' - ] - const spawnOpts = { - cwd: fixturesENM, - env: env - } - const noCoverageError = `ERROR: Coverage for lines (0%) does not meet threshold (90%) for ${path.join(fixturesENM, 'node_modules/@istanbuljs/fake-module-1/index.js')}\n` - - it('execute', done => { - function checkReport (code, stderr, stdout, next) { - code.should.equal(1) - stderr.should.equal(noCoverageError) - stdoutShouldEqual(stdout, ` - ----------|----------|----------|----------|----------|-------------------| - File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | - ----------|----------|----------|----------|----------|-------------------| - All files | 0 | 100 | 100 | 0 | | - index.js | 0 | 100 | 100 | 0 | 1 | - ----------|----------|----------|----------|----------|-------------------|`) - next() - } - - function executeMainCommand () { - const args = [ - ...globalArgs, - '--check-coverage=true', - process.execPath, './bin/do-nothing.js' - ] - - const proc = spawn(process.execPath, args, spawnOpts) - - var stderr = '' - proc.stderr.on('data', function (chunk) { - stderr += chunk - }) - - var stdout = '' - proc.stdout.on('data', function (chunk) { - stdout += chunk - }) - - proc.on('close', code => checkReport(code, stderr, stdout, executeReport)) - } - - function executeReport () { - const args = [ - ...globalArgs, - '--check-coverage=true', - 'report' - ] - - const proc = spawn(process.execPath, args, spawnOpts) - - var stderr = '' - proc.stderr.on('data', function (chunk) { - stderr += chunk - }) - - var stdout = '' - proc.stdout.on('data', function (chunk) { - stdout += chunk - }) - - proc.on('close', code => checkReport(code, stderr, stdout, executeCheckCoverage)) - } - - function executeCheckCoverage () { - const args = [ - ...globalArgs, - 'check-coverage' - ] - - const proc = spawn(process.execPath, args, spawnOpts) - - var stderr = '' - proc.stderr.on('data', function (chunk) { - stderr += chunk - }) - - var stdout = '' - proc.stdout.on('data', function (chunk) { - stdout += chunk - }) - - proc.on('close', code => { - code.should.equal(1) - stderr.should.equal(noCoverageError) - stdoutShouldEqual(stdout, '') - done() - }) - } - - executeMainCommand() - }) - - it('instrument', done => { - const args = [ - ...globalArgs, - 'instrument', - 'node_modules' - ] - - const proc = spawn(process.execPath, args, spawnOpts) - - var stderr = '' - proc.stderr.on('data', function (chunk) { - stderr += chunk - }) - - var stdout = '' - proc.stdout.on('data', function (chunk) { - stdout += chunk - }) - - proc.on('close', code => { - code.should.equal(0) - stderr.should.equal('') - stdout.should.match(/fake-module-1/) - stdout.should.not.match(/fake-module-2/) - done() - }) - }) - }) - it('recursive run does not throw', done => { const args = [ bin, @@ -1396,7 +624,3 @@ describe('the nyc cli', function () { }) }) }) - -function stdoutShouldEqual (stdout, expected) { - `\n${stdout}`.should.equal(`${si(expected)}\n`) -} diff --git a/test/nyc-integration.js b/test/nyc-integration.js index c4e0d9064..e09408315 100644 --- a/test/nyc-integration.js +++ b/test/nyc-integration.js @@ -1,14 +1,27 @@ 'use strict' const path = require('path') +const fs = require('fs') const os = require('os') const t = require('tap') +const glob = require('glob') +const rimraf = require('rimraf') -const { fixturesCLI, runNYC, tempDirSetup, testSuccess, testFailure } = require('./helpers') +const { fixturesCLI, runNYC, tempDirSetup, testSuccess, testFailure, envCheckConfig } = require('./helpers') const nycConfigJS = path.resolve(fixturesCLI, 'nyc-config-js') const nycrcDir = path.resolve(fixturesCLI, 'nycrc') +const fixturesSourceMaps = path.resolve(fixturesCLI, '../source-maps') +const fixturesENM = path.resolve(fixturesCLI, '../exclude-node-modules') + +const executeNodeModulesArgs = [ + '--all=true', + '--cache=false', + '--per-file=true', + '--exclude-node-modules=false', + '--include=node_modules/@istanbuljs/fake-module-1/**' +] t.jobs = os.cpus().length @@ -66,48 +79,29 @@ t.test('--check-coverage fails when the expected file coverage is below a thresh args: ['--check-coverage', '--lines', '51', '--per-file', process.execPath, './half-covered.js'] })) -t.test('passes configuration via environment variables', t => { - return runNYC({ - tempDir: t.tempDir, - leavePathSep: true, - args: [ - '--silent', - '--require=make-dir', - '--include=env.js', - '--exclude=batman.js', - '--extension=.js', - '--cache=false', - '--cache-dir=/tmp', - '--source-map=true', - process.execPath, - './env.js' - ] - }).then(({ stdout, stderr, status }) => { - const checkOptions = [ - 'instrumenter', - 'silent', - 'cacheDir', - 'cache', - 'sourceMap', - 'require', - 'include', - 'exclude', - 'extension' - ] - - const config = JSON.parse(JSON.parse(stdout).NYC_CONFIG) - - t.is(status, 0) - t.is(stderr, '') - t.matchSnapshot( - JSON.stringify( - checkOptions.sort().map(option => [option, config[option]]), - null, - 2 - ) - ) - }) -}) +t.test('passes configuration via environment variables', t => envCheckConfig(t, { + configArgs: [ + '--silent', + '--require=make-dir', + '--include=env.js', + '--exclude=batman.js', + '--extension=.js', + '--cache=false', + '--cache-dir=/tmp', + '--source-map=true' + ], + checkOptions: [ + 'instrumenter', + 'silent', + 'cacheDir', + 'cache', + 'sourceMap', + 'require', + 'include', + 'exclude', + 'extension' + ] +})) t.test('allows package.json configuration to be overridden with command line args', t => testSuccess(t, { args: ['--reporter=text-lcov', process.execPath, './half-covered.js'] @@ -171,6 +165,7 @@ t.test('hooks provide coverage for requireJS and AMD modules', t => testSuccess( t.test('does not interpret args intended for instrumented bin', t => { return runNYC({ + tempDir: t.tempDir, args: ['--silent', process.execPath, 'args.js', '--help', '--version'], leavePathSep: true }).then(({ status, stderr, stdout }) => { @@ -187,3 +182,324 @@ t.test('interprets first args after -- as Node.js execArgv', t => testSuccess(t, t.test('--show-process-tree displays a tree of spawned processes', t => testSuccess(t, { args: ['--show-process-tree', process.execPath, 'selfspawn-fibonacci.js', '5'] })) + +t.test('can run "npm test" which directly invokes a test file', t => testSuccess(t, { + args: ['npm', 'test'], + cwd: path.resolve(fixturesCLI, 'run-npm-test') +})) + +t.test('can run "npm test" which indirectly invokes a test file', t => testSuccess(t, { + args: ['npm', 'test'], + cwd: path.resolve(fixturesCLI, 'run-npm-test-recursive') +})) + +t.test('nyc instrument single file to console', t => { + return runNYC({ + tempDir: t.tempDir, + args: ['instrument', './half-covered.js'] + }).then(({ status, stderr, originalText }) => { + t.is(status, 0) + t.is(stderr, '') + t.match(originalText.stdout, `path:${JSON.stringify(path.resolve(fixturesCLI, 'half-covered.js'))}`) + }) +}) + +t.test('nyc instrument a directory of files', t => { + return runNYC({ + tempDir: t.tempDir, + args: ['instrument', './'] + }).then(({ status, stderr, originalText }) => { + t.is(status, 0) + t.is(stderr, '') + t.match(originalText.stdout, `path:${JSON.stringify(path.resolve(fixturesCLI, 'half-covered.js'))}`) + t.match(originalText.stdout, `path:${JSON.stringify(path.resolve(fixturesCLI, 'half-covered-failing.js'))}`) + t.notMatch(originalText.stdout, `path:${JSON.stringify(path.resolve(fixturesCLI, 'test.js'))}`) + }) +}) + +t.test('nyc instrument returns unmodified source if there is no transform', t => { + return runNYC({ + tempDir: t.tempDir, + args: ['instrument', './no-transform/half-covered.xjs'] + }).then(({ status, stderr, stdout }) => { + t.is(status, 0) + t.is(stderr, '') + t.match(stdout, 'var a = 0') + t.notMatch(stdout, 'cov_') + }) +}) + +t.test('nyc instrument on file with `package` keyword when es-modules is disabled', t => { + return runNYC({ + tempDir: t.tempDir, + args: ['instrument', '--no-es-modules', './not-strict.js'] + }).then(({ status, stderr, originalText }) => { + t.is(status, 0) + t.is(stderr, '') + t.match(originalText.stdout, `path:${JSON.stringify(path.resolve(fixturesCLI, 'not-strict.js'))}`) + }) +}) + +t.test('nyc instrument fails on file with `package` keyword when es-modules is enabled', t => testFailure(t, { + args: ['instrument', '--exit-on-error', './not-strict.js'] +})) + +t.test('nyc displays help to stderr when it doesn\'t know what to do', t => { + let helpmsg + + return runNYC({ + tempDir: t.tempDir, + args: ['--help'] + }).then(({ status, stderr, stdout }) => { + t.is(status, 0) + t.is(stderr, '') + helpmsg = stdout + }).then(() => runNYC({ + tempDir: t.tempDir, + args: [] + })).then(({ status, stderr, stdout }) => { + t.equal(status, 1) + t.equal(stdout, '') + t.equal(stderr, helpmsg) + }) +}) + +t.test('handles --clean / --no-clean properly', t => { + return testSuccess(t, { + args: [ + '--clean', + process.execPath, + './by-arg2.js', + '1' + ] + }).then(() => testSuccess(t, { + args: [ + '--no-clean', + process.execPath, + './by-arg2.js', + '2' + ] + })) +}) + +t.test('setting instrument to "false" configures noop instrumenter', t => envCheckConfig(t, { + configArgs: [ + '--silent', + '--no-instrument', + '--no-source-map' + ], + checkOptions: [ + 'silent', + 'instrument', + 'sourceMap', + 'instrumenter' + ] +})) + +t.test('extracts coverage headers from unexecuted files', t => { + return envCheckConfig(t, { + configArgs: [ + '--all', + '--silent', + '--no-instrument', + '--no-source-map' + ], + checkOptions: [ + 'all', + 'silent', + 'instrument', + 'sourceMap', + 'instrumenter' + ] + }).then(() => new Promise((resolve, reject) => { + glob(path.join(t.tempDir, '*.json'), (err, files) => { + if (err) { + return reject(err) + } + + resolve(files) + }) + })).then(files => { + const coverage = files.reduce( + (obj, file) => Object.assign(obj, JSON.parse(fs.readFileSync(file, 'utf-8'))), + {} + ) + + // we should not have executed file, so all counts sould be 0. + const data = coverage['./external-instrumenter.js'] + t.type(data, 'object') + + t.false(Object.keys(data.s).some(k => data.s[k] !== 0)) + }) +}) + +t.test('allows an alternative cache folder to be specified', t => { + const cacheDir = path.resolve(fixturesCLI, 'foo-cache') + + return testSuccess(t, { + args: [ + `--cache-dir=${cacheDir}`, + '--cache=true', + process.execPath, + './half-covered.js' + ] + }).then(() => { + // we should have created foo-cache rather + // than the default ./node_modules/.cache. + t.is(1, fs.readdirSync(cacheDir).length) + + rimraf.sync(cacheDir) + }) +}) + +// see: https://github.com/istanbuljs/nyc/issues/563 +t.test('does not create .cache folder if cache is "false"', t => { + const cacheDir = path.resolve(fixturesCLI, './disabled-cache') + + return testSuccess(t, { + args: [ + `--cache-dir=${cacheDir}`, + '--cache=false', + process.execPath, + './half-covered.js' + ] + }).then(() => { + t.false(fs.existsSync(cacheDir)) + }) +}) + +t.test('allows alternative high and low watermarks to be configured', t => testSuccess(t, { + args: [ + '--watermarks.lines=90', + '--watermarks.lines=100', + '--watermarks.statements=30', + '--watermarks.statements=40', + '--cache=true', + process.execPath, + './half-covered.js' + ], + env: { + FORCE_COLOR: true + } +})) + +t.test('--all includes files with both .map files and inline source-maps', t => testSuccess(t, { + args: [ + '--all', + '--cache=false', + '--exclude-after-remap=false', + '--exclude=original', + process.execPath, + './instrumented/s1.min.js' + ], + cwd: fixturesSourceMaps +})) + +t.test('--all uses source-maps to exclude original sources from reports', t => testSuccess(t, { + args: [ + '--all', + '--cache=false', + '--exclude=original/s1.js', + process.execPath, + './instrumented/s1.min.js' + ], + cwd: fixturesSourceMaps +})) + +t.test('appropriately instruments file with corresponding .map file', t => testSuccess(t, { + args: [ + '--cache=false', + '--exclude-after-remap=false', + '--exclude=original', + process.execPath, + './instrumented/s1.min.js' + ], + cwd: fixturesSourceMaps +})) + +t.test('appropriately instruments file with inline source-map', t => testSuccess(t, { + args: [ + '--cache=false', + '--exclude-after-remap=false', + '--exclude=original', + process.execPath, + './instrumented/s2.min.js' + ], + cwd: fixturesSourceMaps +})) + +t.test('skip-empty does not display 0-line files', t => testSuccess(t, { + args: [ + '--cache=false', + '--skip-empty=true', + process.execPath, + './empty.js' + ] +})) + +t.test('skip-full does not display files with 100% statement, branch, and function coverage', t => testSuccess(t, { + args: [ + '--skip-full', + process.execPath, + './skip-full.js' + ] +})) + +t.test('allows reserved word when es-modules is disabled', t => testSuccess(t, { + args: [ + '--cache=false', + '--es-modules=false', + process.execPath, + './not-strict.js' + ] +})) + +t.test('forbids reserved word when es-modules is not disabled', t => testFailure(t, { + args: [ + '--cache=false', + '--exit-on-error=true', + process.execPath, + './not-strict.js' + ] +})) + +t.test('execute with exclude-node-modules=false', t => { + return testFailure(t, { + args: [ + ...executeNodeModulesArgs, + '--check-coverage=true', + process.execPath, + './bin/do-nothing.js' + ], + cwd: fixturesENM + }).then(() => testFailure(t, { + args: [ + ...executeNodeModulesArgs, + '--check-coverage=true', + 'report' + ], + cwd: fixturesENM + })).then(() => testFailure(t, { + args: [ + ...executeNodeModulesArgs, + 'check-coverage' + ], + cwd: fixturesENM + })) +}) + +t.test('instrument with exclude-node-modules=false', t => { + return runNYC({ + tempDir: t.tempDir, + args: [ + ...executeNodeModulesArgs, + 'instrument', + 'node_modules' + ], + cwd: fixturesENM + }).then(({ status, stderr, stdout }) => { + t.is(status, 0) + t.is(stderr, '') + t.match(stdout, 'fake-module-1') + }) +})