]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/test/tap/publish-config.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / test / tap / publish-config.js
1 var common = require("../common-tap.js")
2 var test = require("tap").test
3 var fs = require("fs")
4 var osenv = require("osenv")
5 var pkg = process.env.npm_config_tmp || "/tmp"
6 pkg += "/npm-test-publish-config"
7
8 require("mkdirp").sync(pkg)
9
10 fs.writeFileSync(pkg + "/package.json", JSON.stringify({
11   name: "npm-test-publish-config",
12   version: "1.2.3",
13   publishConfig: { registry: common.registry }
14 }), "utf8")
15
16 fs.writeFileSync(pkg + "/fixture_npmrc",
17   "//localhost:1337/:email = fancy@feast.net\n" +
18   "//localhost:1337/:username = fancy\n" +
19   "//localhost:1337/:_password = " + new Buffer("feast").toString("base64") + "\n" +
20   "registry = http://localhost:1337/")
21
22 test(function (t) {
23   var child
24   t.plan(4)
25   require("http").createServer(function (req, res) {
26     t.pass("got request on the fakey fake registry")
27     this.close()
28     res.statusCode = 500
29     res.end(JSON.stringify({
30       error: "sshhh. naptime nao. \\^O^/ <(YAWWWWN!)"
31     }))
32     child.kill('SIGHUP')
33   }).listen(common.port, function () {
34     t.pass("server is listening")
35
36     // don't much care about listening to the child's results
37     // just wanna make sure it hits the server we just set up.
38     //
39     // there are plenty of other tests to verify that publish
40     // itself functions normally.
41     //
42     // Make sure that we don't sit around waiting for lock files
43     child = common.npm(["publish", "--userconfig=" + pkg + "/fixture_npmrc"], {
44       cwd: pkg,
45       stdio: "inherit",
46       env: {
47         "npm_config_cache_lock_stale": 1000,
48         "npm_config_cache_lock_wait": 1000,
49         HOME: process.env.HOME,
50         Path: process.env.PATH,
51         PATH: process.env.PATH,
52         USERPROFILE: osenv.home()
53       }
54     }, function (err, code) {
55       t.ifError(err, "publish command finished successfully")
56       t.notOk(code, "npm install exited with code 0")
57     })
58   })
59 })