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'
  import path = require('path')
  import {prepare, testDefaults} from '../utils'
  import {installPkgs} from '../../src'
  
  const test = promisifyTape(tape)
  
  test('global installation', async function (t) {
    prepare(t)
    const globalPrefix = path.resolve('..', 'global')
    const opts = testDefaults({global: true, prefix: globalPrefix})
    await installPkgs(['is-positive'], opts)
  
    // there was an issue when subsequent installations were removing everything installed prior
    // https://github.com/pnpm/pnpm/issues/808
    await installPkgs(['is-negative'], opts)
  
    const isPositive = require(path.join(globalPrefix, 'node_modules', 'is-positive'))
    t.ok(typeof isPositive === 'function', 'isPositive() is available')
  
    const isNegative = require(path.join(globalPrefix, 'node_modules', 'is-negative'))
    t.ok(typeof isNegative === 'function', 'isNegative() is available')
  })
  