]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/test/tap/bugs.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / test / tap / bugs.js
1 if (process.platform === "win32") {
2   console.error("skipping test, because windows and shebangs")
3   return
4 }
5
6 var common = require("../common-tap.js")
7 var mr = require("npm-registry-mock")
8
9 var test = require("tap").test
10 var rimraf = require("rimraf")
11 var fs = require("fs")
12 var path = require("path")
13 var join = path.join
14 var outFile = path.join(__dirname, "/_output")
15
16 var opts = { cwd: __dirname }
17
18 test("setup", function (t) {
19   var s = "#!/usr/bin/env bash\n" +
20           "echo \"$@\" > " + JSON.stringify(__dirname) + "/_output\n"
21   fs.writeFileSync(join(__dirname, "/_script.sh"), s, "ascii")
22   fs.chmodSync(join(__dirname, "/_script.sh"), "0755")
23   t.pass("made script")
24   t.end()
25 })
26
27 test("npm bugs underscore", function (t) {
28   mr({port : common.port}, function (er, s) {
29     common.npm([
30       "bugs", "underscore",
31       "--registry=" + common.registry,
32       "--loglevel=silent",
33       "--browser=" + join(__dirname, "/_script.sh")
34     ], opts, function (err, code, stdout, stderr) {
35       t.ifError(err, "bugs ran without issue")
36       t.notOk(stderr, "should have no stderr")
37       t.equal(code, 0, "exit ok")
38       var res = fs.readFileSync(outFile, "ascii")
39       s.close()
40       t.equal(res, "https://github.com/jashkenas/underscore/issues\n")
41       rimraf.sync(outFile)
42       t.end()
43     })
44   })
45 })
46
47 test("npm bugs optimist - github (https://)", function (t) {
48   mr({port : common.port}, function (er, s) {
49     common.npm([
50       "bugs", "optimist",
51       "--registry=" + common.registry,
52       "--loglevel=silent",
53       "--browser=" + join(__dirname, "/_script.sh")
54     ], opts, function (err, code, stdout, stderr) {
55       t.ifError(err, "bugs ran without issue")
56       t.notOk(stderr, "should have no stderr")
57       t.equal(code, 0, "exit ok")
58       var res = fs.readFileSync(outFile, "ascii")
59       s.close()
60       t.equal(res, "https://github.com/substack/node-optimist/issues\n")
61       rimraf.sync(outFile)
62       t.end()
63     })
64   })
65 })
66
67 test("npm bugs npm-test-peer-deps - no repo", function (t) {
68   mr({port : common.port}, function (er, s) {
69     common.npm([
70       "bugs", "npm-test-peer-deps",
71       "--registry=" + common.registry,
72       "--loglevel=silent",
73       "--browser=" + join(__dirname, "/_script.sh")
74     ], opts, function (err, code, stdout, stderr) {
75       t.ifError(err, "bugs ran without issue")
76       t.notOk(stderr, "should have no stderr")
77       t.equal(code, 0, "exit ok")
78       var res = fs.readFileSync(outFile, "ascii")
79       s.close()
80       t.equal(res, "https://www.npmjs.org/package/npm-test-peer-deps\n")
81       rimraf.sync(outFile)
82       t.end()
83     })
84   })
85 })
86
87 test("npm bugs test-repo-url-http - non-github (http://)", function (t) {
88   mr({port : common.port}, function (er, s) {
89     common.npm([
90       "bugs", "test-repo-url-http",
91       "--registry=" + common.registry,
92       "--loglevel=silent",
93       "--browser=" + join(__dirname, "/_script.sh")
94     ], opts, function (err, code, stdout, stderr) {
95       t.ifError(err, "bugs ran without issue")
96       t.notOk(stderr, "should have no stderr")
97       t.equal(code, 0, "exit ok")
98       var res = fs.readFileSync(outFile, "ascii")
99       s.close()
100       t.equal(res, "https://www.npmjs.org/package/test-repo-url-http\n")
101       rimraf.sync(outFile)
102       t.end()
103     })
104   })
105 })
106
107 test("npm bugs test-repo-url-https - non-github (https://)", function (t) {
108   mr({port : common.port}, function (er, s) {
109     common.npm([
110       "bugs", "test-repo-url-https",
111       "--registry=" + common.registry,
112       "--loglevel=silent",
113       "--browser=" + join(__dirname, "/_script.sh")
114     ], opts, function (err, code, stdout, stderr) {
115       t.ifError(err, "bugs ran without issue")
116       t.notOk(stderr, "should have no stderr")
117       t.equal(code, 0, "exit ok")
118       var res = fs.readFileSync(outFile, "ascii")
119       s.close()
120       t.equal(res, "https://www.npmjs.org/package/test-repo-url-https\n")
121       rimraf.sync(outFile)
122       t.end()
123     })
124   })
125 })
126
127 test("npm bugs test-repo-url-ssh - non-github (ssh://)", function (t) {
128   mr({port : common.port}, function (er, s) {
129     common.npm([
130       "bugs", "test-repo-url-ssh",
131       "--registry=" + common.registry,
132       "--loglevel=silent",
133       "--browser=" + join(__dirname, "/_script.sh")
134     ], opts, function (err, code, stdout, stderr) {
135       t.ifError(err, "bugs ran without issue")
136       t.notOk(stderr, "should have no stderr")
137       t.equal(code, 0, "exit ok")
138       var res = fs.readFileSync(outFile, "ascii")
139       s.close()
140       t.equal(res, "https://www.npmjs.org/package/test-repo-url-ssh\n")
141       rimraf.sync(outFile)
142       t.end()
143     })
144   })
145 })
146
147 test("cleanup", function (t) {
148   fs.unlinkSync(join(__dirname, "/_script.sh"))
149   t.pass("cleaned up")
150   t.end()
151 })