]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/test/tap/pwd-prefix.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / test / tap / pwd-prefix.js
1 // This test ensures that a few commands do the same
2 // thing when the cwd is where package.json is, and when
3 // the package.json is one level up.
4
5 var test = require("tap").test
6 var common = require("../common-tap.js")
7 var path = require("path")
8 var root = path.resolve(__dirname, "../..")
9 var lib = path.resolve(root, "lib")
10 var commands = ["run", "version"]
11
12 commands.forEach(function (cmd) {
13   // Should get the same stdout and stderr each time
14   var stdout, stderr
15
16   test(cmd + " in root", function (t) {
17     common.npm([cmd], {cwd: root}, function (er, code, so, se) {
18       if (er) throw er
19       t.notOk(code, "npm " + cmd + " exited with code 0")
20       stdout = so
21       stderr = se
22       t.end()
23     })
24   })
25
26   test(cmd + " in lib", function (t) {
27     common.npm([cmd], {cwd: lib}, function (er, code, so, se) {
28       if (er) throw er
29       t.notOk(code, "npm " + cmd + " exited with code 0")
30       t.equal(so, stdout)
31       t.equal(se, stderr)
32       t.end()
33     })
34   })
35 })