Skip to content

Commit

Permalink
deps: create .npmrc during npm tests
Browse files Browse the repository at this point in the history
This patch should make the tests pass on the downstreamed npm.

PR-URL: #2696
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
  • Loading branch information
zkat authored and rvagg committed Sep 6, 2015
1 parent d15ba80 commit ba02bd0
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion deps/npm/test/tap/00-config-setup.js
@@ -1,3 +1,4 @@
var fs = require("graceful-fs")
var path = require("path")
var userconfigSrc = path.resolve(__dirname, "..", "fixtures", "config", "userconfig")
exports.userconfig = userconfigSrc + "-with-gc"
Expand Down Expand Up @@ -55,10 +56,24 @@ exports.envDataFix = {
"other-env-thing": 1000
}

var projectConf = path.resolve(__dirname, '..', '..', '.npmrc')
try {
fs.statSync(projectConf)
} catch (er) {
// project conf not found, probably working with packed npm
fs.writeFileSync(projectConf, 'save-prefix = ~\nproprietary-attribs = false\n')
}

var projectRc = path.join(__dirname, '..', 'fixtures', 'config', '.npmrc')
try {
fs.statSync(projectRc)
} catch (er) {
// project conf not found, probably working with packed npm
fs.writeFileSync(projectRc, 'just = testing')
}

if (module === require.main) {
// set the globalconfig in the userconfig
var fs = require("fs")
var uc = fs.readFileSync(userconfigSrc)
var gcini = "globalconfig = " + exports.globalconfig + "\n"
fs.writeFileSync(exports.userconfig, gcini + uc)
Expand Down

0 comments on commit ba02bd0

Please sign in to comment.