diff --git a/package-lock.json b/package-lock.json index d1e5e10e..6bb65410 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1933,6 +1933,14 @@ "semver": "^5.5.0", "shebang-command": "^1.2.0", "which": "^1.2.9" + }, + "dependencies": { + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true + } } }, "currently-unhandled": { @@ -2333,6 +2341,12 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", "dev": true + }, + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true } } }, @@ -3899,6 +3913,12 @@ "find-up": "^2.0.0", "read-pkg": "^3.0.0" } + }, + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true } } }, @@ -4141,6 +4161,14 @@ "resolve": "^1.10.0", "semver": "2 || 3 || 4 || 5", "validate-npm-package-license": "^3.0.1" + }, + "dependencies": { + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", + "dev": true + } } }, "p-limit": { @@ -5462,6 +5490,13 @@ "integrity": "sha512-uq1iL79YjfYC0WXoHbC/z28q/9pOl8kSHaXdWmAAc8No+bDwqkZbzIJz55g/MUsPgSGm9LZ7QSUbzTcH5tz47w==", "requires": { "semver": "^5.3.0" + }, + "dependencies": { + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==" + } } }, "normalize-package-data": { @@ -5473,6 +5508,13 @@ "is-builtin-module": "^1.0.0", "semver": "2 || 3 || 4 || 5", "validate-npm-package-license": "^3.0.1" + }, + "dependencies": { + "semver": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", + "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==" + } } }, "normalize-path": { @@ -6689,9 +6731,10 @@ "dev": true }, "semver": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", - "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==" + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.1.2.tgz", + "integrity": "sha512-z4PqiCpomGtWj8633oeAdXm1Kn1W++3T8epkZYnwiVgIYIJ0QHszhInYSJTYxebByQH7KVCEAn8R9duzZW2PhQ==", + "dev": true }, "semver-compare": { "version": "1.0.0", diff --git a/package.json b/package.json index fb9e6346..d139dce8 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "eslint-find-rules": "3.3.1", "execa": "1.0.0", "prettier": "1.18.2", + "semver": "^6.1.2", "tape": "4.10.2", "typescript": "3.5.2", "ybiq": "8.0.0" diff --git a/test/e2e.test.js b/test/e2e.test.js index 9143b399..72cd5de2 100644 --- a/test/e2e.test.js +++ b/test/e2e.test.js @@ -1,6 +1,7 @@ const path = require("path"); const fs = require("fs"); const { EOL } = require("os"); +const semver = require("semver"); const test = require("tape"); const pkg = require("../package.json"); const { sandbox, $, lintConfigFiles } = require("./helper"); @@ -21,16 +22,22 @@ cache-min=9999 test("End-to-End", t => { const tarball = $("npm", "pack"); const tarballPath = `file:${path.join(baseDir, tarball)}`; + const peerDeps = Object.entries(pkg.peerDependencies).map(([name, verRange]) => { + const ver = semver.valid(semver.coerce(verRange)); + return `${name}@${ver}`; + }); - sandbox(() => { + sandbox(cwd => { fs.writeFileSync(".npmrc", npmrc); $("npm", "init", "--yes", "--no-init-module"); - $("npm", "install", ...Object.keys(pkg.peerDependencies), tarballPath); + $("npm", "install", ...peerDeps, tarballPath); + + const eslint = path.join(cwd, "node_modules", ".bin", "eslint"); writeESLintConfig({ extends: "ybiquitous" }); writeLintTargetFile("process.stdout.write(1);"); - $("eslint", "."); + $(eslint, "."); t.pass("default configuration"); lintConfigFiles @@ -39,12 +46,12 @@ test("End-to-End", t => { const configName = `ybiquitous/${path.basename(file, ".js")}`; writeESLintConfig({ extends: configName }); writeLintTargetFile("process.stdout.write(1);"); - $("eslint", "."); + $(eslint, "."); t.pass(`${configName} configuration`); }); lintConfigFiles.forEach(file => { - $("eslint", "--print-config", path.join("node_modules", "eslint-config-ybiquitous", file)); + $(eslint, "--print-config", path.join("node_modules", "eslint-config-ybiquitous", file)); t.pass(`verify configuration for ${file}`); }); }); diff --git a/test/helper.js b/test/helper.js index 8908cc2c..cb3322a6 100644 --- a/test/helper.js +++ b/test/helper.js @@ -14,8 +14,8 @@ const log = msg => { }; const $ = (cmd, ...args) => { - log(`> ${[cmd, ...args].join(" ")}`); - const { stdout } = execa.sync(cmd, args, { shell: true }); + log(`> ${cmd} '${args.join("' '")}'`); + const { stdout } = execa.sync(cmd, args); const maxLines = 20; const lines = stdout.split(EOL); if (lines.length < maxLines) {