Files
pnpm/test/link.ts
Zoltan Kochan 060f44f5ef fix(server): terminate the store server if graceful stop fails (#1003)
* refactor: use process-exists instead of is-running

* fix(server): terminate the store server if graceful stop fails
2018-01-23 22:12:24 +02:00

55 lines
1.4 KiB
TypeScript

import tape = require('tape')
import promisifyTape from 'tape-promise'
const test = promisifyTape(tape)
import path = require('path')
import writePkg = require('write-pkg')
import {
prepare,
testDefaults,
execPnpm,
isExecutable,
} from './utils'
import fs = require('mz/fs')
import isWindows = require('is-windows')
test('linking multiple packages', async (t: tape.Test) => {
const project = prepare(t)
process.chdir('..')
process.env.NPM_CONFIG_PREFIX = path.resolve('global')
await writePkg('linked-foo', {name: 'linked-foo', version: '1.0.0'})
await writePkg('linked-bar', {name: 'linked-bar', version: '1.0.0'})
process.chdir('linked-foo')
t.comment('linking linked-foo to global package')
await execPnpm('link')
process.chdir('..')
process.chdir('project')
await execPnpm('link', 'linked-foo', '../linked-bar')
project.has('linked-foo')
project.has('linked-bar')
})
test('link global bin', async function (t: tape.Test) {
prepare(t)
process.chdir('..')
const global = path.resolve('global')
process.env.NPM_CONFIG_PREFIX = global
await writePkg('package-with-bin', {name: 'package-with-bin', version: '1.0.0', bin: 'bin.js'})
await fs.writeFile('package-with-bin/bin.js', '#!/usr/bin/env node\nconsole.log(/hi/)\n', 'utf8')
process.chdir('package-with-bin')
await execPnpm('link')
const globalBin = isWindows() ? global : path.join(global, 'bin')
isExecutable(t, path.join(globalBin, 'package-with-bin'))
})