Add test for lifecycle.makeEnv()

This commit is contained in:
Yeonghoon Park
2014-02-18 21:22:41 +09:00
committed by Domenic Denicola
parent 3e03524f8a
commit 8b5e7b6ae5
2 changed files with 20 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
exports = module.exports = lifecycle
exports.cmd = cmd
exports.makeEnv = makeEnv
var log = require("npmlog")
, spawn = require("child_process").spawn

19
test/tap/lifecycle.js Normal file
View File

@@ -0,0 +1,19 @@
var test = require("tap").test
var npm = require('../../')
var path = require("path")
var pkg = path.resolve(__dirname, "..", "..")
var lifecycle = require('../../lib/utils/lifecycle')
var Conf = require("npmconf").Conf
test("lifecycle: make env correctly", function (t) {
npm.load(function() {
var env = lifecycle.makeEnv(pkg)
var conf = new Conf()
conf.addEnv(env)
conf.keys.forEach(function (key) {
t.equal(conf.get(key), npm.config.get(key))
})
t.end()
})
})