Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Jun 30, 2019
1 parent bf61c45 commit b57d07e
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 72 deletions.
91 changes: 39 additions & 52 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
"licensee": "^7.0.2",
"marked": "^0.6.0",
"marked-man": "^0.2.1",
"npm-registry-couchapp": "^2.7.1",
"npm-registry-couchapp": "^2.7.2",
"npm-registry-mock": "^1.1.0",
"require-inject": "^1.4.4",
"sprintf-js": "^1.1.2",
Expand Down
34 changes: 15 additions & 19 deletions test/network/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// This verifies that the server-side stuff still works.

var common = require('../common-tap')
var test = require('tap').test
var t = require('tap')

var npmExec = require.resolve('../../bin/npm-cli.js')
var path = require('path')
Expand All @@ -17,16 +17,15 @@ if (v[0] === 0 && v[1] < 10) {
process.versions.node
)
} else {
which('couchdb', function (er) {
if (er) {
console.error('WARNING: need couch to run test: ' + er.message)
} else {
runTests()
}
})
try {
which.sync('couchdb')
t.test(runTests)
} catch (er) {
console.error('WARNING: need couch to run test: ' + er.message)
}
}

function runTests () {
function runTests (t) {
var env = Object.assign({ TAP: 1 }, process.env)
env.npm = npmExec
// TODO: fix tap and / or nyc to handle nested invocations properly
Expand All @@ -39,10 +38,8 @@ function runTests () {
common.npm(['install'], opts, function (err, code) {
if (err) { throw err }
if (code) {
return test('need install to work', function (t) {
t.fail('install failed with: ' + code)
t.end()
})
t.fail('install failed with: ' + code)
return t.end()
} else {
opts = {
cwd: ca,
Expand All @@ -52,19 +49,18 @@ function runTests () {
common.npm(['test', '--', '-Rtap', '--no-coverage'], opts, function (err, code) {
if (err) { throw err }
if (code) {
return test('need test to work', function (t) {
t.fail('test failed with: ' + code)
t.end()
})
t.fail('test failed with: ' + code)
return t.end()
}
opts = {
cwd: ca,
env: env,
stdio: 'inherit'
}
common.npm(['prune', '--production'], opts, function (err, code) {
if (err) { throw err }
process.exit(code || 0)
t.ifError(err)
t.equal(code, 0)
return t.end()
})
})
}
Expand Down

0 comments on commit b57d07e

Please sign in to comment.