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

false_name.js « tap « test - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 968b6e74b1e4baf16a68b0e6dba43d5f5596e700 (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
var test = require("tap").test
  , fs = require("fs")
  , path = require("path")
  , existsSync = fs.existsSync || path.existsSync
  , spawn = require("child_process").spawn
  , npm = require("../../")
  , rimraf = require("rimraf")

test("not every pkg.name can be required", function (t) {
  t.plan(1)

  setup(function () {
    npm.install(".", function (err) {
      if (err) return t.fail(err)
      t.ok(existsSync(__dirname +
        "/false_name/node_modules/tap/node_modules/buffer-equal"))
    })
  })
})

function setup (cb) {
  process.chdir(__dirname + "/false_name")
  npm.load(function () {
    rimraf.sync(__dirname + "/false_name/node_modules")
    fs.mkdirSync(__dirname + "/false_name/node_modules")
    cb()
  })
}