hunk.code_window:   const pkgJson = await readPkg()
     t.deepEqual(pkgJson.dependencies, {rimraf: '^2.5.1'}, 'rimraf has been added to dependencies')
   })
   test("don't override existing spec in package.json on named installation", async function (t: tape.Test) {
     const project = prepare(t, {
       dependencies: {
         'is-positive': '^2.0.0', // this will be kept as no newer version is available from the range
  
hunk.labels: keep keep keep add keep keep keep keep
hunk.after_edit: // NOTE: this works differently for global installations. See similar tests in global.ts
  
hunk.file_path: test/install/updatingPkgJson.ts
hunk.type: add
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')
  })
  