From 001aa3d1a85eb79cc04acae3626b710c9ea482b3 Mon Sep 17 00:00:00 2001
From: Peter Jaszkowiak
Date: Sat, 21 Jan 2017 19:21:02 -0700
Subject: [PATCH] Fix tests, npm Windows fixes
---
nodebb | 4 ++--
src/plugins/install.js | 2 +-
test/mocks/databasemock.js | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/nodebb b/nodebb
index e1a4ab7fbf..7f1d2941a3 100755
--- a/nodebb
+++ b/nodebb
@@ -225,12 +225,12 @@ var getRunningPid = function (callback) {
if (['y', 'Y', 'yes', 'YES'].indexOf(result.upgrade) !== -1) {
process.stdout.write('\nUpgrading packages...');
- var args = ['npm', 'i'];
+ var args = ['i'];
found.forEach(function (suggestObj) {
args.push(suggestObj.name + '@' + suggestObj.suggested);
});
- require('child_process').execFile('/usr/bin/env', args, { stdio: 'ignore' }, function (err) {
+ require('child_process').execFile((process.platform === 'win32') ? 'npm.cmd' : 'npm', args, { stdio: 'ignore' }, function (err) {
if (!err) {
process.stdout.write(' OK\n'.green);
}
diff --git a/src/plugins/install.js b/src/plugins/install.js
index a914a09ca6..840d46008a 100644
--- a/src/plugins/install.js
+++ b/src/plugins/install.js
@@ -102,7 +102,7 @@ module.exports = function (Plugins) {
}
function runNpmCommand(command, pkgName, version, callback) {
- require('child_process').execFile('npm', [command, pkgName + (command === 'install' ? '@' + version : '')], function (err, stdout) {
+ require('child_process').execFile((process.platform === 'win32') ? 'npm.cmd' : 'npm', [command, pkgName + (command === 'install' ? '@' + version : '')], function (err, stdout) {
if (err) {
return callback(err);
}
diff --git a/test/mocks/databasemock.js b/test/mocks/databasemock.js
index 182d9fea12..b7ed4cfb8c 100644
--- a/test/mocks/databasemock.js
+++ b/test/mocks/databasemock.js
@@ -140,7 +140,7 @@
nconf.set('theme_config', path.join(nconf.get('themes_path'), 'nodebb-theme-persona', 'theme.json'));
nconf.set('bcrypt_rounds', 1);
- require('../../build').buildTargets(['js', 'clientCSS', 'acpCSS', 'tpl'], next);
+ require('../../build').buildAll(next);
},
function (next) {
var webserver = require('../../src/webserver');