mirror of
https://github.com/zhigang1992/npm.git
synced 2026-06-16 11:49:53 +08:00
Add test for lifecycle.makeEnv()
This commit is contained in:
committed by
Domenic Denicola
parent
3e03524f8a
commit
8b5e7b6ae5
@@ -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
19
test/tap/lifecycle.js
Normal 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()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user