Skip to content

Commit

Permalink
fix: subdeps of not installable packages are ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
zkochan committed Mar 31, 2017
1 parent d88cb27 commit 40b436c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/api/install.ts
Expand Up @@ -83,10 +83,13 @@ export async function installPkgs (fuzzyDeps: string[] | Dependencies, maybeOpts
}
const ctx = await getContext(opts)
const installCtx = await createInstallCmd(opts, ctx.shrinkwrap)
const optionalDependencies = opts.saveOptional
? packagesToInstall.map(spec => spec.name)
: []

return lock(
ctx.storePath,
() => installInContext('named', packagesToInstall, [], ctx, installCtx, opts),
() => installInContext('named', packagesToInstall, optionalDependencies, ctx, installCtx, opts),
{stale: opts.lockStaleDuration}
)
}
Expand Down
6 changes: 6 additions & 0 deletions test/install.ts
Expand Up @@ -113,6 +113,12 @@ test('scoped modules from a directory', async function (t) {
t.equal(localPkg(), '@scope/local-scoped-pkg', 'localScopedPkg() is available')
})

test('successfully install optional dependency with subdependencies', async function (t) {
const project = prepare(t)

await installPkgs(['fsevents@1.0.14'], testDefaults({saveOptional: true}))
})

test('skip failing optional dependencies', async function (t) {
const project = prepare(t)
await installPkgs(['pkg-with-failing-optional-dependency@1.0.1'], testDefaults())
Expand Down

0 comments on commit 40b436c

Please sign in to comment.