Skip to content
This repository has been archived by the owner on Jul 3, 2019. It is now read-only.

Commit

Permalink
Merge bb7ee6a into 400a9bf
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Feb 14, 2017
2 parents 400a9bf + bb7ee6a commit 27238ab
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"preversion": "npm t",
"postversion": "npm publish && git push --follow-tags",
"pretest": "standard lib test *.js",
"test": "nyc -- tap test/*.js"
"test": "nyc -- tap -j8 test/*.js"
},
"repository": "https://github.com/zkat/pacote",
"keywords": [
Expand Down Expand Up @@ -41,6 +41,6 @@
"nyc": "^10.0.0",
"rimraf": "^2.5.4",
"standard": "^8.6.0",
"tap": "^8.0.1"
"tap": "^10.0.2"
}
}
24 changes: 19 additions & 5 deletions test/registry.manifest.cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@ var OPTS = {
}
}

// DEBUG STUFF FOR ISAAC
var signalExit = require('signal-exit')
signalExit(function (code, signal) {
console.log('SE code=%j signal=%j process.exitCode=%j', code, signal, process.exitCode)
})
process.on('exit', function (code) {
console.log('PE code=%j process.exitCode=%j', code, process.exitCode)
})
process.reallyExit = (function (original) {
return function (code) {
console.log('reallyExit code=%j process.exitCode=%j', code, process.exitCode)
return original.apply(this, arguments)
}
})(process.reallyExit)

test('memoizes identical registry requests', function (t) {
t.plan(2)
var srv = tnock(t, OPTS.registry)
Expand Down Expand Up @@ -120,6 +135,10 @@ test('supports fetching from an optional cache', function (t) {
test('expires stale request data')
test('allows forcing use of cache when data stale')
test('falls back to registry if cache entry is invalid JSON')
// This test should prevent future footgunning if the caching logic changes
// accidentally. Caching manifests themselves should be entirely the job of the
// package fetcher.
test('does not insert plain manifests into the cache')

test('falls back to registry if cache entry missing', function (t) {
var opts = {
Expand All @@ -136,8 +155,3 @@ test('falls back to registry if cache entry missing', function (t) {
t.end()
})
})

// This test should prevent future footgunning if the caching logic changes
// accidentally. Caching manifests themselves should be entirely the job of the
// package fetcher.
test('does not insert plain manifests into the cache')
5 changes: 3 additions & 2 deletions test/util/test-dir.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ var cacheDir = path.resolve(__dirname, '../cache')

module.exports = testDir
function testDir (filename) {
var dir = path.join(cacheDir, path.basename(filename, '.js'))
var base = path.basename(filename, '.js')
var dir = path.join(cacheDir, base)
reset(dir)
if (!process.env.KEEPCACHE) {
tap.tearDown(function () {
process.chdir(__dirname)
try {
rimraf.sync(cacheDir)
rimraf.sync(dir)
} catch (e) {
if (process.platform !== 'win32') {
throw e
Expand Down

0 comments on commit 27238ab

Please sign in to comment.