From 187d611e8c2a7dc849f62f283ac70714fa637e84 Mon Sep 17 00:00:00 2001 From: Nils Knappmeier Date: Thu, 2 Jan 2020 15:47:09 +0100 Subject: [PATCH] test: add path to nodeJs when running test:bin - this allows the test to be run in a debugger without the complete PATH --- tasks/test-bin.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tasks/test-bin.js b/tasks/test-bin.js index 077e6d4f3..3a9c43095 100644 --- a/tasks/test-bin.js +++ b/tasks/test-bin.js @@ -1,6 +1,7 @@ const childProcess = require('child_process'); const fs = require('fs'); const os = require('os'); +const path = require('path'); const chai = require('chai'); chai.use(require('chai-diff')); @@ -37,7 +38,13 @@ function executeBinHandlebars(...args) { } function execFilesSyncUtf8(command, args) { - return childProcess.execFileSync(command, args, { encoding: 'utf-8' }); + const env = process.env; + env.PATH = addPathToNodeJs(env.PATH); + return childProcess.execFileSync(command, args, { encoding: 'utf-8', env }); +} + +function addPathToNodeJs(pathEnvironment) { + return path.dirname(process.argv0) + path.delimiter + pathEnvironment; } function normalizeCrlf(string) {