Inherit environment variables when testing

This commit is contained in:
Richard Gibson
2017-05-25 12:29:20 -04:00
parent de2db39161
commit 981c3e0ce4

View File

@@ -4,6 +4,7 @@ const path = require('path')
const test = require('tape')
const rimraf = require('rimraf')
const localSearchPath = './node_modules/.bin' + path.delimiter + process.env.PATH
const testDir = 'test/fixtures/samples/'.replace('/', path.sep)
const phantomjs = 'node_modules/.bin/phantomjs '.replace('/', path.sep)
const loadHtmlSaveScreenshotPngScripts = testDir + path.sep + 'load_html_save_screenshot_png.phantomjs'
@@ -28,12 +29,7 @@ function execPhantomjsToLoadHtmlSaveScreenshotPng (html, verify) {
function execCmd (cmd, verify) {
console.log('cmd: ', cmd)
exec(cmd,
{ env: {
PATH: './node_modules/.bin' + path.delimiter + process.env.PATH,
// https://github.com/ariya/phantomjs/issues/14376
QT_QPA_PLATFORM: 'offscreen'
} },
{ env: Object.assign({}, process.env, { PATH: localSearchPath }) },
function (error, stdout, stderr) {
console.log('error:', error, '\nstdout:\n', stdout, '\nstderr:\n', stderr)
verify(error, stdout, stderr)