hunk.code_window:     const saveType = getSaveType(opts)
       newPkg = await save(
         pkgJsonPath,
         pkgs.map(dep => ({
           name: dep.pkg.name,
           saveSpec: getSaveSpec(
             R.find(spec => spec.raw === dep.specRaw, packagesToInstall),
             dep,
             opts.saveExact)
         })),
         saveType
       )
     }
  
hunk.labels: keep keep keep replace replace replace replace replace replace replace keep keep keep keep
hunk.after_edit:       <any>pkgs.map(dep => { // tslint:disable-line
           const spec: PackageSpec = R.find(spec => spec.raw === dep.specRaw, newSpecs)
           if (!spec) return null
           return {
             name: dep.pkg.name,
             saveSpec: getSaveSpec(spec, dep, opts.saveExact)
           }
         }).filter(Boolean),
  
hunk.file_path: src/api/install.ts
hunk.type: replace
file: import tape = require('tape')
  import promisifyTape from 'tape-promise'
  import {
    prepare,
    testDefaults,
  } from './utils'
  import rimraf = require('rimraf-then')
  import {installPkgs, install} from '../src'
  
  const test = promisifyTape(tape)
  
  test('offline installation fails when package meta not found in local registry mirror', async function (t) {
    const project = prepare(t)
  
    try {
      await installPkgs(['is-positive@3.0.0'], testDefaults({offline: true}))
      t.fail('installation should have failed')
    } catch (err) {
      t.equal(err.code, 'NO_OFFLINE_META', 'failed with correct error code')
    }
  })
  
  test('offline installation fails when package tarball not found in local registry mirror', async function (t) {
    const project = prepare(t)
  
    await installPkgs(['is-positive@3.0.0'], testDefaults())
  
    await rimraf('node_modules')
  
    try {
      await installPkgs(['is-positive@3.1.0'], testDefaults({offline: true}))
      t.fail('installation should have failed')
    } catch (err) {
      t.equal(err.code, 'NO_OFFLINE_TARBALL', 'failed with correct error code')
    }
  })
  
  test('successful offline installation', async function (t) {
    const project = prepare(t)
  
    await installPkgs(['is-positive@3.0.0'], testDefaults({save: true}))
  
    await rimraf('node_modules')
  
    await install(testDefaults({offline: true}))
  
    const m = project.requireModule('is-positive')
    t.ok(typeof m === 'function', 'module is available')
  })
  