testem
Version:
Test'em 'scripts! Javascript Unit testing made easy.
27 lines (21 loc) • 530 B
JavaScript
;
const _ = require('lodash');
const isWin = require('./is-win')();
let PATH = 'PATH';
let delimiter = ':';
// windows calls it's path 'Path' usually, but this is not guaranteed.
if (isWin) {
PATH = 'Path';
delimiter = ';';
Object.keys(process.env).forEach(function(e) {
if (e.match(/^PATH$/i)) {
PATH = e;
}
});
}
module.exports = function addToPATH(path) {
let env = _.cloneDeep(process.env);
env[PATH] = [path, env[PATH]].join(delimiter);
return env;
};
module.exports.PATH = PATH;