New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get environment variables from npm #7
Conversation
Problem in Travis CI: XO did not work with node V4 |
Can you add a test? |
@sindresorhus Two problems: Sugestions?
import test from 'ava';
import execa from 'execa';
import globalDirs from '.';
console.log(globalDirs);
const npm = arguments_ => execa.stdout('npm', arguments_);
test('npm.prefix with env', async t => {
process.env.npm_config_PREFIX = '/usr/local/lib'
t.is(globalDirs.npm.prefix, '/usr/local/lib');
});
//... all tests ...//
const test = require('ava');
const execa = require('execa');
const npm = arguments_ => execa.stdout('npm', arguments_);
test('npm.prefix with env', async t => {
process.env.npm_config_PREFIX = '/usr/local/lib';
const globalDirs = require('.');
console.log(globalDirs);
t.is(globalDirs.npm.prefix, '/usr/local/lib');
});
//... all tests ...//
const test = require('ava');
const execa = require('execa');
const globalDirs = require('.');
console.log(globalDirs);
const npm = arguments_ => execa.stdout('npm', arguments_);
test('npm.prefix with env', async t => {
process.env.npm_config_PREFIX = '/usr/local/lib';
const globalDirsEnv = require('.');
t.is(globalDirsEnv.npm.prefix, '/usr/local/lib');
});
//... all tests ...// |
@sindresorhus Done! Added new test. |
I don't want to expose a |
Fixes #4
Note: "Config values are case-insensitive" (NPM Config Docs: https://docs.npmjs.com/misc/config)