node/deps/npm/test/packages/npm-test-peer-deps/test.js

28 lines
723 B
JavaScript
Raw Normal View History

2013-01-10 07:21:30 +08:00
var path = require("path")
var assert = require("assert")
process.env.npm_config_prefix = process.cwd()
delete process.env.npm_config_global
delete process.env.npm_config_depth
var npm = process.env.npm_execpath
2013-02-07 00:39:27 +08:00
require("child_process").execFile(process.execPath, [npm, "ls", "--json"], {
2013-01-10 07:21:30 +08:00
env: process.env, cwd: process.cwd() },
function (err, stdout, stderr) {
if (err) throw err
var actual = JSON.parse(stdout).dependencies
2013-01-19 04:12:07 +08:00
var expected = require("./npm-ls.json")
2013-02-07 00:39:27 +08:00
// resolved url doesn't matter
delete actual.dict.resolved
delete expected.dict.resolved
2013-01-19 04:12:07 +08:00
console.error(JSON.stringify(actual, null, 2))
console.error(JSON.stringify(expected, null, 2))
2013-01-10 07:21:30 +08:00
assert.deepEqual(actual, expected)
})