1 // Run all the tests in the `npm-registry-couchapp` suite
2 // This verifies that the server-side stuff still works.
4 var common = require("../common-tap")
5 var test = require("tap").test
7 var npmExec = require.resolve("../../bin/npm-cli.js")
8 var path = require("path")
9 var ca = path.resolve(__dirname, "../../node_modules/npm-registry-couchapp")
11 var which = require("which")
13 var v = process.versions.node.split(".").map(function (n) { return parseInt(n, 10) })
14 if (v[0] === 0 && v[1] < 10) {
16 "WARNING: need a recent Node for npm-registry-couchapp tests to run, have",
21 which("couchdb", function (er) {
23 console.error("WARNING: need couch to run test: " + er.message)
32 function runTests () {
34 for (var i in process.env) env[i] = process.env[i]
41 common.npm(["install"], opts, function (err, code, stdout, stderr) {
42 if (err) { throw err }
44 return test("need install to work", function (t) {
46 "install failed with: " + code +
47 '\nstdout: ' + stdout +
48 '\nstderr: ' + stderr)
63 function (err, code, stdout, stderr) {
64 if (err) { throw err }
66 return test("need test to work", function (t) {
68 "test failed with: " + code +
69 '\nstdout: ' + stdout +
70 '\nstderr: ' + stderr)
79 common.npm(["prune", "--production"], opts, function (err, code) {
80 if (err) { throw err }
81 process.exit(code || 0)