diff options
author | Forrest L Norvell <forrest@npmjs.com> | 2014-10-04 06:17:00 +0400 |
---|---|---|
committer | Forrest L Norvell <forrest@npmjs.com> | 2014-10-04 06:26:00 +0400 |
commit | 6f1971c61a9c1a42e6a2cf73510627ee252a2b61 (patch) | |
tree | f79773eb4dcfa867dc6a7ea41b91521219b231c3 /test/tap | |
parent | 0ce6a3752fa9119298df15671254db6bc1d8e64c (diff) |
spacing cleanup
Diffstat (limited to 'test/tap')
35 files changed, 204 insertions, 190 deletions
diff --git a/test/tap/00-check-mock-dep.js b/test/tap/00-check-mock-dep.js index 58932e508..1c862317c 100644 --- a/test/tap/00-check-mock-dep.js +++ b/test/tap/00-check-mock-dep.js @@ -1,6 +1,6 @@ console.log("TAP Version 13") -process.on("uncaughtException", function(er) { +process.on("uncaughtException", function (er) { if (er) { throw er } console.log("not ok - Failed checking mock registry dep. Expect much fail!") console.log("1..1") @@ -11,6 +11,7 @@ var assert = require("assert") var semver = require("semver") var mock = require("npm-registry-mock/package.json").version var req = require("../../package.json").devDependencies["npm-registry-mock"] + assert(semver.satisfies(mock, req)) console.log("ok") console.log("1..1") diff --git a/test/tap/00-verify-ls-ok.js b/test/tap/00-verify-ls-ok.js index a1f1ab347..aa6acdbc5 100644 --- a/test/tap/00-verify-ls-ok.js +++ b/test/tap/00-verify-ls-ok.js @@ -10,7 +10,7 @@ test("npm ls in npm", function (t) { t.notEqual(files.length, 0, "ensure there are files in the directory we are to ls") var opt = { cwd: cwd, stdio: [ "ignore", "ignore", 2 ] } - common.npm(["ls"], opt, function(err, code) { + common.npm(["ls"], opt, function (err, code) { t.ifError(err, "error should not exist") t.equal(code, 0, "npm ls exited with code") t.end() diff --git a/test/tap/404-parent.js b/test/tap/404-parent.js index 012beb3de..e40d850de 100644 --- a/test/tap/404-parent.js +++ b/test/tap/404-parent.js @@ -9,18 +9,17 @@ var mkdirp = require("mkdirp") var pkg = path.resolve(__dirname, "404-parent") var mr = require("npm-registry-mock") -test("404-parent: if parent exists, specify parent in error message", function(t) { +test("404-parent: if parent exists, specify parent in error message", function (t) { setup() rimraf.sync(path.resolve(pkg, "node_modules")) - performInstall(function(err) { - t.ok(err instanceof Error) - t.pass("error was returned") - t.ok(err.parent === "404-parent-test") + performInstall(function (err) { + t.ok(err instanceof Error, "error was returned") + t.ok(err.parent === "404-parent-test", "error's parent set") t.end() }) }) -test("cleanup", function(t) { +test("cleanup", function (t) { process.chdir(osenv.tmpdir()) rimraf.sync(pkg) t.end() @@ -43,8 +42,8 @@ function setup() { function performInstall(cb) { mr(common.port, function (s) { // create mock registry. - npm.load({registry: common.registry}, function() { - npm.commands.install(pkg, [], function(err) { + npm.load({registry: common.registry}, function () { + npm.commands.install(pkg, [], function (err) { cb(err) s.close() // shutdown mock npm server. }) diff --git a/test/tap/cache-shasum-fork.js b/test/tap/cache-shasum-fork.js index 6cddd7f57..b70b62aa1 100644 --- a/test/tap/cache-shasum-fork.js +++ b/test/tap/cache-shasum-fork.js @@ -13,7 +13,7 @@ var server // Test for https://github.com/npm/npm/issues/3265 -test("mock reg", function(t) { +test("mock reg", function (t) { rimraf.sync(cache) mkdirp.sync(cache) rimraf.sync(cwd) @@ -25,7 +25,7 @@ test("mock reg", function(t) { }) }) -test("npm cache - install from fork", function(t) { +test("npm cache - install from fork", function (t) { // Install from a tarball that thinks it is underscore@1.5.1 // (but is actually a fork) var forkPath = path.resolve( @@ -40,15 +40,15 @@ test("npm cache - install from fork", function(t) { } }) - child.stderr.on("data", function(d) { + child.stderr.on("data", function (d) { t.fail("Should not get data on stderr: " + d) }) - child.stdout.on("data", function(d) { + child.stdout.on("data", function (d) { output += d.toString() }) - child.on("close", function(code) { + child.on("close", function (code) { t.equal(code, 0, "exit ok") t.equal(output, "underscore@1.5.1 node_modules/underscore\n") var index = fs.readFileSync( @@ -60,7 +60,7 @@ test("npm cache - install from fork", function(t) { }) }) -test("npm cache - install from origin", function(t) { +test("npm cache - install from origin", function (t) { // Now install the real 1.5.1. rimraf.sync(path.join(cwd, "node_modules")) mkdirp.sync(path.join(cwd, "node_modules")) @@ -74,15 +74,15 @@ test("npm cache - install from origin", function(t) { } }) - child.stderr.on("data", function(d) { + child.stderr.on("data", function (d) { t.fail("Should not get data on stderr: " + d) }) - child.stdout.on("data", function(d) { + child.stdout.on("data", function (d) { output += d.toString() }) - child.on("close", function(code) { + child.on("close", function (code) { t.equal(code, 0, "exit ok") t.equal(output, "underscore@1.5.1 node_modules/underscore\n") var index = fs.readFileSync( @@ -94,7 +94,7 @@ test("npm cache - install from origin", function(t) { }) }) -test("cleanup", function(t) { +test("cleanup", function (t) { server.close() rimraf.sync(cache) rimraf.sync(cwd) diff --git a/test/tap/cache-shasum.js b/test/tap/cache-shasum.js index 7450d3e60..c7784ecff 100644 --- a/test/tap/cache-shasum.js +++ b/test/tap/cache-shasum.js @@ -10,7 +10,7 @@ var spawn = require("child_process").spawn var sha = require("sha") var server -test("mock reg", function(t) { +test("mock reg", function (t) { rimraf.sync(cache) mkdirp.sync(cache) mr(common.port, function (s) { @@ -20,7 +20,7 @@ test("mock reg", function(t) { }) }) -test("npm cache add request", function(t) { +test("npm cache add request", function (t) { var c = spawn(process.execPath, [ npm, "cache", "add", "request@2.27.0", "--cache=" + cache, @@ -29,17 +29,17 @@ test("npm cache add request", function(t) { ]) c.stderr.pipe(process.stderr) - c.stdout.on("data", function(d) { + c.stdout.on("data", function (d) { t.fail("Should not get data on stdout: " + d) }) - c.on("close", function(code) { + c.on("close", function (code) { t.notOk(code, "exit ok") t.end() }) }) -test("compare", function(t) { +test("compare", function (t) { var d = path.resolve(__dirname, "cache-shasum/request") var p = path.resolve(d, "2.27.0/package.tgz") var r = require("./cache-shasum/localhost_1337/request/.cache.json") @@ -52,7 +52,7 @@ test("compare", function(t) { }) }) -test("cleanup", function(t) { +test("cleanup", function (t) { server.close() rimraf.sync(cache) t.end() diff --git a/test/tap/circular-dep.js b/test/tap/circular-dep.js index 533f46451..60487dd38 100644 --- a/test/tap/circular-dep.js +++ b/test/tap/circular-dep.js @@ -17,12 +17,12 @@ test("installing a package that depends on the current package", function (t) { setup(function () { npm.install("optimist", function (err) { if (err) return t.fail(err) - npm.dedupe(function(err) { + npm.dedupe(function (err) { if (err) return t.fail(err) t.ok(existsSync(path.resolve(pkg, "minimist", "node_modules", "optimist", "node_modules", "minimist" - ))) + )), "circular dependency uncircled") cleanup() server.close() }) diff --git a/test/tap/config-meta.js b/test/tap/config-meta.js index 85768e876..ddbd6bc6f 100644 --- a/test/tap/config-meta.js +++ b/test/tap/config-meta.js @@ -110,14 +110,14 @@ test("check configs", function (t) { } } - types.forEach(function(c) { + types.forEach(function (c) { if (!c.match(/^\_/) && c !== "argv" && !c.match(/^versions?$/)) { t.ok(DOC[c], "defined type should be documented " + c) t.ok(CONFS[c], "defined type should be used " + c) } }) - defaults.forEach(function(c) { + defaults.forEach(function (c) { if (!c.match(/^\_/) && c !== "argv" && !c.match(/^versions?$/)) { t.ok(DOC[c], "defaulted type should be documented " + c) t.ok(CONFS[c], "defaulted type should be used " + c) diff --git a/test/tap/dedupe.js b/test/tap/dedupe.js index 3572cda99..c0a648e73 100644 --- a/test/tap/dedupe.js +++ b/test/tap/dedupe.js @@ -10,10 +10,16 @@ var EXEC_OPTS = {} test("dedupe finds the common module and moves it up one level", function (t) { setup(function (s) { - common.npm(["install", ".", "--registry", common.registry], EXEC_OPTS, function(err, code) { + common.npm( + [ + "install", ".", + "--registry", common.registry + ], + EXEC_OPTS, + function (err, code) { t.ifError(err, "successfully installed directory") t.equal(code, 0, "npm install exited with code") - common.npm(["dedupe"], {}, function(err, code) { + common.npm(["dedupe"], {}, function (err, code) { t.ifError(err, "successfully deduped against previous install") t.notOk(code, "npm dedupe exited with code") t.ok(existsSync(path.join(__dirname, "dedupe", "node_modules", "minimist"))) diff --git a/test/tap/git-cache-no-hooks.js b/test/tap/git-cache-no-hooks.js index 2ae3144d6..32731fa1b 100644 --- a/test/tap/git-cache-no-hooks.js +++ b/test/tap/git-cache-no-hooks.js @@ -57,7 +57,7 @@ test("git-cache-no-hooks: install a git dependency", function (t) { }) }) -test("cleanup", function(t) { +test("cleanup", function (t) { rimraf.sync(pkg) t.end() }) diff --git a/test/tap/ignore-scripts.js b/test/tap/ignore-scripts.js index d248d764b..9526443e9 100644 --- a/test/tap/ignore-scripts.js +++ b/test/tap/ignore-scripts.js @@ -7,16 +7,16 @@ var path = require("path") // which should also fail. var pkg = path.resolve(__dirname, "ignore-scripts") -test("ignore-scripts: install using the option", function(t) { - createChild(["install", "--ignore-scripts"], function(err, code) { +test("ignore-scripts: install using the option", function (t) { + createChild(["install", "--ignore-scripts"], function (err, code) { t.ifError(err, "install with scripts ignored finished successfully") t.equal(code, 0, "npm install exited with code") t.end() }) }) -test("ignore-scripts: install NOT using the option", function(t) { - createChild(["install"], function(err, code) { +test("ignore-scripts: install NOT using the option", function (t) { + createChild(["install"], function (err, code) { t.ifError(err, "install with scripts successful") t.notEqual(code, 0, "npm install exited with code") t.end() @@ -34,9 +34,9 @@ var scripts = [ "prerestart", "restart", "postrestart" ] -scripts.forEach(function(script) { - test("ignore-scripts: run-script "+script+" using the option", function(t) { - createChild(["--ignore-scripts", "run-script", script], function(err, code) { +scripts.forEach(function (script) { + test("ignore-scripts: run-script "+script+" using the option", function (t) { + createChild(["--ignore-scripts", "run-script", script], function (err, code) { t.ifError(err, "run-script " + script + " with ignore-scripts successful") t.equal(code, 0, "npm run-script exited with code") t.end() @@ -44,9 +44,9 @@ scripts.forEach(function(script) { }) }) -scripts.forEach(function(script) { - test("ignore-scripts: run-script "+script+" NOT using the option", function(t) { - createChild(["run-script", script], function(err, code) { +scripts.forEach(function (script) { + test("ignore-scripts: run-script "+script+" NOT using the option", function (t) { + createChild(["run-script", script], function (err, code) { t.ifError(err, "run-script " + script + " finished successfully") t.notEqual(code, 0, "npm run-script exited with code") t.end() diff --git a/test/tap/ignore-shrinkwrap.js b/test/tap/ignore-shrinkwrap.js index ccc335beb..6744a868a 100644 --- a/test/tap/ignore-shrinkwrap.js +++ b/test/tap/ignore-shrinkwrap.js @@ -72,5 +72,4 @@ function createChild (ignoreShrinkwrap) { PATH: process.env.PATH } }) - } diff --git a/test/tap/install-cli-unicode.js b/test/tap/install-cli-unicode.js index 8ee6a2f6a..7318deffc 100644 --- a/test/tap/install-cli-unicode.js +++ b/test/tap/install-cli-unicode.js @@ -16,7 +16,7 @@ var EXEC_OPTS = { test("does not use unicode with --unicode false", function (t) { t.plan(5) mr(common.port, function (s) { - common.npm(["install", "--unicode", "false", "read"], EXEC_OPTS, function(err, code, stdout) { + common.npm(["install", "--unicode", "false", "read"], EXEC_OPTS, function (err, code, stdout) { t.ifError(err, "install package read without unicode success") t.notOk(code, "npm install exited with code 0") t.ifError(err) @@ -29,7 +29,7 @@ test("does not use unicode with --unicode false", function (t) { test("cleanup", function (t) { mr(common.port, function (s) { - common.npm(["uninstall", "read"], EXEC_OPTS, function(err, code) { + common.npm(["uninstall", "read"], EXEC_OPTS, function (err, code) { t.ifError(err, "uninstall read package success") t.notOk(code, "npm uninstall exited with code 0") s.close() diff --git a/test/tap/install-save-exact.js b/test/tap/install-save-exact.js index daad03f09..ef785f240 100644 --- a/test/tap/install-save-exact.js +++ b/test/tap/install-save-exact.js @@ -15,17 +15,17 @@ test("setup", function (t) { t.end() }) -test("\"npm install --save --save-exact\" should install local pkg", function(t) { +test("\"npm install --save --save-exact\" should install local pkg", function (t) { resetPackageJSON(pkg) mr(common.port, function (s) { npm.load({ cache: pkg + "/cache", loglevel: "silent", - registry: common.registry }, function(err) { + registry: common.registry }, function (err) { t.ifError(err) npm.config.set("save", true) npm.config.set("save-exact", true) - npm.commands.install(["underscore@1.3.1"], function(err) { + npm.commands.install(["underscore@1.3.1"], function (err) { t.ifError(err) var p = path.resolve(pkg, "node_modules/underscore/package.json") t.ok(JSON.parse(fs.readFileSync(p))) @@ -43,18 +43,18 @@ test("\"npm install --save --save-exact\" should install local pkg", function(t) }) }) -test("\"npm install --save-dev --save-exact\" should install local pkg", function(t) { +test("\"npm install --save-dev --save-exact\" should install local pkg", function (t) { resetPackageJSON(pkg) mr(common.port, function (s) { npm.load({ cache: pkg + "/cache", loglevel: "silent", - registry: common.registry }, function(err) { + registry: common.registry }, function (err) { t.ifError(err) npm.config.set("save-dev", true) npm.config.set("save-exact", true) - npm.commands.install(["underscore@1.3.1"], function(err) { + npm.commands.install(["underscore@1.3.1"], function (err) { t.ifError(err) var p = path.resolve(pkg, "node_modules/underscore/package.json") t.ok(JSON.parse(fs.readFileSync(p))) @@ -73,7 +73,7 @@ test("\"npm install --save-dev --save-exact\" should install local pkg", functio }) }) -test("cleanup", function(t) { +test("cleanup", function (t) { process.chdir(__dirname) rimraf.sync(path.resolve(pkg, "node_modules")) rimraf.sync(path.resolve(pkg, "cache")) diff --git a/test/tap/install-save-local.js b/test/tap/install-save-local.js index 7f6cea2f5..2a1f83998 100644 --- a/test/tap/install-save-local.js +++ b/test/tap/install-save-local.js @@ -12,9 +12,10 @@ test("setup", function (t) { process.chdir(pkg) t.end() }) -test('"npm install --save ../local/path" should install local package and save to package.json', function(t) { + +test('"npm install --save ../local/path" should install local package and save to package.json', function (t) { resetPackageJSON(pkg) - common.npm(["install", "--save", "../package-local-dependency"], EXEC_OPTS, function(err, code) { + common.npm(["install", "--save", "../package-local-dependency"], EXEC_OPTS, function (err, code) { t.ifError(err) t.notOk(code, "npm install exited with code 0") @@ -29,9 +30,9 @@ test('"npm install --save ../local/path" should install local package and save t }) }) -test('"npm install --save-dev ../local/path" should install local package and save to package.json', function(t) { +test('"npm install --save-dev ../local/path" should install local package and save to package.json', function (t) { resetPackageJSON(pkg) - common.npm(["install", "--save-dev", "../package-local-dev-dependency"], EXEC_OPTS, function(err, code) { + common.npm(["install", "--save-dev", "../package-local-dev-dependency"], EXEC_OPTS, function (err, code) { t.ifError(err) t.notOk(code, "npm install exited with code 0") @@ -48,7 +49,7 @@ test('"npm install --save-dev ../local/path" should install local package and sa }) -test("cleanup", function(t) { +test("cleanup", function (t) { resetPackageJSON(pkg) process.chdir(__dirname) rimraf.sync(path.resolve(pkg, "node_modules")) diff --git a/test/tap/install-save-prefix.js b/test/tap/install-save-prefix.js index 507c7e76b..d4efef4b6 100644 --- a/test/tap/install-save-prefix.js +++ b/test/tap/install-save-prefix.js @@ -15,17 +15,17 @@ test("setup", function (t) { t.end() }) -test("npm install --save with default save-prefix should install local pkg versioned to allow minor updates", function(t) { +test("npm install --save with default save-prefix should install local pkg versioned to allow minor updates", function (t) { resetPackageJSON(pkg) mr(common.port, function (s) { npm.load({ cache: pkg + "/cache", loglevel: "silent", "save-prefix": "^", - registry: common.registry }, function(err) { + registry: common.registry }, function (err) { t.ifError(err) npm.config.set("save", true) - npm.commands.install(["underscore@latest"], function(err) { + npm.commands.install(["underscore@latest"], function (err) { t.ifError(err) var p = path.resolve(pkg, "node_modules/underscore/package.json") t.ok(JSON.parse(fs.readFileSync(p))) @@ -41,17 +41,17 @@ test("npm install --save with default save-prefix should install local pkg versi }) }) -test("npm install --save-dev with default save-prefix should install local pkg to dev dependencies versioned to allow minor updates", function(t) { +test("npm install --save-dev with default save-prefix should install local pkg to dev dependencies versioned to allow minor updates", function (t) { resetPackageJSON(pkg) mr(common.port, function (s) { npm.load({ cache: pkg + "/cache", loglevel: "silent", "save-prefix": "^", - registry: common.registry }, function(err) { + registry: common.registry }, function (err) { t.ifError(err) npm.config.set("save-dev", true) - npm.commands.install(["underscore@1.3.1"], function(err) { + npm.commands.install(["underscore@1.3.1"], function (err) { t.ifError(err) var p = path.resolve(pkg, "node_modules/underscore/package.json") t.ok(JSON.parse(fs.readFileSync(p))) @@ -67,17 +67,17 @@ test("npm install --save-dev with default save-prefix should install local pkg t }) }) -test("npm install --save with \"~\" save-prefix should install local pkg versioned to allow patch updates", function(t) { +test("npm install --save with \"~\" save-prefix should install local pkg versioned to allow patch updates", function (t) { resetPackageJSON(pkg) mr(common.port, function (s) { npm.load({ cache: pkg + "/cache", loglevel: "silent", - registry: common.registry }, function(err) { + registry: common.registry }, function (err) { t.ifError(err) npm.config.set("save", true) npm.config.set("save-prefix", "~") - npm.commands.install(["underscore@1.3.1"], function(err) { + npm.commands.install(["underscore@1.3.1"], function (err) { t.ifError(err) var p = path.resolve(pkg, "node_modules/underscore/package.json") t.ok(JSON.parse(fs.readFileSync(p))) @@ -94,17 +94,17 @@ test("npm install --save with \"~\" save-prefix should install local pkg version }) }) -test("npm install --save-dev with \"~\" save-prefix should install local pkg to dev dependencies versioned to allow patch updates", function(t) { +test("npm install --save-dev with \"~\" save-prefix should install local pkg to dev dependencies versioned to allow patch updates", function (t) { resetPackageJSON(pkg) mr(common.port, function (s) { npm.load({ cache: pkg + "/cache", loglevel: "silent", - registry: common.registry }, function(err) { + registry: common.registry }, function (err) { t.ifError(err) npm.config.set("save-dev", true) npm.config.set("save-prefix", "~") - npm.commands.install(["underscore@1.3.1"], function(err) { + npm.commands.install(["underscore@1.3.1"], function (err) { t.ifError(err) var p = path.resolve(pkg, "node_modules/underscore/package.json") t.ok(JSON.parse(fs.readFileSync(p))) @@ -121,7 +121,7 @@ test("npm install --save-dev with \"~\" save-prefix should install local pkg to }) }) -test("cleanup", function(t) { +test("cleanup", function (t) { process.chdir(__dirname) rimraf.sync(path.resolve(pkg, "node_modules")) rimraf.sync(path.resolve(pkg, "cache")) diff --git a/test/tap/install-scoped-already-installed.js b/test/tap/install-scoped-already-installed.js index 5b5cdb4f0..a355a4a50 100644 --- a/test/tap/install-scoped-already-installed.js +++ b/test/tap/install-scoped-already-installed.js @@ -22,7 +22,7 @@ test("setup", function (t) { }) test("installing already installed local scoped package", function (t) { - common.npm(["install", "--loglevel", "silent"], EXEC_OPTS, function(err, code, stdout) { + common.npm(["install", "--loglevel", "silent"], EXEC_OPTS, function (err, code, stdout) { var installed = parseNpmInstallOutput(stdout) t.ifError(err, "error should not exist") t.notOk(code, "npm install exited with code 0") @@ -31,10 +31,16 @@ test("installing already installed local scoped package", function (t) { existsSync(join(modules, "@scoped", "package", "package.json")), "package installed" ) - t.ok(contains(installed, "node_modules/@scoped/package"), "installed @scoped/package") - t.ok(contains(installed, "node_modules/package-local-dependency"), "installed package-local-dependency") + t.ok( + contains(installed, "node_modules/@scoped/package"), + "installed @scoped/package" + ) + t.ok( + contains(installed, "node_modules/package-local-dependency"), + "installed package-local-dependency" + ) - common.npm(["install", "--loglevel", "silent"], EXEC_OPTS, function(err, code, stdout) { + common.npm(["install", "--loglevel", "silent"], EXEC_OPTS, function (err, code, stdout) { installed = parseNpmInstallOutput(stdout) t.ifError(err, "error should not exist") t.notOk(code, "npm install exited with code 0") @@ -46,14 +52,20 @@ test("installing already installed local scoped package", function (t) { "package installed" ) - t.notOk(contains(installed, "node_modules/@scoped/package"), "did not reinstall @scoped/package") - t.notOk(contains(installed, "node_modules/package-local-dependency"), "did not reinstall package-local-dependency") + t.notOk( + contains(installed, "node_modules/@scoped/package"), + "did not reinstall @scoped/package" + ) + t.notOk( + contains(installed, "node_modules/package-local-dependency"), + "did not reinstall package-local-dependency" + ) t.end() }) }) }) -test("cleanup", function(t) { +test("cleanup", function (t) { process.chdir(__dirname) rimraf.sync(join(modules)) rimraf.sync(join(pkg, "cache")) diff --git a/test/tap/install-scoped-link.js b/test/tap/install-scoped-link.js index d42fbb7a2..b1e6ca0b2 100644 --- a/test/tap/install-scoped-link.js +++ b/test/tap/install-scoped-link.js @@ -1,7 +1,6 @@ var common = require("../common-tap.js") var existsSync = require("fs").existsSync var join = require("path").join -// var resolve = require("path").resolve var exec = require("child_process").exec var test = require("tap").test @@ -22,7 +21,7 @@ test("setup", function (t) { }) test("installing package with links", function (t) { - common.npm(["install", pkg], EXEC_OPTS, function(err, code) { + common.npm(["install", pkg], EXEC_OPTS, function (err, code) { t.ifError(err, "install ran to completion without error") t.notOk(code, "npm install exited with code 0") @@ -45,7 +44,7 @@ test("installing package with links", function (t) { }) }) -test("cleanup", function(t) { +test("cleanup", function (t) { process.chdir(__dirname) rimraf.sync(work) t.end() diff --git a/test/tap/invalid-cmd-exit-code.js b/test/tap/invalid-cmd-exit-code.js index e9458176d..c9918e5a7 100644 --- a/test/tap/invalid-cmd-exit-code.js +++ b/test/tap/invalid-cmd-exit-code.js @@ -3,7 +3,7 @@ var common = require("../common-tap.js") var opts = { cwd: process.cwd() } -test("npm asdf should return exit code 1", function(t) { +test("npm asdf should return exit code 1", function (t) { common.npm(["asdf"], opts, function (er, c) { if (er) throw er t.ok(c, "exit code should not be zero") @@ -11,7 +11,7 @@ test("npm asdf should return exit code 1", function(t) { }) }) -test("npm help should return exit code 0", function(t) { +test("npm help should return exit code 0", function (t) { common.npm(["help"], opts, function (er, c) { if (er) throw er t.equal(c, 0, "exit code should be 0") @@ -19,7 +19,7 @@ test("npm help should return exit code 0", function(t) { }) }) -test("npm help fadf should return exit code 0", function(t) { +test("npm help fadf should return exit code 0", function (t) { common.npm(["help", "fadf"], opts, function (er, c) { if (er) throw er t.equal(c, 0, "exit code should be 0") diff --git a/test/tap/lifecycle.js b/test/tap/lifecycle.js index ba2ac9d88..aa0efc526 100644 --- a/test/tap/lifecycle.js +++ b/test/tap/lifecycle.js @@ -3,7 +3,7 @@ var npm = require("../../") var lifecycle = require("../../lib/utils/lifecycle") test("lifecycle: make env correctly", function (t) { - npm.load({enteente: Infinity}, function() { + npm.load({enteente: Infinity}, function () { var env = lifecycle.makeEnv({}, null, process.env) t.equal("Infinity", env.npm_config_enteente) diff --git a/test/tap/login-always-auth.js b/test/tap/login-always-auth.js index 5936bd634..8311096c2 100644 --- a/test/tap/login-always-auth.js +++ b/test/tap/login-always-auth.js @@ -9,9 +9,9 @@ var common = require("../common-tap.js") var opts = {cwd : __dirname} var outfile = path.resolve(__dirname, "_npmrc") var responses = { - "Username": "u\n", - "Password": "p\n", - "Email": "u@p.me\n" + "Username" : "u\n", + "Password" : "p\n", + "Email" : "u@p.me\n" } function mocks(server) { @@ -29,15 +29,12 @@ test("npm login", function (t) { var runner = common.npm( [ "login", - "--registry", - common.registry, - "--loglevel", - "silent", - "--userconfig", - outfile + "--registry", common.registry, + "--loglevel", "silent", + "--userconfig", outfile ], opts, - function(err, code) { + function (err, code) { t.notOk(code, "exited OK") t.notOk(err, "no error output") var config = fs.readFileSync(outfile, "utf8") @@ -47,7 +44,6 @@ test("npm login", function (t) { t.ifError(err, "removed config file OK") t.end() }) - }) var o = "", e = "", remaining = Object.keys(responses).length @@ -69,16 +65,13 @@ test("npm login --always-auth", function (t) { var runner = common.npm( [ "login", - "--registry", - common.registry, - "--loglevel", - "silent", - "--userconfig", - outfile, + "--registry", common.registry, + "--loglevel", "silent", + "--userconfig", outfile, "--always-auth" ], opts, - function(err, code) { + function (err, code) { t.notOk(code, "exited OK") t.notOk(err, "no error output") var config = fs.readFileSync(outfile, "utf8") @@ -109,16 +102,13 @@ test("npm login --no-always-auth", function (t) { var runner = common.npm( [ "login", - "--registry", - common.registry, - "--loglevel", - "silent", - "--userconfig", - outfile, + "--registry", common.registry, + "--loglevel", "silent", + "--userconfig", outfile, "--no-always-auth" ], opts, - function(err, code) { + function (err, code) { t.notOk(code, "exited OK") t.notOk(err, "no error output") var config = fs.readFileSync(outfile, "utf8") diff --git a/test/tap/outdated-color.js b/test/tap/outdated-color.js index 787525edf..4e90277fe 100644 --- a/test/tap/outdated-color.js +++ b/test/tap/outdated-color.js @@ -29,7 +29,14 @@ function ansiTrim (str) { test("does not use ansi styling", function (t) { t.plan(4) mr(common.port, function (s) { // create mock registry. - common.npm(["outdated", "--registry", common.registry, "underscore"], EXEC_OPTS, function(err, code, stdout) { + common.npm( + [ + "outdated", + "--registry", common.registry, + "underscore" + ], + EXEC_OPTS, + function (err, code, stdout) { t.ifError(err) t.notOk(code, "npm outdated exited with code 0") t.ok(stdout, stdout.length) diff --git a/test/tap/outdated-notarget.js b/test/tap/outdated-notarget.js index 782f6f7d5..f1032eab3 100644 --- a/test/tap/outdated-notarget.js +++ b/test/tap/outdated-notarget.js @@ -11,12 +11,12 @@ var pkg = path.resolve(__dirname, "outdated-notarget") var cache = path.resolve(pkg, "cache") var mr = require("npm-registry-mock") -test("outdated-target: if no viable version is found, show error", function(t) { +test("outdated-target: if no viable version is found, show error", function (t) { t.plan(1) setup() - mr({port: common.port}, function(s) { - npm.load({ cache: cache, registry: common.registry}, function() { - npm.commands.update(function(er) { + mr({port: common.port}, function (s) { + npm.load({ cache: cache, registry: common.registry}, function () { + npm.commands.update(function (er) { t.equal(er.code, "ETARGET") s.close() t.end() @@ -25,7 +25,7 @@ test("outdated-target: if no viable version is found, show error", function(t) { }) }) -test("cleanup", function(t) { +test("cleanup", function (t) { process.chdir(osenv.tmpdir()) rimraf.sync(pkg) t.end() diff --git a/test/tap/prune.js b/test/tap/prune.js index 671fccee0..a7970dcc5 100644 --- a/test/tap/prune.js +++ b/test/tap/prune.js @@ -34,10 +34,10 @@ test("npm install", function (t) { "--loglevel=silent", "--production=false" ], { cwd: pkg, env: env }) - c.stderr.on("data", function(d) { + c.stderr.on("data", function (d) { t.fail("Should not get data on stderr: " + d) }) - c.on("close", function(code) { + c.on("close", function (code) { t.notOk(code, "exit ok") t.end() }) @@ -51,10 +51,10 @@ test("npm install test-package", function (t) { "--loglevel=silent", "--production=false" ], { cwd: pkg, env: env }) - c.stderr.on("data", function(d) { + c.stderr.on("data", function (d) { t.fail("Should not get data on stderr: " + d) }) - c.on("close", function(code) { + c.on("close", function (code) { t.notOk(code, "exit ok") t.end() }) @@ -72,10 +72,10 @@ test("npm prune", function (t) { "--loglevel=silent", "--production=false" ], { cwd: pkg, env: env }) - c.stderr.on("data", function(d) { + c.stderr.on("data", function (d) { t.fail("Should not get data on stderr: " + d) }) - c.on("close", function(code) { + c.on("close", function (code) { t.notOk(code, "exit ok") t.end() }) @@ -93,10 +93,10 @@ test("npm prune", function (t) { "--loglevel=silent", "--production" ], { cwd: pkg, env: env }) - c.stderr.on("data", function(d) { + c.stderr.on("data", function (d) { t.fail("Should not get data on stderr: " + d) }) - c.on("close", function(code) { + c.on("close", function (code) { t.notOk(code, "exit ok") t.end() }) diff --git a/test/tap/publish-config.js b/test/tap/publish-config.js index c19bc69c5..9e537a920 100644 --- a/test/tap/publish-config.js +++ b/test/tap/publish-config.js @@ -51,7 +51,7 @@ test(function (t) { PATH: process.env.PATH, USERPROFILE: osenv.home() } - }, function(err, code) { + }, function (err, code) { t.ifError(err, "publish command finished successfully") t.notOk(code, "npm install exited with code 0") }) diff --git a/test/tap/publish-scoped.js b/test/tap/publish-scoped.js index 0f50e07b6..2658c8dd2 100644 --- a/test/tap/publish-scoped.js +++ b/test/tap/publish-scoped.js @@ -91,7 +91,7 @@ test("npm publish should honor scoping", function (t) { } }) -test("cleanup", function(t) { +test("cleanup", function (t) { process.chdir(__dirname) rimraf(pkg, function (er) { t.ifError(er) diff --git a/test/tap/pwd-prefix.js b/test/tap/pwd-prefix.js index 66a30d552..237096e0a 100644 --- a/test/tap/pwd-prefix.js +++ b/test/tap/pwd-prefix.js @@ -14,7 +14,7 @@ commands.forEach(function (cmd) { var stdout, stderr test(cmd + " in root", function (t) { - common.npm([cmd], {cwd: root}, function(er, code, so, se) { + common.npm([cmd], {cwd: root}, function (er, code, so, se) { if (er) throw er t.notOk(code, "npm " + cmd + " exited with code 0") stdout = so @@ -24,7 +24,7 @@ commands.forEach(function (cmd) { }) test(cmd + " in lib", function (t) { - common.npm([cmd], {cwd: lib}, function(er, code, so, se) { + common.npm([cmd], {cwd: lib}, function (er, code, so, se) { if (er) throw er t.notOk(code, "npm " + cmd + " exited with code 0") t.equal(so, stdout) diff --git a/test/tap/registry.js b/test/tap/registry.js index 9dcdf8bfa..20e7bbe81 100644 --- a/test/tap/registry.js +++ b/test/tap/registry.js @@ -18,7 +18,7 @@ if (v[0] === 0 && v[1] < 10) { ) } else { - which("couchdb", function(er) { + which("couchdb", function (er) { if (er) { console.error("WARNING: need couch to run test: " + er.message) } @@ -38,7 +38,7 @@ function runTests () { cwd: ca, stdio: "inherit" } - common.npm(["install"], opts, function(err, code) { + common.npm(["install"], opts, function (err, code) { if (err) { throw err } if (code) { return test("need install to work", function (t) { @@ -52,10 +52,10 @@ function runTests () { env: env, stdio: "inherit" } - common.npm(["test"], opts, function(err, code) { + common.npm(["test"], opts, function (err, code) { if (err) { throw err } if (code) { - return test("need test to work", function(t) { + return test("need test to work", function (t) { t.fail("test failed with: " + code) t.end() }) @@ -65,7 +65,7 @@ function runTests () { env: env, stdio: "inherit" } - common.npm(["prune", "--production"], opts, function(err, code) { + common.npm(["prune", "--production"], opts, function (err, code) { if (err) { throw err } process.exit(code || 0) }) diff --git a/test/tap/repo.js b/test/tap/repo.js index bf7b574f8..caae7d3c3 100644 --- a/test/tap/repo.js +++ b/test/tap/repo.js @@ -33,7 +33,7 @@ test("npm repo underscore", function (t) { '--registry=' + common.registry, '--loglevel=silent', '--browser=' + __dirname + '/_script.sh' - ], opts, function(err, code, stdout, stderr) { + ], opts, function (err, code, stdout, stderr) { t.equal(code, 0, 'exit ok') var res = fs.readFileSync(outFile, 'ascii') s.close() @@ -52,7 +52,7 @@ test('npm repo optimist - github (https://)', function (t) { '--registry=' + common.registry, '--loglevel=silent', '--browser=' + __dirname + '/_script.sh' - ], opts, function(err, code, stdout, stderr) { + ], opts, function (err, code, stdout, stderr) { t.equal(code, 0, 'exit ok') var res = fs.readFileSync(outFile, 'ascii') s.close() @@ -70,7 +70,7 @@ test("npm repo npm-test-peer-deps - no repo", function (t) { '--registry=' + common.registry, '--loglevel=silent', '--browser=' + __dirname + '/_script.sh' - ], opts, function(err, code, stdout, stderr) { + ], opts, function (err, code, stdout, stderr) { t.equal(code, 1, 'exit not ok') s.close() t.end() @@ -85,7 +85,7 @@ test("npm repo test-repo-url-http - non-github (http://)", function (t) { '--registry=' + common.registry, '--loglevel=silent', '--browser=' + __dirname + '/_script.sh' - ], opts, function(err, code, stdout, stderr) { + ], opts, function (err, code, stdout, stderr) { t.equal(code, 0, 'exit ok') var res = fs.readFileSync(outFile, 'ascii') s.close() @@ -103,7 +103,7 @@ test("npm repo test-repo-url-https - non-github (https://)", function (t) { '--registry=' + common.registry, '--loglevel=silent', '--browser=' + __dirname + '/_script.sh' - ], opts, function(err, code, stdout, stderr) { + ], opts, function (err, code, stdout, stderr) { t.equal(code, 0, 'exit ok') var res = fs.readFileSync(outFile, 'ascii') s.close() @@ -121,7 +121,7 @@ test("npm repo test-repo-url-ssh - non-github (ssh://)", function (t) { '--registry=' + common.registry, '--loglevel=silent', '--browser=' + __dirname + '/_script.sh' - ], opts, function(err, code, stdout, stderr) { + ], opts, function (err, code, stdout, stderr) { t.equal(code, 0, 'exit ok') var res = fs.readFileSync(outFile, 'ascii') s.close() diff --git a/test/tap/run-script.js b/test/tap/run-script.js index 4ae43c36b..9ada58a70 100644 --- a/test/tap/run-script.js +++ b/test/tap/run-script.js @@ -41,15 +41,15 @@ test("npm run-script with args", function (t) { common.npm(["run-script", "start", "--", "stop"], opts, testOutput.bind(null, t, "stop")) }) -test("npm run-script with args that contain spaces", function(t) { +test("npm run-script with args that contain spaces", function (t) { common.npm(["run-script", "start", "--", "hello world"], opts, testOutput.bind(null, t, "hello world")) }) -test("npm run-script with args that contain single quotes", function(t) { +test("npm run-script with args that contain single quotes", function (t) { common.npm(["run-script", "start", "--", "they're awesome"], opts, testOutput.bind(null, t, "they're awesome")) }) -test("npm run-script with args that contain double quotes", function(t) { +test("npm run-script with args that contain double quotes", function (t) { common.npm(["run-script", "start", "--", "what's \"up\"?"], opts, testOutput.bind(null, t, "what's \"up\"?")) }) diff --git a/test/tap/scripts-whitespace-windows.js b/test/tap/scripts-whitespace-windows.js index c459f17b4..8c15ed37d 100644 --- a/test/tap/scripts-whitespace-windows.js +++ b/test/tap/scripts-whitespace-windows.js @@ -30,7 +30,7 @@ test("setup", function (t) { }) child.stdout.setEncoding("utf8") - child.stderr.on("data", function(chunk) { + child.stderr.on("data", function (chunk) { t.fail("got stderr data: " + JSON.stringify("" + chunk)) }) child.on("close", function () { @@ -46,7 +46,7 @@ test("test", function (t) { }) child.stdout.setEncoding("utf8") - child.stderr.on("data", function(chunk) { + child.stderr.on("data", function (chunk) { t.fail("got stderr data: " + JSON.stringify("" + chunk)) }) child.stdout.on("data", ondata) diff --git a/test/tap/semver-doc.js b/test/tap/semver-doc.js index de7dcd0dc..963cace10 100644 --- a/test/tap/semver-doc.js +++ b/test/tap/semver-doc.js @@ -1,6 +1,6 @@ var test = require("tap").test -test("semver doc is up to date", function(t) { +test("semver doc is up to date", function (t) { var path = require("path") var moddoc = path.join(__dirname, "../../node_modules/semver/README.md") var mydoc = path.join(__dirname, "../../doc/misc/semver.md") diff --git a/test/tap/url-dependencies.js b/test/tap/url-dependencies.js index 77b39723c..a77b3d380 100644 --- a/test/tap/url-dependencies.js +++ b/test/tap/url-dependencies.js @@ -12,10 +12,10 @@ var mockRoutes = { } } -test("url-dependencies: download first time", function(t) { +test("url-dependencies: download first time", function (t) { cleanup() - performInstall(t, function(output){ + performInstall(t, function (output){ if (!tarballWasFetched(output)){ t.fail("Tarball was not fetched") } else { @@ -25,11 +25,11 @@ test("url-dependencies: download first time", function(t) { }) }) -test("url-dependencies: do not download subsequent times", function(t) { +test("url-dependencies: do not download subsequent times", function (t) { cleanup() - performInstall(t, function(){ - performInstall(t, function(output){ + performInstall(t, function () { + performInstall(t, function (output) { if (tarballWasFetched(output)){ t.fail("Tarball was fetched second time around") } else { @@ -45,7 +45,7 @@ function tarballWasFetched(output){ } function performInstall (t, cb) { - mr({port: common.port, mocks: mockRoutes}, function(s){ + mr({port: common.port, mocks: mockRoutes}, function (s) { var opts = { cwd : pkg, env: { @@ -58,7 +58,7 @@ function performInstall (t, cb) { PATH: process.env.PATH } } - common.npm(["install"], opts, function(err, code, stdout, stderr) { + common.npm(["install"], opts, function (err, code, stdout, stderr) { t.ifError(err, "install success") t.notOk(code, "npm install exited with code 0") s.close() diff --git a/test/tap/version-no-tags.js b/test/tap/version-no-tags.js index 45a322752..cb6f195f8 100644 --- a/test/tap/version-no-tags.js +++ b/test/tap/version-no-tags.js @@ -15,30 +15,30 @@ var cache = path.resolve(pkg, "cache") test("npm version <semver> without git tag", function (t) { setup() npm.load({ cache: cache, registry: common.registry}, function () { - which("git", function(err, git) { + which("git", function (err, git) { t.ifError(err, "git found on system") function tagExists(tag, _cb) { var child1 = spawn(git, ["tag", "-l", tag]) var out = "" - child1.stdout.on("data", function(d) { + child1.stdout.on("data", function (d) { out += d.toString() }) - child1.on("exit", function() { + child1.on("exit", function () { return _cb(null, Boolean(~out.indexOf(tag))) }) } var child2 = spawn(git, ["init"]) child2.stdout.pipe(process.stdout) - child2.on("exit", function() { + child2.on("exit", function () { npm.config.set("git-tag-version", false) - npm.commands.version(["patch"], function(err) { + npm.commands.version(["patch"], function (err) { if (err) return t.fail("Error perform version patch") var p = path.resolve(pkg, "package") var testPkg = require(p) if (testPkg.version !== "0.0.1") t.fail(testPkg.version+" !== \"0.0.1\"") t.equal("0.0.1", testPkg.version) - tagExists("v0.0.1", function(err, exists) { + tagExists("v0.0.1", function (err, exists) { t.ifError(err, "tag found to exist") t.equal(exists, false, "git tag DOES exist") t.pass("git tag does not exist") @@ -50,7 +50,7 @@ test("npm version <semver> without git tag", function (t) { }) }) -test("cleanup", function(t) { +test("cleanup", function (t) { // windows fix for locked files process.chdir(osenv.tmpdir()) diff --git a/test/tap/view.js b/test/tap/view.js index 4b9f2411e..8d4cbb646 100644 --- a/test/tap/view.js +++ b/test/tap/view.js @@ -11,7 +11,7 @@ var t2dir = path.resolve(tmp, "view-local-notmine") var t3dir = path.resolve(tmp, "view-local-mine") var mr = require("npm-registry-mock") -test("setup", function(t) { +test("setup", function (t) { mkdirp.sync(t1dir) mkdirp.sync(t2dir) mkdirp.sync(t3dir) @@ -32,14 +32,14 @@ test("setup", function(t) { t.end() }) -test("npm view . in global mode", function(t) { +test("npm view . in global mode", function (t) { process.chdir(t1dir) common.npm([ "view" , "." , "--registry=" + common.registry , "--global" - ], { cwd: t1dir }, function(err, code, stdout, stderr) { + ], { cwd: t1dir }, function (err, code, stdout, stderr) { t.ifError(err, "view command finished successfully") t.equal(code, 1, "exit not ok") t.similar(stderr, /Cannot use view command in global mode./m) @@ -47,13 +47,13 @@ test("npm view . in global mode", function(t) { }) }) -test("npm view . with no package.json", function(t) { +test("npm view . with no package.json", function (t) { process.chdir(t1dir) common.npm([ "view" , "." , "--registry=" + common.registry - ], { cwd: t1dir }, function(err, code, stdout, stderr) { + ], { cwd: t1dir }, function (err, code, stdout, stderr) { t.ifError(err, "view command finished successfully") t.equal(code, 1, "exit not ok") t.similar(stderr, /Invalid package.json/m) @@ -61,14 +61,14 @@ test("npm view . with no package.json", function(t) { }) }) -test("npm view . with no published package", function(t) { +test("npm view . with no published package", function (t) { process.chdir(t3dir) - mr(common.port, function(s) { + mr(common.port, function (s) { common.npm([ "view" , "." , "--registry=" + common.registry - ], { cwd: t3dir }, function(err, code, stdout, stderr) { + ], { cwd: t3dir }, function (err, code, stdout, stderr) { t.ifError(err, "view command finished successfully") t.equal(code, 1, "exit not ok") t.similar(stderr, /version not found/m) @@ -78,14 +78,14 @@ test("npm view . with no published package", function(t) { }) }) -test("npm view .", function(t) { +test("npm view .", function (t) { process.chdir(t2dir) - mr(common.port, function(s) { + mr(common.port, function (s) { common.npm([ "view" , "." , "--registry=" + common.registry - ], { cwd: t2dir }, function(err, code, stdout) { + ], { cwd: t2dir }, function (err, code, stdout) { t.ifError(err, "view command finished successfully") t.equal(code, 0, "exit ok") var re = new RegExp("name: 'test-repo-url-https'") @@ -96,15 +96,15 @@ test("npm view .", function(t) { }) }) -test("npm view . select fields", function(t) { +test("npm view . select fields", function (t) { process.chdir(t2dir) - mr(common.port, function(s) { + mr(common.port, function (s) { common.npm([ "view" , "." , "main" , "--registry=" + common.registry - ], { cwd: t2dir }, function(err, code, stdout) { + ], { cwd: t2dir }, function (err, code, stdout) { t.ifError(err, "view command finished successfully") t.equal(code, 0, "exit ok") t.equal(stdout.trim(), "index.js", "should print `index.js`") @@ -114,15 +114,15 @@ test("npm view . select fields", function(t) { }) }) -test("npm view .@<version>", function(t) { +test("npm view .@<version>", function (t) { process.chdir(t2dir) - mr(common.port, function(s) { + mr(common.port, function (s) { common.npm([ "view" , ".@0.0.0" , "version" , "--registry=" + common.registry - ], { cwd: t2dir }, function(err, code, stdout) { + ], { cwd: t2dir }, function (err, code, stdout) { t.ifError(err, "view command finished successfully") t.equal(code, 0, "exit ok") t.equal(stdout.trim(), "0.0.0", "should print `0.0.0`") @@ -132,16 +132,16 @@ test("npm view .@<version>", function(t) { }) }) -test("npm view .@<version> --json", function(t) { +test("npm view .@<version> --json", function (t) { process.chdir(t2dir) - mr(common.port, function(s) { + mr(common.port, function (s) { common.npm([ "view" , ".@0.0.0" , "version" , "--json" , "--registry=" + common.registry - ], { cwd: t2dir }, function(err, code, stdout) { + ], { cwd: t2dir }, function (err, code, stdout) { t.ifError(err, "view command finished successfully") t.equal(code, 0, "exit ok") t.equal(stdout.trim(), "\"0.0.0\"", "should print `\"0.0.0\"`") @@ -151,13 +151,13 @@ test("npm view .@<version> --json", function(t) { }) }) -test("npm view <package name>", function(t) { - mr(common.port, function(s) { +test("npm view <package name>", function (t) { + mr(common.port, function (s) { common.npm([ "view" , "underscore" , "--registry=" + common.registry - ], { cwd: t2dir }, function(err, code, stdout) { + ], { cwd: t2dir }, function (err, code, stdout) { t.ifError(err, "view command finished successfully") t.equal(code, 0, "exit ok") var re = new RegExp("name: 'underscore'") @@ -168,15 +168,15 @@ test("npm view <package name>", function(t) { }) }) -test("npm view <package name> --json", function(t) { +test("npm view <package name> --json", function (t) { t.plan(3) - mr(common.port, function(s) { + mr(common.port, function (s) { common.npm([ "view" , "underscore" , "--json" , "--registry=" + common.registry - ], { cwd: t2dir }, function(err, code, stdout) { + ], { cwd: t2dir }, function (err, code, stdout) { t.ifError(err, "view command finished successfully") t.equal(code, 0, "exit ok") s.close() @@ -193,14 +193,14 @@ test("npm view <package name> --json", function(t) { }) }) -test("npm view <package name> <field>", function(t) { - mr(common.port, function(s) { +test("npm view <package name> <field>", function (t) { + mr(common.port, function (s) { common.npm([ "view" , "underscore" , "homepage" , "--registry=" + common.registry - ], { cwd: t2dir }, function(err, code, stdout) { + ], { cwd: t2dir }, function (err, code, stdout) { t.ifError(err, "view command finished successfully") t.equal(code, 0, "exit ok") t.equal(stdout.trim(), "http://underscorejs.org", @@ -211,7 +211,7 @@ test("npm view <package name> <field>", function(t) { }) }) -test("cleanup", function(t) { +test("cleanup", function (t) { process.chdir(osenv.tmpdir()) rimraf.sync(t1dir) rimraf.sync(t2dir) diff --git a/test/tap/zz-cleanup.js b/test/tap/zz-cleanup.js index 6c57f1eb4..7167537e0 100644 --- a/test/tap/zz-cleanup.js +++ b/test/tap/zz-cleanup.js @@ -7,7 +7,7 @@ test("cleanup", function (t) { t.equal(res, 0, "Deleted test npm cache successfully") // ensure cache is clean - fs.readdir(common.npm_config_cache, function(err) { + fs.readdir(common.npm_config_cache, function (err) { t.ok(err, "error expected") t.equal(err.code, "ENOENT", "npm cache directory no longer exists") t.end() |