mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-24 10:01:48 -04:00
49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
import tape = require('tape')
|
|
import promisifyTape from 'tape-promise'
|
|
import path = require('path')
|
|
import {
|
|
execPnpm,
|
|
execPnpmSync,
|
|
tempDir,
|
|
} from './utils'
|
|
|
|
const test = promisifyTape(tape)
|
|
|
|
test('pnpm root', async (t: tape.Test) => {
|
|
tempDir(t)
|
|
|
|
const result = execPnpmSync('root')
|
|
|
|
t.equal(result.status, 0)
|
|
|
|
t.equal(result.stdout.toString(), path.resolve('node_modules') + '\n')
|
|
})
|
|
|
|
test('pnpm root -g', async (t: tape.Test) => {
|
|
tempDir(t)
|
|
|
|
const global = path.resolve('global')
|
|
|
|
process.env.NPM_CONFIG_PREFIX = global
|
|
|
|
const result = execPnpmSync('root', '-g')
|
|
|
|
t.equal(result.status, 0)
|
|
|
|
t.equal(result.stdout.toString(), path.join(global, 'pnpm-global', '1', 'node_modules') + '\n')
|
|
})
|
|
|
|
test('pnpm root -g --independent-leaves', async (t: tape.Test) => {
|
|
tempDir(t)
|
|
|
|
const global = path.resolve('global')
|
|
|
|
process.env.NPM_CONFIG_PREFIX = global
|
|
|
|
const result = execPnpmSync('root', '-g', '--independent-leaves')
|
|
|
|
t.equal(result.status, 0)
|
|
|
|
t.equal(result.stdout.toString(), path.join(global, 'pnpm-global', '1_independent_leaves', 'node_modules') + '\n')
|
|
})
|