Welcome to mirror list, hosted at ThFree Co, Russian Federation.

uninstall-package.js « tap « test - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 06827012501a8ef765df518109b1a2970d22646a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var test = require("tap").test
  , npm = require("../../")
  , rimraf = require("rimraf")
  , mr = require("npm-registry-mock")
  , common = require("../common-tap.js")
  , pkg = __dirname + "/uninstall-package"

test("returns a list of removed items", function (t) {
  t.plan(1)
  mr(common.port, function (s) {
    setup(function () {
      npm.install(".", function (err) {
        if (err) return t.fail(err)
        npm.uninstall("underscore", "request", "lala", function (err, d) {
          if (err) return t.fail(err)
          t.same(d.sort(), ["underscore", "request"].sort())
          s.close()
          t.end()
        })
      })
    })
  })
})

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

function setup (cb) {
  cleanup()
  process.chdir(pkg)
  npm.load({cache: pkg + "/cache", registry: common.registry}, function () {
    cb()
  })
}

function cleanup () {
  rimraf.sync(pkg + "/node_modules")
  rimraf.sync(pkg + "/cache")
}