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.
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"]
12 commands.forEach(function (cmd) {
13 // Should get the same stdout and stderr each time
16 test(cmd + " in root", function (t) {
17 common.npm([cmd], {cwd: root}, function (er, code, so, se) {
19 t.notOk(code, "npm " + cmd + " exited with code 0")
26 test(cmd + " in lib", function (t) {
27 common.npm([cmd], {cwd: lib}, function (er, code, so, se) {
29 t.notOk(code, "npm " + cmd + " exited with code 0")