hunk.code_window:     "loud-rejection": "^1.6.0",
       "mem": "^1.1.0",
       "mkdirp-promise": "^5.0.1",
       "mz": "^2.6.0",
       "ndjson": "^1.5.0",
       "node-gyp": "^3.6.0",
       "nopt": "^4.0.1",
       "normalize-path": "^2.1.1",
       "normalize-ssh": "^1.0.0",
  
hunk.labels: keep keep keep add keep keep keep keep keep
hunk.after_edit:     "ncp": "^2.0.0",
  
hunk.file_path: package.json
hunk.type: add
file: import tape = require('tape')
  import promisifyTape from 'tape-promise'
  const test = promisifyTape(tape)
  import path = require('path')
  import {
    prepare,
    isExecutable,
    pathToLocalPkg,
    testDefaults,
   } from './utils'
  import thenify = require('thenify')
  import ncpCB = require('ncp')
  const ncp = thenify(ncpCB.ncp)
  import {
    link,
    linkToGlobal,
    linkFromGlobal,
    installPkgs
  } from '../src'
  
  test('relative link', async function (t) {
    prepare(t)
  
    const linkedPkgName = 'hello-world-js-bin'
    const linkedPkgPath = path.resolve('..', linkedPkgName)
  
    await ncp(pathToLocalPkg(linkedPkgName), linkedPkgPath)
    await link(`../${linkedPkgName}`, process.cwd(), testDefaults())
  
    isExecutable(t, path.resolve('node_modules', '.bin', 'hello-world-js-bin'))
  })
  
  test('relative link is not rewritten by install', async function (t) {
    const project = prepare(t)
  
    const linkedPkgName = 'hello-world-js-bin'
    const linkedPkgPath = path.resolve('..', linkedPkgName)
  
    await ncp(pathToLocalPkg(linkedPkgName), linkedPkgPath)
    await link(`../${linkedPkgName}`, process.cwd(), testDefaults())
  
    await installPkgs(['hello-world-js-bin'], testDefaults())
  
    t.ok(project.requireModule('hello-world-js-bin/package.json').isLocal)
  })
  
  test('global link', async function (t) {
    prepare(t)
    const projectPath = process.cwd()
  
    const linkedPkgName = 'hello-world-js-bin'
    const linkedPkgPath = path.resolve('..', linkedPkgName)
  
    await ncp(pathToLocalPkg(linkedPkgName), linkedPkgPath)
  
    process.chdir(linkedPkgPath)
    const globalPrefix = path.resolve('..', 'global')
    await linkToGlobal(process.cwd(), Object.assign(testDefaults(), {globalPrefix}))
  
    process.chdir(projectPath)
  
    await linkFromGlobal(linkedPkgName, process.cwd(), Object.assign(testDefaults(), {globalPrefix}))
  
    isExecutable(t, path.resolve('node_modules', '.bin', 'hello-world-js-bin'))
  })
  