From 1acabf64c7ef3f547e6f9309abef72ae3f2cc9ee Mon Sep 17 00:00:00 2001 From: Rob Yoder Date: Wed, 26 Jan 2022 23:27:05 -0700 Subject: [PATCH 1/3] Handle relative `--elm-test` path --- lib/runner.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/runner.js b/lib/runner.js index fab55e2..e1310d1 100644 --- a/lib/runner.js +++ b/lib/runner.js @@ -106,17 +106,18 @@ var setupTests = (log, args) => () => { var runTests = (log, args) => () => { log.info("testRunInit", "Running tests..."); return new Promise(function(resolve, reject) { + var elmTest = path.resolve(args["elm-test"]); log.debug( "testRun", "spawning " + - args["elm-test"] + + elmTest + " --compiler " + fakeElmBinary + " " + args.tests ); var process = spawn( - args["elm-test"], + elmTest, ["--compiler", fakeElmBinary, args.tests] .concat(args._) .concat(args.report === "json" ? ["--report", "json"] : []), From f6da61eedae4af5b1044b358c30dc442b85c6a15 Mon Sep 17 00:00:00 2001 From: Rob Yoder Date: Wed, 26 Jan 2022 23:28:48 -0700 Subject: [PATCH 2/3] Handle local elm install --- bin/fake-elm | 2 +- package-lock.json | 61 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 63 insertions(+), 1 deletion(-) diff --git a/bin/fake-elm b/bin/fake-elm index f41898f..6bd5a44 100755 --- a/bin/fake-elm +++ b/bin/fake-elm @@ -3,7 +3,7 @@ var yargs = require("yargs"); var spawn = require("child_process").spawn; var fs = require("fs-extra"); -var which = require("which"); +var which = require("npm-which")(process.cwd()); var elmBinary = which.sync("elm"); diff --git a/package-lock.json b/package-lock.json index 0b9673c..4712420 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "fs-extra": "^4.0.3", "lodash": "^4.17.15", "moment": "^2.24.0", + "npm-which": "^3.0.1", "opn": "^5.5.0", "request": "^2.88.0", "table": "^6.8.0", @@ -1472,6 +1473,41 @@ "node": ">=0.10.0" } }, + "node_modules/npm-path": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/npm-path/-/npm-path-2.0.4.tgz", + "integrity": "sha512-IFsj0R9C7ZdR5cP+ET342q77uSRdtWOlWpih5eC+lu29tIDbNEgDbzgVJ5UFvYHWhxDZ5TFkJafFioO0pPQjCw==", + "dependencies": { + "which": "^1.2.10" + }, + "bin": { + "npm-path": "bin/npm-path" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/npm-which": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/npm-which/-/npm-which-3.0.1.tgz", + "integrity": "sha1-kiXybsOihcIJyuZ8OxGmtKtxQKo=", + "dependencies": { + "commander": "^2.9.0", + "npm-path": "^2.0.2", + "which": "^1.2.10" + }, + "bin": { + "npm-which": "bin/npm-which.js" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/npm-which/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, "node_modules/oauth-sign": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", @@ -3420,6 +3456,31 @@ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" }, + "npm-path": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/npm-path/-/npm-path-2.0.4.tgz", + "integrity": "sha512-IFsj0R9C7ZdR5cP+ET342q77uSRdtWOlWpih5eC+lu29tIDbNEgDbzgVJ5UFvYHWhxDZ5TFkJafFioO0pPQjCw==", + "requires": { + "which": "^1.2.10" + } + }, + "npm-which": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/npm-which/-/npm-which-3.0.1.tgz", + "integrity": "sha1-kiXybsOihcIJyuZ8OxGmtKtxQKo=", + "requires": { + "commander": "^2.9.0", + "npm-path": "^2.0.2", + "which": "^1.2.10" + }, + "dependencies": { + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + } + } + }, "oauth-sign": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", diff --git a/package.json b/package.json index 43e046f..6622842 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "fs-extra": "^4.0.3", "lodash": "^4.17.15", "moment": "^2.24.0", + "npm-which": "^3.0.1", "opn": "^5.5.0", "request": "^2.88.0", "table": "^6.8.0", From 52fc753fc2ddbce44605cb23f72431b31d47695b Mon Sep 17 00:00:00 2001 From: Rob Yoder Date: Thu, 27 Jan 2022 00:06:27 -0700 Subject: [PATCH 3/3] Fix default case --- lib/runner.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/runner.js b/lib/runner.js index e1310d1..36eddda 100644 --- a/lib/runner.js +++ b/lib/runner.js @@ -106,7 +106,10 @@ var setupTests = (log, args) => () => { var runTests = (log, args) => () => { log.info("testRunInit", "Running tests..."); return new Promise(function(resolve, reject) { - var elmTest = path.resolve(args["elm-test"]); + var elmTest = args["elm-test"]; + if (elmTest !== "elm-test") { + elmTest = path.resolve(elmTest); + } log.debug( "testRun", "spawning " +