mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-18 22:02:53 -04:00
test: fix on Windows
This commit is contained in:
@@ -41,7 +41,7 @@ devDependencies:
|
||||
pnpm-registry-mock: 2.1.0
|
||||
rimraf: 2.6.2
|
||||
rimraf-then: 1.0.1
|
||||
sinon: 6.0.0
|
||||
sinon: 6.0.1
|
||||
tape: 4.9.1
|
||||
tape-promise: 3.0.0
|
||||
tempy: 0.2.1
|
||||
@@ -3953,7 +3953,7 @@ packages:
|
||||
/signal-exit/3.0.2:
|
||||
resolution:
|
||||
integrity: sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=
|
||||
/sinon/6.0.0:
|
||||
/sinon/6.0.1:
|
||||
dependencies:
|
||||
'@sinonjs/formatio': 2.0.0
|
||||
diff: 3.5.0
|
||||
@@ -3964,7 +3964,7 @@ packages:
|
||||
type-detect: 4.0.8
|
||||
dev: true
|
||||
resolution:
|
||||
integrity: sha512-MatciKXyM5pXMSoqd593MqTsItJNCkSSl53HJYeKR5wfsDdp2yljjUQJLfVwAWLoBNfx1HThteqygGQ0ZEpXpQ==
|
||||
integrity: sha512-rfszhNcfamK2+ofIPi9XqeH89pH7KGDcAtM+F9CsjHXOK3jzWG99vyhyD2V+r7s4IipmWcWUFYq4ftZ9/Eu2Wg==
|
||||
/slash/1.0.0:
|
||||
engines:
|
||||
node: '>=0.10.0'
|
||||
|
||||
@@ -79,6 +79,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@pnpm/assert-project": "^1.1.1",
|
||||
"@pnpm/read-package-json": "^1.0.0",
|
||||
"@types/byline": "^4.2.31",
|
||||
"@types/common-tags": "^1.2.5",
|
||||
"@types/delay": "^2.0.1",
|
||||
@@ -105,7 +106,6 @@
|
||||
"package-preview": "^1.0.0",
|
||||
"path-exists": "^3.0.0",
|
||||
"pnpm-registry-mock": "^2.0.0",
|
||||
"read-pkg": "^3.0.0",
|
||||
"retry": "^0.12.0",
|
||||
"rimraf": "^2.5.4",
|
||||
"rimraf-then": "^1.0.1",
|
||||
|
||||
@@ -22,6 +22,7 @@ dependencies:
|
||||
cross-spawn: 6.0.5
|
||||
delay: 3.0.0
|
||||
diable: 4.0.1
|
||||
execa: 0.10.0
|
||||
find-packages: 2.2.0
|
||||
get-port: 3.2.0
|
||||
graceful-fs: 4.1.11
|
||||
@@ -57,6 +58,7 @@ dependencies:
|
||||
util.promisify: 1.0.0
|
||||
devDependencies:
|
||||
'@pnpm/assert-project': 1.1.2
|
||||
'@pnpm/read-package-json': 1.0.0
|
||||
'@types/byline': 4.2.31
|
||||
'@types/common-tags': 1.4.0
|
||||
'@types/delay': 2.0.1
|
||||
@@ -75,7 +77,6 @@ devDependencies:
|
||||
byline: 5.0.0
|
||||
caw: 2.0.1
|
||||
deep-require-cwd: 1.0.0
|
||||
execa: 0.10.0
|
||||
exists-link: 2.0.0
|
||||
mkdirp: 0.5.1
|
||||
normalize-newline: 3.0.0
|
||||
@@ -84,7 +85,6 @@ devDependencies:
|
||||
package-preview: 1.0.6
|
||||
path-exists: 3.0.0
|
||||
pnpm-registry-mock: 2.1.0
|
||||
read-pkg: 3.0.0
|
||||
retry: 0.12.0
|
||||
rimraf: 2.6.2
|
||||
rimraf-then: 1.0.1
|
||||
@@ -360,7 +360,6 @@ packages:
|
||||
'@pnpm/types': 1.7.0
|
||||
read-package-json: 2.0.13
|
||||
util.promisify: 1.0.0
|
||||
dev: false
|
||||
engines:
|
||||
node: '>=6'
|
||||
resolution:
|
||||
@@ -453,7 +452,6 @@ packages:
|
||||
resolution:
|
||||
integrity: sha512-AM/vdcnhu0nGJz+QR0FBR4vGsT+zo//l9kxC85ork9lqOOcFw0NA8fAes1mGxQE6lYRF+qthR3OmfX2yvFRW2g==
|
||||
/@pnpm/types/1.7.0:
|
||||
dev: false
|
||||
resolution:
|
||||
integrity: sha512-pn7g4uxcofWTNG/cxmKvkMK2lxr4OUIhrQDrEVYEdVhW0WkWztsHkFrYjFgfNzPbYu3ITlB3T6aSVjCoJQTOlw==
|
||||
/@sindresorhus/is/0.7.0:
|
||||
@@ -2129,6 +2127,7 @@ packages:
|
||||
p-finally: 1.0.0
|
||||
signal-exit: 3.0.2
|
||||
strip-eof: 1.0.0
|
||||
dev: false
|
||||
engines:
|
||||
node: '>=4'
|
||||
resolution:
|
||||
@@ -2549,6 +2548,7 @@ packages:
|
||||
resolution:
|
||||
integrity: sha1-Xzj5PzRgCWZu4BUKBUFn+Rvdld4=
|
||||
/get-stream/3.0.0:
|
||||
dev: false
|
||||
engines:
|
||||
node: '>=4'
|
||||
resolution:
|
||||
@@ -3247,6 +3247,7 @@ packages:
|
||||
resolution:
|
||||
integrity: sha1-6+oRaaJhTaOSpjdANmw84EnY3/Y=
|
||||
/is-stream/1.1.0:
|
||||
dev: false
|
||||
engines:
|
||||
node: '>=0.10.0'
|
||||
resolution:
|
||||
@@ -4154,6 +4155,7 @@ packages:
|
||||
/npm-run-path/2.0.2:
|
||||
dependencies:
|
||||
path-key: 2.0.1
|
||||
dev: false
|
||||
engines:
|
||||
node: '>=4'
|
||||
resolution:
|
||||
@@ -4336,6 +4338,7 @@ packages:
|
||||
resolution:
|
||||
integrity: sha1-Yp0xcVAgnI/VCLoTdxPvS7kg6ds=
|
||||
/p-finally/1.0.0:
|
||||
dev: false
|
||||
engines:
|
||||
node: '>=4'
|
||||
resolution:
|
||||
@@ -4938,7 +4941,6 @@ packages:
|
||||
json-parse-better-errors: 1.0.2
|
||||
normalize-package-data: 2.4.0
|
||||
slash: 1.0.0
|
||||
dev: false
|
||||
optionalDependencies:
|
||||
graceful-fs: 4.1.11
|
||||
resolution:
|
||||
@@ -5423,7 +5425,6 @@ packages:
|
||||
resolution:
|
||||
integrity: sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=
|
||||
/slash/1.0.0:
|
||||
dev: false
|
||||
engines:
|
||||
node: '>=0.10.0'
|
||||
resolution:
|
||||
@@ -5744,6 +5745,7 @@ packages:
|
||||
resolution:
|
||||
integrity: sha1-EG9l09PmotlAHKwOsM6LinArT3s=
|
||||
/strip-eof/1.0.0:
|
||||
dev: false
|
||||
engines:
|
||||
node: '>=0.10.0'
|
||||
resolution:
|
||||
@@ -6516,6 +6518,7 @@ specifiers:
|
||||
'@pnpm/lifecycle': ^2.2.1
|
||||
'@pnpm/logger': ^1.0.0
|
||||
'@pnpm/outdated': ^0.3.3
|
||||
'@pnpm/read-package-json': ^1.0.0
|
||||
'@pnpm/server': ^0.13.2
|
||||
'@pnpm/store-path': ^1.0.3
|
||||
'@pnpm/types': ^1.5.0
|
||||
@@ -6585,7 +6588,6 @@ specifiers:
|
||||
process-exists: ^3.0.0
|
||||
ramda: ^0.25.0
|
||||
read-ini-file: ^1.0.0
|
||||
read-pkg: ^3.0.0
|
||||
retry: ^0.12.0
|
||||
rimraf: ^2.5.4
|
||||
rimraf-then: ^1.0.1
|
||||
|
||||
@@ -10,7 +10,6 @@ import crossSpawn = require('cross-spawn')
|
||||
const spawnSync = crossSpawn.sync
|
||||
import isCI = require('is-ci')
|
||||
import rimraf = require('rimraf-then')
|
||||
import readPkg = require('read-pkg')
|
||||
import {
|
||||
prepare,
|
||||
addDistTag,
|
||||
|
||||
@@ -24,6 +24,7 @@ test('self-update stops the store server', async (t: tape.Test) => {
|
||||
|
||||
const global = path.resolve('global')
|
||||
|
||||
if (process.env.APPDATA) process.env.APPDATA = global
|
||||
process.env.NPM_CONFIG_PREFIX = global
|
||||
|
||||
await execPnpm('install', '-g', 'pnpm', '--store', path.resolve('..', 'store'))
|
||||
|
||||
@@ -40,6 +40,7 @@ test('link global bin', async function (t: tape.Test) {
|
||||
process.chdir('..')
|
||||
|
||||
const global = path.resolve('global')
|
||||
if (process.env.APPDATA) process.env.APPDATA = global
|
||||
process.env.NPM_CONFIG_PREFIX = global
|
||||
|
||||
await writePkg('package-with-bin', {name: 'package-with-bin', version: '1.0.0', bin: 'bin.js'})
|
||||
@@ -49,6 +50,6 @@ test('link global bin', async function (t: tape.Test) {
|
||||
|
||||
await execPnpm('link')
|
||||
|
||||
const globalBin = isWindows() ? global : path.join(global, 'bin')
|
||||
const globalBin = isWindows() ? path.join(global, 'npm') : path.join(global, 'bin')
|
||||
await isExecutable(t, path.join(globalBin, 'package-with-bin'))
|
||||
})
|
||||
|
||||
@@ -2,6 +2,7 @@ import tape = require('tape')
|
||||
import promisifyTape from 'tape-promise'
|
||||
import path = require('path')
|
||||
import {stripIndent} from 'common-tags'
|
||||
import isWindows = require('is-windows')
|
||||
import {
|
||||
execPnpm,
|
||||
execPnpmSync,
|
||||
@@ -17,6 +18,7 @@ test('listing global packages', async (t: tape.Test) => {
|
||||
|
||||
const global = path.resolve('global')
|
||||
|
||||
if (process.env.APPDATA) process.env.APPDATA = global
|
||||
process.env.NPM_CONFIG_PREFIX = global
|
||||
|
||||
await execPnpm('install', '-g', 'is-positive@3.1.0')
|
||||
@@ -25,8 +27,11 @@ test('listing global packages', async (t: tape.Test) => {
|
||||
|
||||
t.equal(result.status, 0)
|
||||
|
||||
const globalPrefix = isWindows()
|
||||
? path.join(global, 'npm', 'pnpm-global', '1')
|
||||
: path.join(global, 'pnpm-global', '1')
|
||||
t.equal(result.stdout.toString(), stripIndent`
|
||||
pnpm-global-pkg@1.0.0 ${path.join(global, 'pnpm-global', '1')}
|
||||
pnpm-global-pkg@1.0.0 ${globalPrefix}
|
||||
└── is-positive@3.1.0
|
||||
` + '\n\n')
|
||||
})
|
||||
@@ -36,6 +41,7 @@ test('listing global packages installed with independent-leaves = true', async (
|
||||
|
||||
const global = path.resolve('global')
|
||||
|
||||
if (process.env.APPDATA) process.env.APPDATA = global
|
||||
process.env.NPM_CONFIG_PREFIX = global
|
||||
|
||||
await execPnpm('install', '-g', '--independent-leaves', 'is-positive@3.1.0')
|
||||
@@ -44,8 +50,11 @@ test('listing global packages installed with independent-leaves = true', async (
|
||||
|
||||
t.equal(result.status, 0)
|
||||
|
||||
const globalPrefix = isWindows()
|
||||
? path.join(global, 'npm', 'pnpm-global', '1_independent_leaves')
|
||||
: path.join(global, 'pnpm-global', '1_independent_leaves')
|
||||
t.equal(result.stdout.toString(), stripIndent`
|
||||
pnpm-global-pkg@1.0.0 ${path.join(global, 'pnpm-global', '1_independent_leaves')}
|
||||
pnpm-global-pkg@1.0.0 ${globalPrefix}
|
||||
└── is-positive@3.1.0
|
||||
` + '\n\n')
|
||||
})
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import tape = require('tape')
|
||||
import promisifyTape from 'tape-promise'
|
||||
import path = require('path')
|
||||
import isWindows = require('is-windows')
|
||||
import {
|
||||
execPnpm,
|
||||
execPnpmSync,
|
||||
@@ -24,13 +25,18 @@ test('pnpm root -g', async (t: tape.Test) => {
|
||||
|
||||
const global = path.resolve('global')
|
||||
|
||||
if (process.env.APPDATA) process.env.APPDATA = 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')
|
||||
if (isWindows()) {
|
||||
t.equal(result.stdout.toString(), path.join(global, 'npm', 'pnpm-global', '1', 'node_modules') + '\n')
|
||||
} else {
|
||||
t.equal(result.stdout.toString(), path.join(global, 'pnpm-global', '1', 'node_modules') + '\n')
|
||||
}
|
||||
})
|
||||
|
||||
test('pnpm root -g --independent-leaves', async (t: tape.Test) => {
|
||||
@@ -38,11 +44,16 @@ test('pnpm root -g --independent-leaves', async (t: tape.Test) => {
|
||||
|
||||
const global = path.resolve('global')
|
||||
|
||||
if (process.env.APPDATA) process.env.APPDATA = 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')
|
||||
if (isWindows()) {
|
||||
t.equal(result.stdout.toString(), path.join(global, 'npm', 'pnpm-global', '1_independent_leaves', 'node_modules') + '\n')
|
||||
} else {
|
||||
t.equal(result.stdout.toString(), path.join(global, 'pnpm-global', '1_independent_leaves', 'node_modules') + '\n')
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {fromDir as readPkgFromDir} from '@pnpm/read-package-json'
|
||||
import tape = require('tape')
|
||||
import promisifyTape from 'tape-promise'
|
||||
const test = promisifyTape(tape)
|
||||
import readPkg = require('read-pkg')
|
||||
import {
|
||||
prepare,
|
||||
testDefaults,
|
||||
@@ -27,7 +27,7 @@ test('uninstall package and remove from appropriate property', async function (t
|
||||
|
||||
await project.hasNot('is-positive')
|
||||
|
||||
const pkgJson = await readPkg()
|
||||
const pkgJson = await readPkgFromDir(process.cwd())
|
||||
t.equal(pkgJson.optionalDependencies, undefined, 'is-negative has been removed from optionalDependencies')
|
||||
})
|
||||
|
||||
@@ -36,8 +36,9 @@ test('uninstall global package with its bin files', async (t: tape.Test) => {
|
||||
process.chdir('..')
|
||||
|
||||
const global = path.resolve('global')
|
||||
const globalBin = isWindows() ? global : path.join(global, 'bin')
|
||||
const globalBin = isWindows() ? path.join(global, 'npm') : path.join(global, 'bin')
|
||||
|
||||
if (process.env.APPDATA) process.env.APPDATA = global
|
||||
process.env.NPM_CONFIG_PREFIX = global
|
||||
|
||||
await execPnpm('install', '-g', 'sh-hello-world@1.0.1')
|
||||
|
||||
@@ -86,7 +86,7 @@ devDependencies:
|
||||
read-pkg: 3.0.0
|
||||
rimraf: 2.6.2
|
||||
sepia: 2.0.2
|
||||
sinon: 6.0.0
|
||||
sinon: 6.0.1
|
||||
tape: 4.9.1
|
||||
tape-promise: 3.0.0
|
||||
ts-node: 7.0.0
|
||||
@@ -4177,7 +4177,7 @@ packages:
|
||||
/signal-exit/3.0.2:
|
||||
resolution:
|
||||
integrity: sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=
|
||||
/sinon/6.0.0:
|
||||
/sinon/6.0.1:
|
||||
dependencies:
|
||||
'@sinonjs/formatio': 2.0.0
|
||||
diff: 3.5.0
|
||||
@@ -4188,7 +4188,7 @@ packages:
|
||||
type-detect: 4.0.8
|
||||
dev: true
|
||||
resolution:
|
||||
integrity: sha512-MatciKXyM5pXMSoqd593MqTsItJNCkSSl53HJYeKR5wfsDdp2yljjUQJLfVwAWLoBNfx1HThteqygGQ0ZEpXpQ==
|
||||
integrity: sha512-rfszhNcfamK2+ofIPi9XqeH89pH7KGDcAtM+F9CsjHXOK3jzWG99vyhyD2V+r7s4IipmWcWUFYq4ftZ9/Eu2Wg==
|
||||
/slash/1.0.0:
|
||||
engines:
|
||||
node: '>=0.10.0'
|
||||
|
||||
Reference in New Issue
Block a user