Do not set the PREFIX environment variable (#13) · npm/config@bbebc66 (original) (raw)

`@@ -14,7 +14,6 @@ t.test('set envs that are not defaults and not already in env', t => {

`

14

14

`INIT_CWD: cwd,

`

15

15

`EDITOR: 'vim',

`

16

16

`HOME: undefined,

`

17

``

`-

PREFIX: undefined,

`

18

17

`npm_execpath: require.main.filename,

`

19

18

`npm_node_execpath: execPath,

`

20

19

`}

`

`@@ -56,7 +55,6 @@ t.test('set envs that are not defaults and not already in env, array style', t =

`

56

55

`INIT_CWD: cwd,

`

57

56

`EDITOR: 'vim',

`

58

57

`HOME: undefined,

`

59

``

`-

PREFIX: undefined,

`

60

58

`npm_execpath: require.main.filename,

`

61

59

`npm_node_execpath: execPath,

`

62

60

`}

`

`@@ -95,7 +93,6 @@ t.test('set envs that are not defaults and not already in env, boolean edition',

`

95

93

`INIT_CWD: cwd,

`

96

94

`EDITOR: 'vim',

`

97

95

`HOME: undefined,

`

98

``

`-

PREFIX: undefined,

`

99

96

`npm_execpath: require.main.filename,

`

100

97

`npm_node_execpath: execPath,

`

101

98

`}

`

`@@ -127,33 +124,6 @@ t.test('set envs that are not defaults and not already in env, boolean edition',

`

127

124

`t.end()

`

128

125

`})

`

129

126

``

130

``

`-

t.test('set PREFIX based on DESTDIR', t => {

`

131

``

`-

// also, don't set editor

`

132

``

`-

const d = { ...defaults, editor: null }

`

133

``

`-

const envConf = Object.create(d)

`

134

``

`-

const cliConf = Object.create(envConf)

`

135

``

`-

const extras = {

`

136

``

`-

NODE,

`

137

``

`-

INIT_CWD: cwd,

`

138

``

`-

HOME: undefined,

`

139

``

`-

PREFIX: '/usr/local',

`

140

``

`-

DESTDIR: '/some/dest',

`

141

``

`-

npm_execpath: require.main.filename,

`

142

``

`-

npm_node_execpath: execPath,

`

143

``

`-

}

`

144

``

`-

const env = { DESTDIR: '/some/dest' }

`

145

``

`-

const config = {

`

146

``

`-

list: [cliConf, envConf],

`

147

``

`-

env,

`

148

``

`-

defaults: d,

`

149

``

`-

globalPrefix: '/some/dest/usr/local',

`

150

``

`-

execPath,

`

151

``

`-

}

`

152

``

`-

setEnvs(config)

`

153

``

`-

t.strictSame(env, { ...extras })

`

154

``

`-

t.end()

`

155

``

`-

})

`

156

``

-

157

127

`t.test('dont set npm_execpath if require.main.filename is not set', t => {

`

158

128

`const { filename } = require.main

`

159

129

`t.teardown(() => require.main.filename = filename)

`