hunk.code_window:   await install(testDefaults())
     await project.hasNot('not-compatible-with-any-os')
     await project.storeHasNot('not-compatible-with-any-os', '1.0.0')
     t.notOk(await exists(path.resolve('node_modules', '.localhost+4873', 'dep-of-optional-pkg', '1.0.0')), "isn't linked into node_modules")
     const shr = await project.loadShrinkwrap()
     t.ok(shr.packages['/not-compatible-with-any-os/1.0.0'], 'shrinkwrap contains optional dependency')
     t.ok(shr.packages['/dep-of-optional-pkg/1.0.0'], 'shrinkwrap contains dependency of optional dependency')
  
hunk.labels: keep keep keep replace keep keep keep keep keep
hunk.after_edit:   await project.storeHas('not-compatible-with-any-os', '1.0.0')
  
hunk.file_path: test/install/optionalDependencies.ts
hunk.type: replace
file: import tape = require('tape')
  import promisifyTape from 'tape-promise'
  const test = promisifyTape(tape)
  import path = require('path')
  import {installPkgs, prune} from '../src'
  import {prepare, testDefaults} from './utils'
  import exists = require('path-exists')
  import existsSymlink = require('exists-link')
  import readPkg = require('read-pkg')
  import writePkg = require('write-pkg')
  
  test('prune removes extraneous packages', async function (t) {
    const project = prepare(t)
  
    await installPkgs(['is-negative@2.1.0'], testDefaults({save: true}))
    await installPkgs(['applyq@0.2.1'], testDefaults({saveDev: true}))
    await installPkgs(['fnumber@0.1.0'], testDefaults({saveOptional: true}))
    await installPkgs(['is-positive@2.0.0', '@zkochan/logger@0.1.0'], testDefaults())
  
    const pkg = await readPkg()
  
    delete pkg.dependencies['is-positive']
    delete pkg.dependencies['@zkochan/logger']
  
    await writePkg(pkg)
  
    await prune(testDefaults())
  
    await project.storeHasNot('is-positive', '2.0.0')
    await project.hasNot('is-positive')
  
    await project.storeHasNot('@zkochan/logger', '0.1.0')
    await project.hasNot('@zkochan/logger')
  
    await project.storeHas('is-negative', '2.1.0')
    await project.has('is-negative')
  
    await project.storeHas('applyq', '0.2.1')
    await project.has('applyq')
  
    await project.storeHas('fnumber', '0.1.0')
    await project.has('fnumber')
  })
  
  test('prune removes dev dependencies in production', async function (t) {
    const project = prepare(t)
  
    await installPkgs(['is-positive@2.0.0'], testDefaults({saveDev: true}))
    await installPkgs(['is-negative@2.1.0'], testDefaults({save: true}))
    await installPkgs(['fnumber@0.1.0'], testDefaults({saveOptional: true}))
    await prune(testDefaults({production: true}))
  
    await project.storeHasNot('is-positive', '2.0.0')
    await project.hasNot('is-positive')
  
    await project.storeHas('is-negative', '2.1.0')
    await project.has('is-negative')
  
    await project.storeHas('fnumber', '0.1.0')
    await project.has('fnumber')
  })
  