Skip to content
This repository has been archived by the owner on May 10, 2021. It is now read-only.

chore(dirPacker): add dirPacker to options #4

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,10 @@ class Installer {
pkg, stage, pkgPath, LifecycleOpts(this.opts).concat({
// TODO: can be removed once npm-lifecycle is updated to modern
// config practices.
config: Object.assign({}, this.opts, { log: null }),
config: Object.assign({}, this.opts, {
log: null,
dirPacker: null
}),
dir: this.prefix
}))
).tap(() => { this.timings.scripts += Date.now() - start })
Expand Down
3 changes: 2 additions & 1 deletion lib/extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ let workerFarm
const ENABLE_WORKERS = false

const ExtractOpts = figgyPudding({
log: {}
log: {},
dirPacker: {}
})

module.exports = {
Expand Down
14 changes: 14 additions & 0 deletions test/specs/lib/extract.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ const extract = requireInject('../../../lib/extract.js', {
}
})

test('extract.child() ensures dirPacker is defined', t => {
const name = 'name'
const child = { version: '0.0.0', integrity: 'integrity', resolved: 'resolved' }
const childPath = './path'

const opts = { log: { level: 'level' }, dirPacker: {} }
const a = extract.child(name, child, childPath, opts)

a.then(b => {
t.ok('dirPacker' in b[2], 'dirPacker is defined')
t.end()
})
})

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' }
Expand Down