diff options
author | isaacs <i@izs.me> | 2014-06-21 04:37:58 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2014-06-21 04:37:58 +0400 |
commit | 30b7eb9f2bde00c5db730c6ec51b6de4db65b61b (patch) | |
tree | 93300dc441926fb3810dc9ec24425550e598bf5f | |
parent | 4a7997dc3ce66c2bd8d7b0eb19965c885a02d207 (diff) |
Run the npm-registry-couchapp tests along with npm tests
This test will fail if couchdb isn't installed
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | test/tap/registry.js | 55 |
2 files changed, 56 insertions, 1 deletions
diff --git a/package.json b/package.json index fb006e18b..d0c825351 100644 --- a/package.json +++ b/package.json @@ -141,7 +141,7 @@ ], "devDependencies": { "marked": "~0.3.2", - "npm-registry-couchapp": "~2.3.1", + "npm-registry-couchapp": "~2.3.4", "npm-registry-mock": "~0.6.3", "ronn": "~0.3.6", "tap": "~0.4.9" diff --git a/test/tap/registry.js b/test/tap/registry.js new file mode 100644 index 000000000..8ea1c2f2d --- /dev/null +++ b/test/tap/registry.js @@ -0,0 +1,55 @@ +// Run all the tests in the `npm-registry-couchapp` suite +// This verifies that the server-side stuff still works. + +var test = require("tap").test + +var spawn = require("child_process").spawn +var npmExec = require.resolve("../../bin/npm-cli.js") +var path = require("path") +var ca = path.resolve(__dirname, "../../node_modules/npm-registry-couchapp") + +var which = require("which") +var hasCouch = false + +which("couchdb", function(er, couch) { + if (er) { + return test("need couchdb", function (t) { + t.fail("need couch to run test: " + er.message) + t.end() + }) + } else { + runTests() + } +}) + +function runTests () { + spawn(process.execPath, [ + npmExec, "install" + ], { + cwd: ca, + stdio: "inherit" + }).on("close", function (code, sig) { + if (code || sig) { + return test("need install to work", function (t) { + t.fail("install failed with: " (code || sig)) + t.end() + }) + + } else { + var env = {} + for (var i in process.env) env[i] = process.env[i] + env.npm = npmExec + + spawn(process.execPath, [ + npmExec, "test" + ], { + cwd: ca, + env: env, + stdio: "inherit" + }).on("close", function (code, sig) { + process.exit(code || sig) + }) + } + + }) +} |