node/deps/npm/test/tap/peer-deps-invalid.js
isaacs f76c3938d0 npm: upgrade to v1.4.8
* Check SHA before using files from cache
* adduser: allow change of the saved password
* Make `npm install` respect `config.unicode`
* Fix lifecycle to pass `Infinity` for config env value
* Don't return 0 exit code on invalid command
* cache: Handle 404s and other HTTP errors as errors
* bump tap dep, make tests stderr a bit quieter
* Resolve ~ in path configs to env.HOME
* Include npm version in default user-agent conf
* npm init: Use ISC as default license, use save-prefix for deps
* Many test and doc fixes
2014-05-01 11:09:00 -07:00

47 lines
1.2 KiB
JavaScript

var common = require('../common-tap.js')
var fs = require("fs")
var path = require("path")
var test = require("tap").test
var rimraf = require("rimraf")
var npm = require("../../")
var mr = require("npm-registry-mock")
var pkg = __dirname + "/peer-deps-invalid"
var okFile = fs.readFileSync(path.join(pkg, "file-ok.js"), "utf8")
var failFile = fs.readFileSync(path.join(pkg, "file-fail.js"), "utf8")
test("installing dependencies that have conflicting peerDependencies", function (t) {
rimraf.sync(pkg + "/node_modules")
rimraf.sync(pkg + "/cache")
process.chdir(pkg)
var customMocks = {
"get": {
"/ok.js": [200, okFile],
"/invalid.js": [200, failFile]
}
}
mr({port: common.port, mocks: customMocks}, function (s) { // create mock registry.
npm.load({
cache: pkg + "/cache",
registry: common.registry
}, function () {
npm.commands.install([], function (err) {
if (!err) {
t.fail("No error!")
} else {
t.equal(err.code, "EPEERINVALID")
}
t.end()
s.close() // shutdown mock registry.
})
})
})
})
test("cleanup", function (t) {
rimraf.sync(pkg + "/node_modules")
rimraf.sync(pkg + "/cache")
t.end()
})