1 var common = require("../common-tap.js")
2 var test = require("tap").test
3 var npm = require("../../")
4 var rimraf = require("rimraf")
5 var path = require("path")
6 var mr = require("npm-registry-mock")
7 var osenv = require("osenv")
8 var mkdirp = require("mkdirp")
9 var fs = require("graceful-fs")
11 var pkg = path.resolve(__dirname, "outdated-private")
12 var pkgLocalPrivate = path.resolve(pkg, "local-private")
13 var pkgScopedLocalPrivate = path.resolve(pkg, "another-local-private")
14 var pkgLocalUnderscore = path.resolve(pkg, "underscore")
16 var pjParent = JSON.stringify({
17 name : "outdated-private",
20 "local-private" : "file:local-private",
21 "@scoped/another-local-private" : "file:another-local-private",
22 "underscore" : "file:underscore"
26 var pjLocalPrivate = JSON.stringify({
27 name : "local-private",
32 var pjLocalPrivateBumped = JSON.stringify({
33 name : "local-private",
38 var pjScopedLocalPrivate = JSON.stringify({
39 name : "@scoped/another-local-private",
44 var pjLocalUnderscore = JSON.stringify({
49 test("setup", function (t) {
54 test("outdated ignores private modules", function (t) {
57 mr({ port : common.port }, function (err, s) {
62 registry : common.registry
65 npm.install(".", function (err) {
66 t.ifError(err, "install success")
68 npm.outdated(function (er, d) {
69 t.ifError(er, "outdated success")
71 path.resolve(__dirname, "outdated-private"),
86 test("cleanup", function (t) {
91 function bootstrap () {
93 fs.writeFileSync(path.resolve(pkg, "package.json"), pjParent)
95 mkdirp.sync(pkgLocalPrivate)
96 fs.writeFileSync(path.resolve(pkgLocalPrivate, "package.json"), pjLocalPrivate)
98 mkdirp.sync(pkgScopedLocalPrivate)
99 fs.writeFileSync(path.resolve(pkgScopedLocalPrivate, "package.json"), pjScopedLocalPrivate)
101 mkdirp.sync(pkgLocalUnderscore)
102 fs.writeFileSync(path.resolve(pkgLocalUnderscore, "package.json"), pjLocalUnderscore)
105 function bumpLocalPrivate () {
106 fs.writeFileSync(path.resolve(pkgLocalPrivate, "package.json"), pjLocalPrivateBumped)
109 function cleanup () {
110 process.chdir(osenv.tmpdir())