<commit_before>var common = require("../common-tap")
  , path = require("path")
  , test = require("tap").test
  , rimraf = require("rimraf")
  , npm = require("../../")
  , mr = require("npm-registry-mock")
  , pkg = path.resolve(__dirname, "outdated-depth-deep")
  , cache = path.resolve(pkg, "cache")

var osenv = require("osenv")
var mkdirp = require("mkdirp")
var fs = require("fs")

var pj = JSON.stringify({
  "name": "whatever",
  "description": "yeah idk",
  "version": "1.2.3",
  "main": "index.js",
  "dependencies": {
    "underscore": "1.3.1",
    "npm-test-peer-deps": "0.0.0"
  },
  "repository": "git://github.com/luk-/whatever"
}, null, 2)

function cleanup () {
  process.chdir(osenv.tmpdir())
  rimraf.sync(pkg)
}

function setup () {
  mkdirp.sync(pkg)
  process.chdir(pkg)
  fs.writeFileSync(path.resolve(pkg, "package.json"), pj)
}

test("setup", function (t) {
  cleanup()
  setup()
  t.end()
})

test("outdated depth deep (9999)", function (t) {
  var underscoreOutdated = ["underscore", "1.3.1", "1.3.1", "1.5.1", "1.3.1"]
  var childPkg = path.resolve(pkg, "node_modules", "npm-test-peer-deps")

  var expected = [ [pkg].concat(underscoreOutdated),
                   [childPkg].concat(underscoreOutdated) ]

  process.chdir(pkg)

  mr({port : common.port}, function (er, s) {
    npm.load({
      cache: cache
    , loglevel: "silent"
    , registry: common.registry
    , depth: 9999
    }
    , function () {
        npm.install(".", function (er) {
          if (er) throw new Error(er)
          npm.outdated(function (err, d) {
            if (err) throw new Error(err)
            t.deepEqual(d, expected)
            s.close()
            t.end()
          })
        })
      }
    )
  })
})


test("cleanup", function (t) {
  cleanup()
  t.end()
})<commit_msg>test: outdated-depth-deep: Update to match npm@3 output<commit_after>var common = require("../common-tap")
  , path = require("path")
  , test = require("tap").test
  , rimraf = require("rimraf")
  , npm = require("../../")
  , mr = require("npm-registry-mock")
  , pkg = path.resolve(__dirname, "outdated-depth-deep")
  , cache = path.resolve(pkg, "cache")

var osenv = require("osenv")
var mkdirp = require("mkdirp")
var fs = require("fs")

var pj = JSON.stringify({
  "name": "whatever",
  "description": "yeah idk",
  "version": "1.2.3",
  "main": "index.js",
  "dependencies": {
    "underscore": "1.3.1",
    "npm-test-peer-deps": "0.0.0"
  },
  "repository": "git://github.com/luk-/whatever"
}, null, 2)

function cleanup () {
  process.chdir(osenv.tmpdir())
  rimraf.sync(pkg)
}

function setup () {
  mkdirp.sync(pkg)
  process.chdir(pkg)
  fs.writeFileSync(path.resolve(pkg, "package.json"), pj)
}

test("setup", function (t) {
  cleanup()
  setup()
  t.end()
})

test("outdated depth deep (9999)", function (t) {
  var underscoreOutdated = ["underscore", "1.3.1", "1.3.1", "1.5.1", "1.3.1"]
  var childPkg = path.resolve(pkg, "node_modules", "npm-test-peer-deps")

  var expected = [ [childPkg].concat(underscoreOutdated).concat([null]),
                   [pkg].concat(underscoreOutdated).concat([null]) ]

  process.chdir(pkg)

  mr({port : common.port}, function (er, s) {
    npm.load({
      cache: cache
    , loglevel: "silent"
    , registry: common.registry
    , depth: 9999
    }
    , function () {
        npm.install(".", function (er) {
          if (er) throw new Error(er)
          npm.explore("npm-test-peer-deps", "npm", "install", "underscore", function (er) {
            if (er) throw new Error(er)
            npm.outdated(function (err, d) {
              if (err) throw new Error(err)
              t.deepEqual(d, expected)
              s.close()
              t.end()
            })
          })
        })
      }
    )
  })
})


test("cleanup", function (t) {
  cleanup()
  t.end()
})
{'fraction_non_alphanumeric': 0.1960219837738812, 'fraction_numerical': 0.01596440722323999, 'mean_word_length': 2.6820809248554913, 'pattern_counts': {'":': 16, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6623336', 'n_tokens_mistral': 1447, 'n_tokens_neox': 1376, 'n_words': 275}