This repository has been archived by the owner on May 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(child): only override dirPacker if opts.dirPacker is defined (#55)
- Loading branch information
Showing
2 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict' | ||
|
||
const test = require('tap').test | ||
const requireInject = require('require-inject') | ||
|
||
const extract = requireInject('../../../lib/extract.js', { | ||
'../../../lib/worker.js': (msg, cb) => { cb(null, msg) }, | ||
'npm-package-arg': { | ||
resolve: () => ({ registry: false, type: 'not-remote' }) | ||
} | ||
}) | ||
|
||
test('extract.child() only overwrites dirPacker when opts.dirPacker is defined', t => { | ||
const name = 'name' | ||
const child = { version: '0.0.0', integrity: 'integrity', resolved: 'resolved' } | ||
const childPath = './path' | ||
const config = { | ||
toPacote (moreOpts) { | ||
return moreOpts | ||
} | ||
} | ||
|
||
const opts = { log: { level: 'level' } } | ||
const a = extract.child(name, child, childPath, config, opts) | ||
|
||
a.then(b => { | ||
t.ok(!('dirPacker' in b[2]), 'An undefined dirPacker overrode the pacote childOpts') | ||
t.end() | ||
}) | ||
}) |