mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-24 08:35:19 -04:00
style: fix styles in tests
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
"scripts": {
|
||||
"prepublishOnly": "npm run tsc",
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"lint": "tslint -c tslint.json --project .",
|
||||
"lint": "tslint -c tslint.json src/**/*.ts test/**/*.ts",
|
||||
"test-with-preview": "npm run lint && ts-node test && mos t",
|
||||
"pretest": "npm config rm fetch-retry-maxtimeout",
|
||||
"test": "npm run lint && npm run tsc && ts-node test && mos t"
|
||||
|
||||
@@ -160,8 +160,8 @@ test('registries of scoped packages are read', async (t) => {
|
||||
|
||||
t.deepEqual(opts.registries, {
|
||||
'default': 'https://registry.npmjs.org/',
|
||||
'@foo': 'https://foo.com',
|
||||
'@bar': 'https://bar.com'
|
||||
'@foo': 'https://foo.com',
|
||||
'@bar': 'https://bar.com'
|
||||
})
|
||||
|
||||
t.end()
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "tslint -c tslint.json --project .",
|
||||
"lint": "tslint -c tslint.json src/**/*.ts test/**/*.ts",
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"test": "npm run tsc && npm run lint && ts-node test --type-check && mos t",
|
||||
"md": "mos",
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "tslint -c tslint.json --project .",
|
||||
"lint": "tslint -c tslint.json src/**/*.ts test/**/*.ts",
|
||||
"pretty-test": "ts-node test | tap-diff",
|
||||
"test": "npm run lint && npm run just-test",
|
||||
"just-test-preview": "ts-node test --type-check",
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
///<reference path="../typings/index.d.ts"/>
|
||||
import {PnpmConfigs} from '@pnpm/config'
|
||||
import { PnpmConfigs } from '@pnpm/config'
|
||||
import logger, {
|
||||
createStreamParser,
|
||||
} from '@pnpm/logger'
|
||||
import delay from 'delay'
|
||||
import test = require('tape')
|
||||
import normalizeNewline = require('normalize-newline')
|
||||
import {toOutput$} from 'pnpm-default-reporter'
|
||||
import {stripIndents, stripIndent} from 'common-tags'
|
||||
import { toOutput$ } from 'pnpm-default-reporter'
|
||||
import { stripIndents, stripIndent } from 'common-tags'
|
||||
import chalk from 'chalk'
|
||||
import most = require('most')
|
||||
import StackTracey = require('stacktracey')
|
||||
@@ -72,7 +72,7 @@ test('prints progress beginning when appendOnly is true', t => {
|
||||
reportingOptions: {
|
||||
appendOnly: true,
|
||||
},
|
||||
context: {argv: ['install']},
|
||||
context: { argv: ['install'] },
|
||||
})
|
||||
|
||||
const pkgId = 'registry.npmjs.org/foo/1.0.0'
|
||||
@@ -96,7 +96,7 @@ test('prints progress beginning when appendOnly is true', t => {
|
||||
test('prints progress beginning during recursive install', t => {
|
||||
const output$ = toOutput$({
|
||||
streamParser: createStreamParser(),
|
||||
context: {argv: ['recursive']},
|
||||
context: { argv: ['recursive'] },
|
||||
})
|
||||
|
||||
const pkgId = 'registry.npmjs.org/foo/1.0.0'
|
||||
@@ -120,8 +120,8 @@ test('prints progress beginning during recursive install', t => {
|
||||
test('prints progress on first download', t => {
|
||||
const output$ = toOutput$({
|
||||
streamParser: createStreamParser(),
|
||||
context: {argv: ['install']},
|
||||
reportingOptions: {throttleProgress: 0},
|
||||
context: { argv: ['install'] },
|
||||
reportingOptions: { throttleProgress: 0 },
|
||||
})
|
||||
|
||||
const pkgId = 'registry.npmjs.org/foo/1.0.0'
|
||||
@@ -150,8 +150,8 @@ test('moves fixed line to the end', async t => {
|
||||
const prefix = process.cwd()
|
||||
const output$ = toOutput$({
|
||||
streamParser: createStreamParser(),
|
||||
context: {argv: ['install']},
|
||||
reportingOptions: {throttleProgress: 0},
|
||||
context: { argv: ['install'] },
|
||||
reportingOptions: { throttleProgress: 0 },
|
||||
})
|
||||
|
||||
output$.skip(3).take(1).map(normalizeNewline).subscribe({
|
||||
@@ -173,7 +173,7 @@ test('moves fixed line to the end', async t => {
|
||||
status: 'fetched',
|
||||
pkgId,
|
||||
})
|
||||
logger.warn({message: 'foo', prefix})
|
||||
logger.warn({ message: 'foo', prefix })
|
||||
|
||||
await delay(0) // w/o delay warning goes below for some reason. Started to happen after switch to most
|
||||
|
||||
@@ -186,7 +186,7 @@ test('moves fixed line to the end', async t => {
|
||||
test('prints "Already up-to-date"', t => {
|
||||
const output$ = toOutput$({
|
||||
streamParser: createStreamParser(),
|
||||
context: {argv: ['install']},
|
||||
context: { argv: ['install'] },
|
||||
})
|
||||
|
||||
const prefix = process.cwd()
|
||||
@@ -213,7 +213,7 @@ test('prints summary (of current package only)', t => {
|
||||
streamParser: createStreamParser(),
|
||||
context: {
|
||||
argv: ['install'],
|
||||
configs: {prefix} as PnpmConfigs,
|
||||
configs: { prefix } as PnpmConfigs,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -340,7 +340,7 @@ test('prints summary (of current package only)', t => {
|
||||
},
|
||||
prefix,
|
||||
})
|
||||
summaryLogger.debug({prefix})
|
||||
summaryLogger.debug({ prefix })
|
||||
|
||||
t.plan(1)
|
||||
|
||||
@@ -421,7 +421,7 @@ test('prints summary for global installation', t => {
|
||||
},
|
||||
prefix,
|
||||
})
|
||||
summaryLogger.debug({prefix})
|
||||
summaryLogger.debug({ prefix })
|
||||
|
||||
t.plan(1)
|
||||
|
||||
@@ -482,7 +482,7 @@ test('prints summary correctly when the same package is specified both in option
|
||||
},
|
||||
prefix,
|
||||
})
|
||||
summaryLogger.debug({prefix})
|
||||
summaryLogger.debug({ prefix })
|
||||
|
||||
t.plan(1)
|
||||
|
||||
@@ -501,8 +501,8 @@ test('prints summary correctly when the same package is specified both in option
|
||||
test('groups lifecycle output', t => {
|
||||
const output$ = toOutput$({
|
||||
streamParser: createStreamParser(),
|
||||
context: {argv: ['install']},
|
||||
reportingOptions: {outputMaxWidth: 79},
|
||||
context: { argv: ['install'] },
|
||||
reportingOptions: { outputMaxWidth: 79 },
|
||||
})
|
||||
|
||||
const pkgId = 'registry.npmjs.org/foo/1.0.0'
|
||||
@@ -601,7 +601,7 @@ test('groups lifecycle output', t => {
|
||||
test['skip']('prints lifecycle progress', t => {
|
||||
const output$ = toOutput$({
|
||||
streamParser: createStreamParser(),
|
||||
context: {argv: ['install']},
|
||||
context: { argv: ['install'] },
|
||||
})
|
||||
|
||||
const pkgId = 'registry.npmjs.org/foo/1.0.0'
|
||||
@@ -650,7 +650,7 @@ test['skip']('prints lifecycle progress', t => {
|
||||
test('prints generic error', t => {
|
||||
const output$ = toOutput$({
|
||||
streamParser: createStreamParser(),
|
||||
context: {argv: ['install']},
|
||||
context: { argv: ['install'] },
|
||||
})
|
||||
|
||||
const err = new Error('some error')
|
||||
@@ -673,7 +673,7 @@ test('prints generic error', t => {
|
||||
test('prints generic error when recursive install fails', t => {
|
||||
const output$ = toOutput$({
|
||||
streamParser: createStreamParser(),
|
||||
context: {argv: ['recursive']},
|
||||
context: { argv: ['recursive'] },
|
||||
})
|
||||
|
||||
const err = new Error('some error')
|
||||
@@ -698,7 +698,7 @@ test('prints generic error when recursive install fails', t => {
|
||||
test('prints no matching version error when many dist-tags exist', async (t) => {
|
||||
const output$ = toOutput$({
|
||||
streamParser: createStreamParser(),
|
||||
context: {argv: ['install']},
|
||||
context: { argv: ['install'] },
|
||||
})
|
||||
|
||||
t.plan(1)
|
||||
@@ -731,7 +731,7 @@ test('prints no matching version error when many dist-tags exist', async (t) =>
|
||||
test('prints no matching version error when only the latest dist-tag exists', async (t) => {
|
||||
const output$ = toOutput$({
|
||||
streamParser: createStreamParser(),
|
||||
context: {argv: ['install']},
|
||||
context: { argv: ['install'] },
|
||||
})
|
||||
|
||||
t.plan(1)
|
||||
@@ -759,7 +759,7 @@ test('prints no matching version error when only the latest dist-tag exists', as
|
||||
test('prints summary when some packages fail', async (t) => {
|
||||
const output$ = toOutput$({
|
||||
streamParser: createStreamParser(),
|
||||
context: {argv: ['recursive']},
|
||||
context: { argv: ['recursive'] },
|
||||
})
|
||||
|
||||
t.plan(1)
|
||||
@@ -827,10 +827,10 @@ test('prints summary when some packages fail', async (t) => {
|
||||
test('prints info', t => {
|
||||
const output$ = toOutput$({
|
||||
streamParser: createStreamParser(),
|
||||
context: {argv: ['install']},
|
||||
context: { argv: ['install'] },
|
||||
})
|
||||
|
||||
logger.info({message: 'info message', prefix: process.cwd()})
|
||||
logger.info({ message: 'info message', prefix: process.cwd() })
|
||||
|
||||
t.plan(1)
|
||||
|
||||
@@ -848,8 +848,8 @@ test('prints progress of big files download', async t => {
|
||||
|
||||
let output$ = toOutput$({
|
||||
streamParser: createStreamParser(),
|
||||
context: {argv: ['install']},
|
||||
reportingOptions: {throttleProgress: 0},
|
||||
context: { argv: ['install'] },
|
||||
reportingOptions: { throttleProgress: 0 },
|
||||
})
|
||||
.map(normalizeNewline) as most.Stream<string>
|
||||
const stream$: most.Stream<string>[] = []
|
||||
@@ -990,7 +990,7 @@ test('prints progress of big files download', async t => {
|
||||
test('prints added/removed stats during installation', t => {
|
||||
const output$ = toOutput$({
|
||||
streamParser: createStreamParser(),
|
||||
context: {argv: ['install']},
|
||||
context: { argv: ['install'] },
|
||||
})
|
||||
const prefix = process.cwd()
|
||||
|
||||
@@ -1014,7 +1014,7 @@ test('prints added/removed stats during installation', t => {
|
||||
test('prints added/removed stats during installation when 0 removed', t => {
|
||||
const output$ = toOutput$({
|
||||
streamParser: createStreamParser(),
|
||||
context: {argv: ['install']},
|
||||
context: { argv: ['install'] },
|
||||
})
|
||||
const prefix = process.cwd()
|
||||
|
||||
@@ -1038,7 +1038,7 @@ test('prints added/removed stats during installation when 0 removed', t => {
|
||||
test('prints only the added stats if nothing was removed', t => {
|
||||
const output$ = toOutput$({
|
||||
streamParser: createStreamParser(),
|
||||
context: {argv: ['install']},
|
||||
context: { argv: ['install'] },
|
||||
})
|
||||
const prefix = process.cwd()
|
||||
|
||||
@@ -1062,7 +1062,7 @@ test('prints only the added stats if nothing was removed', t => {
|
||||
test('prints only the removed stats if nothing was added', t => {
|
||||
const output$ = toOutput$({
|
||||
streamParser: createStreamParser(),
|
||||
context: {argv: ['install']},
|
||||
context: { argv: ['install'] },
|
||||
})
|
||||
const prefix = process.cwd()
|
||||
|
||||
@@ -1086,8 +1086,8 @@ test('prints only the removed stats if nothing was added', t => {
|
||||
test('prints only the added stats if nothing was removed and a lot added', t => {
|
||||
const output$ = toOutput$({
|
||||
streamParser: createStreamParser(),
|
||||
context: {argv: ['install']},
|
||||
reportingOptions: {outputMaxWidth: 20},
|
||||
context: { argv: ['install'] },
|
||||
reportingOptions: { outputMaxWidth: 20 },
|
||||
})
|
||||
const prefix = process.cwd()
|
||||
|
||||
@@ -1111,8 +1111,8 @@ test('prints only the added stats if nothing was removed and a lot added', t =>
|
||||
test('prints only the removed stats if nothing was added and a lot removed', t => {
|
||||
const output$ = toOutput$({
|
||||
streamParser: createStreamParser(),
|
||||
context: {argv: ['install']},
|
||||
reportingOptions: {outputMaxWidth: 20},
|
||||
context: { argv: ['install'] },
|
||||
reportingOptions: { outputMaxWidth: 20 },
|
||||
})
|
||||
const prefix = process.cwd()
|
||||
|
||||
@@ -1136,8 +1136,8 @@ test('prints only the removed stats if nothing was added and a lot removed', t =
|
||||
test('prints at least one remove sign when removed !== 0', t => {
|
||||
const output$ = toOutput$({
|
||||
streamParser: createStreamParser(),
|
||||
context: {argv: ['install']},
|
||||
reportingOptions: {outputMaxWidth: 20},
|
||||
context: { argv: ['install'] },
|
||||
reportingOptions: { outputMaxWidth: 20 },
|
||||
})
|
||||
const prefix = process.cwd()
|
||||
|
||||
@@ -1161,8 +1161,8 @@ test('prints at least one remove sign when removed !== 0', t => {
|
||||
test('prints at least one add sign when added !== 0', t => {
|
||||
const output$ = toOutput$({
|
||||
streamParser: createStreamParser(),
|
||||
context: {argv: ['install']},
|
||||
reportingOptions: {outputMaxWidth: 20},
|
||||
context: { argv: ['install'] },
|
||||
reportingOptions: { outputMaxWidth: 20 },
|
||||
})
|
||||
const prefix = process.cwd()
|
||||
|
||||
@@ -1186,7 +1186,7 @@ test('prints at least one add sign when added !== 0', t => {
|
||||
test('prints just removed during uninstallation', t => {
|
||||
const output$ = toOutput$({
|
||||
streamParser: createStreamParser(),
|
||||
context: {argv: ['uninstall']},
|
||||
context: { argv: ['uninstall'] },
|
||||
})
|
||||
const prefix = process.cwd()
|
||||
|
||||
@@ -1212,7 +1212,7 @@ test('prints added/removed stats and warnings during recursive installation', t
|
||||
streamParser: createStreamParser(),
|
||||
context: {
|
||||
argv: ['recursive'],
|
||||
configs: {prefix: rootPrefix} as PnpmConfigs,
|
||||
configs: { prefix: rootPrefix } as PnpmConfigs,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1273,9 +1273,9 @@ test('recursive installation: prints only the added stats if nothing was removed
|
||||
streamParser: createStreamParser(),
|
||||
context: {
|
||||
argv: ['recursive'],
|
||||
configs: {prefix: '/home/jane/repo'} as PnpmConfigs,
|
||||
configs: { prefix: '/home/jane/repo' } as PnpmConfigs,
|
||||
},
|
||||
reportingOptions: {outputMaxWidth: 60},
|
||||
reportingOptions: { outputMaxWidth: 60 },
|
||||
})
|
||||
|
||||
statsLogger.debug({ removed: 0, prefix: '/home/jane/repo/pkg-1' })
|
||||
@@ -1299,9 +1299,9 @@ test('recursive installation: prints only the removed stats if nothing was added
|
||||
streamParser: createStreamParser(),
|
||||
context: {
|
||||
argv: ['recursive'],
|
||||
configs: {prefix: '/home/jane/repo'} as PnpmConfigs,
|
||||
configs: { prefix: '/home/jane/repo' } as PnpmConfigs,
|
||||
},
|
||||
reportingOptions: {outputMaxWidth: 60},
|
||||
reportingOptions: { outputMaxWidth: 60 },
|
||||
})
|
||||
|
||||
statsLogger.debug({ removed: 190, prefix: '/home/jane/repo/pkg-1' })
|
||||
@@ -1325,9 +1325,9 @@ test('recursive installation: prints at least one remove sign when removed !== 0
|
||||
streamParser: createStreamParser(),
|
||||
context: {
|
||||
argv: ['recursive'],
|
||||
configs: {prefix: '/home/jane/repo'} as PnpmConfigs,
|
||||
configs: { prefix: '/home/jane/repo' } as PnpmConfigs,
|
||||
},
|
||||
reportingOptions: {outputMaxWidth: 62},
|
||||
reportingOptions: { outputMaxWidth: 62 },
|
||||
})
|
||||
|
||||
statsLogger.debug({ removed: 1, prefix: '/home/jane/repo/pkg-1' })
|
||||
@@ -1351,9 +1351,9 @@ test('recursive installation: prints at least one add sign when added !== 0', t
|
||||
streamParser: createStreamParser(),
|
||||
context: {
|
||||
argv: ['recursive'],
|
||||
configs: {prefix: '/home/jane/repo'} as PnpmConfigs,
|
||||
configs: { prefix: '/home/jane/repo' } as PnpmConfigs,
|
||||
},
|
||||
reportingOptions: {outputMaxWidth: 62},
|
||||
reportingOptions: { outputMaxWidth: 62 },
|
||||
})
|
||||
|
||||
statsLogger.debug({ removed: 100, prefix: '/home/jane/repo/pkg-1' })
|
||||
@@ -1377,9 +1377,9 @@ test('recursive uninstall: prints removed packages number', t => {
|
||||
streamParser: createStreamParser(),
|
||||
context: {
|
||||
argv: ['recursive', 'uninstall'],
|
||||
configs: {prefix: '/home/jane/repo'} as PnpmConfigs,
|
||||
configs: { prefix: '/home/jane/repo' } as PnpmConfigs,
|
||||
},
|
||||
reportingOptions: {outputMaxWidth: 62},
|
||||
reportingOptions: { outputMaxWidth: 62 },
|
||||
})
|
||||
|
||||
statsLogger.debug({ removed: 1, prefix: '/home/jane/repo/pkg-1' })
|
||||
@@ -1402,7 +1402,7 @@ test('install: print hook message', t => {
|
||||
streamParser: createStreamParser(),
|
||||
context: {
|
||||
argv: ['install'],
|
||||
configs: {prefix: '/home/jane/repo'} as PnpmConfigs,
|
||||
configs: { prefix: '/home/jane/repo' } as PnpmConfigs,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1431,7 +1431,7 @@ test('recursive: print hook message', t => {
|
||||
streamParser: createStreamParser(),
|
||||
context: {
|
||||
argv: ['recursive'],
|
||||
configs: {prefix: '/home/jane/repo'} as PnpmConfigs,
|
||||
configs: { prefix: '/home/jane/repo' } as PnpmConfigs,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1461,7 +1461,7 @@ test('prints skipped optional dependency info message', t => {
|
||||
streamParser: createStreamParser(),
|
||||
context: {
|
||||
argv: ['install'],
|
||||
configs: {prefix} as PnpmConfigs,
|
||||
configs: { prefix } as PnpmConfigs,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "tslint -c tslint.json --project .",
|
||||
"lint": "tslint -c tslint.json src/**/*.ts test/**/*.ts",
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"test": "npm run tsc && npm run lint && ts-node test && mos t",
|
||||
"md": "mos",
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"fix": "tslint -c tslint.json --project . --fix",
|
||||
"lint": "tslint -c tslint.json --project .",
|
||||
"fix": "tslint -c tslint.json src/**/*.ts test/**/*.ts --fix",
|
||||
"lint": "tslint -c tslint.json src/**/*.ts test/**/*.ts",
|
||||
"test": "npm run tsc && npm run lint && ts-node test --type-check && mos t",
|
||||
"prepublishOnly": "tsc",
|
||||
"tsc": "tsc",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import test = require('tape')
|
||||
import dh, {forPackages as dhForPackages} from 'dependencies-hierarchy'
|
||||
import dh, { forPackages as dhForPackages } from 'dependencies-hierarchy'
|
||||
import path = require('path')
|
||||
|
||||
const fixtures = path.join(__dirname, 'fixtures')
|
||||
@@ -9,138 +9,138 @@ const withFileDepFixture = path.join(fixtures, 'with-file-dep')
|
||||
const withLinksOnlyFixture = path.join(fixtures, 'with-links-only')
|
||||
|
||||
test('one package depth 0', async t => {
|
||||
const tree = await dh(generalFixture, {depth: 0})
|
||||
const tree = await dh(generalFixture, { depth: 0 })
|
||||
|
||||
t.deepEqual(tree, [
|
||||
{
|
||||
pkg: {
|
||||
name: 'minimatch',
|
||||
path: 'registry.npmjs.org/minimatch/3.0.4',
|
||||
version: '3.0.4',
|
||||
}
|
||||
{
|
||||
pkg: {
|
||||
name: 'minimatch',
|
||||
path: 'registry.npmjs.org/minimatch/3.0.4',
|
||||
version: '3.0.4',
|
||||
},
|
||||
{
|
||||
pkg: {
|
||||
name: 'rimraf',
|
||||
path: 'registry.npmjs.org/rimraf/2.5.1',
|
||||
version: '2.5.1',
|
||||
},
|
||||
},
|
||||
{
|
||||
pkg: {
|
||||
name: 'rimraf',
|
||||
path: 'registry.npmjs.org/rimraf/2.5.1',
|
||||
version: '2.5.1',
|
||||
},
|
||||
{
|
||||
pkg: {
|
||||
name: 'is-positive',
|
||||
path: 'registry.npmjs.org/is-positive/1.0.0',
|
||||
version: '1.0.0',
|
||||
}
|
||||
},
|
||||
{
|
||||
pkg: {
|
||||
name: 'is-positive',
|
||||
path: 'registry.npmjs.org/is-positive/1.0.0',
|
||||
version: '1.0.0',
|
||||
},
|
||||
{
|
||||
pkg: {
|
||||
name: 'is-negative',
|
||||
path: 'registry.npmjs.org/is-negative/1.0.0',
|
||||
version: '1.0.0',
|
||||
}
|
||||
},
|
||||
{
|
||||
pkg: {
|
||||
name: 'is-negative',
|
||||
path: 'registry.npmjs.org/is-negative/1.0.0',
|
||||
version: '1.0.0',
|
||||
},
|
||||
},
|
||||
])
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('one package depth 1', async t => {
|
||||
const tree = await dh(generalFixture, {depth: 1})
|
||||
const tree = await dh(generalFixture, { depth: 1 })
|
||||
|
||||
t.deepEqual(tree, [
|
||||
{
|
||||
pkg: {
|
||||
name: 'minimatch',
|
||||
path: 'registry.npmjs.org/minimatch/3.0.4',
|
||||
version: '3.0.4',
|
||||
},
|
||||
dependencies: [
|
||||
{
|
||||
pkg: {
|
||||
name: 'brace-expansion',
|
||||
path: 'registry.npmjs.org/brace-expansion/1.1.8',
|
||||
version: '1.1.8',
|
||||
}
|
||||
{
|
||||
pkg: {
|
||||
name: 'minimatch',
|
||||
path: 'registry.npmjs.org/minimatch/3.0.4',
|
||||
version: '3.0.4',
|
||||
},
|
||||
dependencies: [
|
||||
{
|
||||
pkg: {
|
||||
name: 'brace-expansion',
|
||||
path: 'registry.npmjs.org/brace-expansion/1.1.8',
|
||||
version: '1.1.8',
|
||||
}
|
||||
],
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
pkg: {
|
||||
name: 'rimraf',
|
||||
path: 'registry.npmjs.org/rimraf/2.5.1',
|
||||
version: '2.5.1',
|
||||
},
|
||||
{
|
||||
pkg: {
|
||||
name: 'rimraf',
|
||||
path: 'registry.npmjs.org/rimraf/2.5.1',
|
||||
version: '2.5.1',
|
||||
dependencies: [
|
||||
{
|
||||
pkg: {
|
||||
name: 'glob',
|
||||
path: 'registry.npmjs.org/glob/6.0.4',
|
||||
version: '6.0.4',
|
||||
},
|
||||
},
|
||||
dependencies: [
|
||||
{
|
||||
pkg: {
|
||||
name: 'glob',
|
||||
path: 'registry.npmjs.org/glob/6.0.4',
|
||||
version: '6.0.4',
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
pkg: {
|
||||
name: 'is-positive',
|
||||
path: 'registry.npmjs.org/is-positive/1.0.0',
|
||||
version: '1.0.0',
|
||||
},
|
||||
{
|
||||
pkg: {
|
||||
name: 'is-positive',
|
||||
path: 'registry.npmjs.org/is-positive/1.0.0',
|
||||
version: '1.0.0',
|
||||
}
|
||||
},
|
||||
{
|
||||
pkg: {
|
||||
name: 'is-negative',
|
||||
path: 'registry.npmjs.org/is-negative/1.0.0',
|
||||
version: '1.0.0',
|
||||
}
|
||||
},
|
||||
{
|
||||
pkg: {
|
||||
name: 'is-negative',
|
||||
path: 'registry.npmjs.org/is-negative/1.0.0',
|
||||
version: '1.0.0',
|
||||
},
|
||||
},
|
||||
])
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('only prod depth 0', async t => {
|
||||
const tree = await dh(generalFixture, {depth: 0, only: 'prod'})
|
||||
const tree = await dh(generalFixture, { depth: 0, only: 'prod' })
|
||||
|
||||
t.deepEqual(tree, [
|
||||
{
|
||||
pkg: {
|
||||
name: 'minimatch',
|
||||
path: 'registry.npmjs.org/minimatch/3.0.4',
|
||||
version: '3.0.4',
|
||||
},
|
||||
{
|
||||
pkg: {
|
||||
name: 'minimatch',
|
||||
path: 'registry.npmjs.org/minimatch/3.0.4',
|
||||
version: '3.0.4',
|
||||
},
|
||||
{
|
||||
pkg: {
|
||||
name: 'rimraf',
|
||||
path: 'registry.npmjs.org/rimraf/2.5.1',
|
||||
version: '2.5.1',
|
||||
},
|
||||
},
|
||||
{
|
||||
pkg: {
|
||||
name: 'rimraf',
|
||||
path: 'registry.npmjs.org/rimraf/2.5.1',
|
||||
version: '2.5.1',
|
||||
},
|
||||
},
|
||||
])
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('only dev depth 0', async t => {
|
||||
const tree = await dh(generalFixture, {depth: 0, only: 'dev'})
|
||||
const tree = await dh(generalFixture, { depth: 0, only: 'dev' })
|
||||
|
||||
t.deepEqual(tree, [
|
||||
{
|
||||
pkg: {
|
||||
name: 'is-positive',
|
||||
path: 'registry.npmjs.org/is-positive/1.0.0',
|
||||
version: '1.0.0',
|
||||
}
|
||||
},
|
||||
{
|
||||
pkg: {
|
||||
name: 'is-positive',
|
||||
path: 'registry.npmjs.org/is-positive/1.0.0',
|
||||
version: '1.0.0',
|
||||
}
|
||||
},
|
||||
])
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('hierarchy for no packages', async t => {
|
||||
const tree = await dhForPackages([], generalFixture, {depth: 100})
|
||||
const tree = await dhForPackages([], generalFixture, { depth: 100 })
|
||||
|
||||
t.deepEqual(tree, [])
|
||||
|
||||
@@ -148,17 +148,17 @@ test('hierarchy for no packages', async t => {
|
||||
})
|
||||
|
||||
test('filter 1 package with depth 0', async t => {
|
||||
const tree = await dhForPackages([{name: 'rimraf', range: '*'}], generalFixture, {depth: 0})
|
||||
const tree = await dhForPackages([{ name: 'rimraf', range: '*' }], generalFixture, { depth: 0 })
|
||||
|
||||
t.deepEqual(tree, [
|
||||
{
|
||||
pkg: {
|
||||
name: 'rimraf',
|
||||
path: 'registry.npmjs.org/rimraf/2.5.1',
|
||||
version: '2.5.1',
|
||||
},
|
||||
searched: true,
|
||||
{
|
||||
pkg: {
|
||||
name: 'rimraf',
|
||||
path: 'registry.npmjs.org/rimraf/2.5.1',
|
||||
version: '2.5.1',
|
||||
},
|
||||
searched: true,
|
||||
},
|
||||
])
|
||||
|
||||
t.end()
|
||||
@@ -167,9 +167,9 @@ test('filter 1 package with depth 0', async t => {
|
||||
test('filter 2 packages with depth 100', async t => {
|
||||
const searched = [
|
||||
'minimatch',
|
||||
{name: 'once', range: '1.4'},
|
||||
{ name: 'once', range: '1.4' },
|
||||
]
|
||||
const tree = await dhForPackages(searched, generalFixture, {depth: 100})
|
||||
const tree = await dhForPackages(searched, generalFixture, { depth: 100 })
|
||||
|
||||
t.deepEqual(tree, [
|
||||
{
|
||||
@@ -238,10 +238,10 @@ test('filter 2 packages with depth 100', async t => {
|
||||
|
||||
test('filter 2 packages with ranges that are not satisfied', async t => {
|
||||
const searched = [
|
||||
{name: 'minimatch', range: '100'},
|
||||
{name: 'once', range: '100'},
|
||||
{ name: 'minimatch', range: '100' },
|
||||
{ name: 'once', range: '100' },
|
||||
]
|
||||
const tree = await dhForPackages(searched, generalFixture, {depth: 100})
|
||||
const tree = await dhForPackages(searched, generalFixture, { depth: 100 })
|
||||
|
||||
t.deepEqual(tree, [])
|
||||
|
||||
@@ -249,7 +249,7 @@ test('filter 2 packages with ranges that are not satisfied', async t => {
|
||||
})
|
||||
|
||||
test('circular dependency', async t => {
|
||||
const tree = await dh(circularFixture, {depth: 1000})
|
||||
const tree = await dh(circularFixture, { depth: 1000 })
|
||||
|
||||
t.deepEqual(tree, require('./circularTree.json'))
|
||||
|
||||
@@ -257,7 +257,7 @@ test('circular dependency', async t => {
|
||||
})
|
||||
|
||||
test('local package depth 0', async t => {
|
||||
const tree = await dh(withFileDepFixture, {depth: 1})
|
||||
const tree = await dh(withFileDepFixture, { depth: 1 })
|
||||
|
||||
t.deepEqual(tree, [
|
||||
{
|
||||
@@ -272,7 +272,7 @@ test('local package depth 0', async t => {
|
||||
})
|
||||
|
||||
test('on a package that has only links', async t => {
|
||||
const tree = await dh(withLinksOnlyFixture, {depth: 1000})
|
||||
const tree = await dh(withLinksOnlyFixture, { depth: 1000 })
|
||||
|
||||
t.deepEqual(tree, [
|
||||
{
|
||||
@@ -288,9 +288,9 @@ test('on a package that has only links', async t => {
|
||||
})
|
||||
|
||||
test('filter on a package that has only links', async t => {
|
||||
t.deepEqual(await dhForPackages(['rimraf'], withLinksOnlyFixture, {depth: 1000}), [], 'not found')
|
||||
t.deepEqual(await dhForPackages([{ name: 'general', range: '2' }], withLinksOnlyFixture, {depth: 1000}), [], 'not found')
|
||||
t.deepEqual(await dhForPackages(['general'], withLinksOnlyFixture, {depth: 1000}), [
|
||||
t.deepEqual(await dhForPackages(['rimraf'], withLinksOnlyFixture, { depth: 1000 }), [], 'not found')
|
||||
t.deepEqual(await dhForPackages([{ name: 'general', range: '2' }], withLinksOnlyFixture, { depth: 1000 }), [], 'not found')
|
||||
t.deepEqual(await dhForPackages(['general'], withLinksOnlyFixture, { depth: 1000 }), [
|
||||
{
|
||||
pkg: {
|
||||
name: 'general',
|
||||
|
||||
@@ -70,14 +70,13 @@
|
||||
"start": "npm run tsc -- --watch",
|
||||
"commit": "commit",
|
||||
"commitmsg": "commitlint -e",
|
||||
"lint": "tslint -c tslint.json --project .",
|
||||
"lint-test": "tslint -c tslint.json --project test",
|
||||
"lint": "tslint -c tslint.json src/**/*.ts test/**/*.ts",
|
||||
"pnpm-registry-mock": "pnpm-registry-mock",
|
||||
"test:tap": "ts-node test",
|
||||
"test:e2e": "npm-run-all -p -r pnpm-registry-mock test:tap",
|
||||
"pretest": "rimraf ../.tmp/ && pnpm-registry-mock prepare && ts-node test/pretest",
|
||||
"test-with-preview": "npm run lint && npm run lint-test && npm run test:e2e",
|
||||
"test": "npm run lint && npm run lint-test && npm run tsc && npm run test:e2e",
|
||||
"test-with-preview": "npm run lint && npm run test:e2e",
|
||||
"test": "npm run lint && npm run tsc && npm run test:e2e",
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"prepublishOnly": "npm run tsc",
|
||||
"runPrepareFixtures": "node ../pnpm/lib/bin/pnpm.js m i --shrinkwrap-only --registry http://localhost:4873/ --ignore-scripts --force",
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"fix": "tslint -c tslint.json --project . --fix",
|
||||
"lint": "tslint -c tslint.json --project .",
|
||||
"fix": "tslint -c tslint.json src/**/*.ts test/**/*.ts --fix",
|
||||
"lint": "tslint -c tslint.json src/**/*.ts test/**/*.ts",
|
||||
"md": "tsc && mos",
|
||||
"prepareFixtures": "cd test && pnpm recursive install --no-link-workspace-packages && cd ..",
|
||||
"prepublishOnly": "tsc",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import test = require('tape')
|
||||
import list, {forPackages as listForPackages} from 'pnpm-list'
|
||||
import list, { forPackages as listForPackages } from 'pnpm-list'
|
||||
import path = require('path')
|
||||
import {stripIndent} from 'common-tags'
|
||||
import { stripIndent } from 'common-tags'
|
||||
import chalk from 'chalk'
|
||||
|
||||
const highlighted = chalk.yellow.bgBlack
|
||||
@@ -57,7 +57,7 @@ test('list with default parameters in pkg that has no version', async t => {
|
||||
})
|
||||
|
||||
test('list dev only', async t => {
|
||||
t.equal(await list(fixture, {only: 'dev'}), stripIndent`
|
||||
t.equal(await list(fixture, { only: 'dev' }), stripIndent`
|
||||
fixture@1.0.0 ${fixture}
|
||||
└── is-positive@3.1.0
|
||||
` + '\n')
|
||||
@@ -66,7 +66,7 @@ test('list dev only', async t => {
|
||||
})
|
||||
|
||||
test('list prod only', async t => {
|
||||
t.equal(await list(fixture, {only: 'prod'}), stripIndent`
|
||||
t.equal(await list(fixture, { only: 'prod' }), stripIndent`
|
||||
fixture@1.0.0 ${fixture}
|
||||
└── write-json-file@2.2.0
|
||||
` + '\n')
|
||||
@@ -75,7 +75,7 @@ test('list prod only', async t => {
|
||||
})
|
||||
|
||||
test('list prod only with depth 2', async t => {
|
||||
t.equal(await list(fixture, {only: 'prod', depth: 2}), stripIndent`
|
||||
t.equal(await list(fixture, { only: 'prod', depth: 2 }), stripIndent`
|
||||
fixture@1.0.0 ${fixture}
|
||||
└─┬ write-json-file@2.2.0
|
||||
├── detect-indent@5.0.0
|
||||
@@ -95,7 +95,7 @@ test('list prod only with depth 2', async t => {
|
||||
})
|
||||
|
||||
test('list with depth 1', async t => {
|
||||
t.equal(await list(fixture, {depth: 1}), stripIndent`
|
||||
t.equal(await list(fixture, { depth: 1 }), stripIndent`
|
||||
fixture@1.0.0 ${fixture}
|
||||
├── is-negative@2.1.0
|
||||
├── is-positive@3.1.0
|
||||
@@ -112,7 +112,7 @@ test('list with depth 1', async t => {
|
||||
})
|
||||
|
||||
test('list with depth 1 and selected packages', async t => {
|
||||
t.equal(await listForPackages(['make-dir', 'pify@2', 'sort-keys@2', 'is-negative'], fixture, {depth: 1}), stripIndent`
|
||||
t.equal(await listForPackages(['make-dir', 'pify@2', 'sort-keys@2', 'is-negative'], fixture, { depth: 1 }), stripIndent`
|
||||
fixture@1.0.0 ${fixture}
|
||||
├── ${highlighted('is-negative@2.1.0')}
|
||||
└─┬ write-json-file@2.2.0
|
||||
@@ -124,7 +124,7 @@ test('list with depth 1 and selected packages', async t => {
|
||||
})
|
||||
|
||||
test('list in long format', async t => {
|
||||
t.equal(await list(fixture, {long: true}), stripIndent`
|
||||
t.equal(await list(fixture, { long: true }), stripIndent`
|
||||
fixture@1.0.0 ${fixture}
|
||||
├── is-negative@2.1.0
|
||||
│ Check if something is a negative number
|
||||
@@ -144,7 +144,7 @@ test('list in long format', async t => {
|
||||
})
|
||||
|
||||
test('parseable list with depth 1', async t => {
|
||||
t.equal(await list(fixture, {parseable: true, depth: 1}), stripIndent`
|
||||
t.equal(await list(fixture, { parseable: true, depth: 1 }), stripIndent`
|
||||
${fixture}
|
||||
${path.join(fixture, 'node_modules/.registry.npmjs.org/detect-indent/5.0.0')}
|
||||
${path.join(fixture, 'node_modules/.registry.npmjs.org/graceful-fs/4.1.11')}
|
||||
@@ -161,7 +161,7 @@ test('parseable list with depth 1', async t => {
|
||||
})
|
||||
|
||||
test('parseable list with depth 1 and dev only', async t => {
|
||||
t.equal(await list(fixture, {parseable: true, depth: 1, only: 'dev'}), stripIndent`
|
||||
t.equal(await list(fixture, { parseable: true, depth: 1, only: 'dev' }), stripIndent`
|
||||
${fixture}
|
||||
${path.join(fixture, 'node_modules/.registry.npmjs.org/is-positive/3.1.0')}
|
||||
` + '\n')
|
||||
@@ -170,7 +170,7 @@ test('parseable list with depth 1 and dev only', async t => {
|
||||
})
|
||||
|
||||
test('long parseable list with depth 1', async t => {
|
||||
t.equal(await list(fixture, {parseable: true, depth: 1, long: true}), stripIndent`
|
||||
t.equal(await list(fixture, { parseable: true, depth: 1, long: true }), stripIndent`
|
||||
${fixture}:fixture@1.0.0
|
||||
${path.join(fixture, 'node_modules/.registry.npmjs.org/detect-indent/5.0.0')}:detect-indent@5.0.0
|
||||
${path.join(fixture, 'node_modules/.registry.npmjs.org/graceful-fs/4.1.11')}:graceful-fs@4.1.11
|
||||
@@ -187,7 +187,7 @@ test('long parseable list with depth 1', async t => {
|
||||
})
|
||||
|
||||
test('long parseable list with depth 1 when package has no version', async t => {
|
||||
t.equal(await list(fixtureWithNoPkgVersion, {parseable: true, depth: 1, long: true}), stripIndent`
|
||||
t.equal(await list(fixtureWithNoPkgVersion, { parseable: true, depth: 1, long: true }), stripIndent`
|
||||
${fixtureWithNoPkgVersion}:fixture
|
||||
${path.join(fixtureWithNoPkgVersion, 'node_modules/.registry.npmjs.org/detect-indent/5.0.0')}:detect-indent@5.0.0
|
||||
${path.join(fixtureWithNoPkgVersion, 'node_modules/.registry.npmjs.org/graceful-fs/4.1.11')}:graceful-fs@4.1.11
|
||||
@@ -204,7 +204,7 @@ test('long parseable list with depth 1 when package has no version', async t =>
|
||||
})
|
||||
|
||||
test('long parseable list with depth 1 when package has no name and no version', async t => {
|
||||
t.equal(await list(fixtureWithNoPkgNameAndNoVersion, {parseable: true, depth: 1, long: true}), stripIndent`
|
||||
t.equal(await list(fixtureWithNoPkgNameAndNoVersion, { parseable: true, depth: 1, long: true }), stripIndent`
|
||||
${fixtureWithNoPkgNameAndNoVersion}
|
||||
${path.join(fixtureWithNoPkgNameAndNoVersion, 'node_modules/.registry.npmjs.org/detect-indent/5.0.0')}:detect-indent@5.0.0
|
||||
${path.join(fixtureWithNoPkgNameAndNoVersion, 'node_modules/.registry.npmjs.org/graceful-fs/4.1.11')}:graceful-fs@4.1.11
|
||||
@@ -226,6 +226,6 @@ test('print empty', async t => {
|
||||
})
|
||||
|
||||
test("don't print empty", async t => {
|
||||
t.equal(await list(emptyFixture, {alwaysPrintRootPackage: false}), '')
|
||||
t.equal(await list(emptyFixture, { alwaysPrintRootPackage: false }), '')
|
||||
t.end()
|
||||
})
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "tslint -c tslint.json --project .",
|
||||
"lint": "tslint -c tslint.json src/**/*.ts test/**/*.ts",
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"test": "npm run tsc && npm run lint && ts-node test --type-check && mos t",
|
||||
"md": "mos",
|
||||
"prepublishOnly": "npm run tsc",
|
||||
"fix": "tslint -c tslint.json --project . --fix"
|
||||
"fix": "tslint -c tslint.json src/**/*.ts test/**/*.ts --fix"
|
||||
},
|
||||
"repository": "https://github.com/pnpm/pnpm/blob/master/packages/modules-yaml",
|
||||
"keywords": [
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "npm run tsc && tslint --config tslint.json --project . && ts-node test --type-check",
|
||||
"test": "npm run tsc && tslint --config tslint.json src/**/*.ts test/**/*.ts && ts-node test --type-check",
|
||||
"prepublishOnly": "tsc",
|
||||
"tsc": "tsc",
|
||||
"md": "mos"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import outdated, {forPackages as outdatedForPackages} from '@pnpm/outdated'
|
||||
import outdated, { forPackages as outdatedForPackages } from '@pnpm/outdated'
|
||||
import path = require('path')
|
||||
import test = require('tape')
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"start": "npm run tsc -- --watch",
|
||||
"lint": "tslint -c tslint.json --project .",
|
||||
"lint": "tslint -c tslint.json src/**/*.ts test/**/*.ts",
|
||||
"tsc": "rimraf lib && tsc --pretty",
|
||||
"test": "npm run lint && npm run tsc && rimraf .store && ts-node test --type-check && mos t",
|
||||
"md": "mos",
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
///<reference path="../typings/index.d.ts" />
|
||||
import {streamParser} from '@pnpm/logger'
|
||||
import { streamParser } from '@pnpm/logger'
|
||||
import test = require('tape')
|
||||
import createPackageRequester, { PackageResponse, PackageFilesResponse } from '@pnpm/package-requester'
|
||||
import createResolver from '@pnpm/npm-resolver'
|
||||
import { ResolveFunction } from '@pnpm/resolver-base'
|
||||
import createFetcher from '@pnpm/tarball-fetcher'
|
||||
import {PackageJson} from '@pnpm/types'
|
||||
import { PackageJson } from '@pnpm/types'
|
||||
import localResolver from '@pnpm/local-resolver'
|
||||
import fs = require('mz/fs')
|
||||
import path = require('path')
|
||||
@@ -45,7 +46,7 @@ test('request package', async t => {
|
||||
})
|
||||
t.equal(typeof requestPackage, 'function')
|
||||
|
||||
const pkgResponse = await requestPackage({alias: 'is-positive', pref: '1.0.0'}, {
|
||||
const pkgResponse = await requestPackage({ alias: 'is-positive', pref: '1.0.0' }, {
|
||||
downloadPriority: 0,
|
||||
loggedPkg: {
|
||||
rawSpec: 'is-positive@1.0.0',
|
||||
@@ -97,7 +98,7 @@ test('request package but skip fetching', async t => {
|
||||
})
|
||||
t.equal(typeof requestPackage, 'function')
|
||||
|
||||
const pkgResponse = await requestPackage({alias: 'is-positive', pref: '1.0.0'}, {
|
||||
const pkgResponse = await requestPackage({ alias: 'is-positive', pref: '1.0.0' }, {
|
||||
skipFetch: true,
|
||||
downloadPriority: 0,
|
||||
loggedPkg: {
|
||||
@@ -142,7 +143,7 @@ test('request package but skip fetching, when resolution is already available',
|
||||
})
|
||||
t.equal(typeof requestPackage, 'function')
|
||||
|
||||
const pkgResponse = await requestPackage({alias: 'is-positive', pref: '1.0.0'}, {
|
||||
const pkgResponse = await requestPackage({ alias: 'is-positive', pref: '1.0.0' }, {
|
||||
currentPkgId: 'registry.npmjs.org/is-positive/1.0.0',
|
||||
update: false,
|
||||
skipFetch: true,
|
||||
@@ -196,7 +197,7 @@ test('refetch local tarball if its integrity has changed', async t => {
|
||||
const tarballRelativePath = path.relative(prefix, tarballPath)
|
||||
await ncp(path.join(__dirname, 'pnpm-package-requester-0.8.1.tgz'), tarballPath)
|
||||
const tarball = `file:${tarballRelativePath}`
|
||||
const wantedPackage = {pref: tarball}
|
||||
const wantedPackage = { pref: tarball }
|
||||
const storePath = path.join(__dirname, '..', '.store')
|
||||
const pkgId = `file:${normalize(tarballRelativePath)}`
|
||||
const requestPackageOpts = {
|
||||
@@ -215,7 +216,7 @@ test('refetch local tarball if its integrity has changed', async t => {
|
||||
const storeIndex = {}
|
||||
|
||||
{
|
||||
const requestPackage = createPackageRequester(localResolver as any, fetch, {
|
||||
const requestPackage = createPackageRequester(localResolver as ResolveFunction, fetch, {
|
||||
storePath,
|
||||
storeIndex,
|
||||
})
|
||||
@@ -242,7 +243,7 @@ test('refetch local tarball if its integrity has changed', async t => {
|
||||
await delay(50)
|
||||
|
||||
{
|
||||
const requestPackage = createPackageRequester(localResolver as any, fetch, {
|
||||
const requestPackage = createPackageRequester(localResolver as ResolveFunction, fetch, {
|
||||
storePath,
|
||||
storeIndex,
|
||||
})
|
||||
@@ -266,7 +267,7 @@ test('refetch local tarball if its integrity has changed', async t => {
|
||||
}
|
||||
|
||||
{
|
||||
const requestPackage = createPackageRequester(localResolver as any, fetch, {
|
||||
const requestPackage = createPackageRequester(localResolver as ResolveFunction, fetch, {
|
||||
storePath,
|
||||
storeIndex,
|
||||
})
|
||||
@@ -297,7 +298,7 @@ test('refetch local tarball if its integrity has changed. The requester does not
|
||||
const tarballPath = path.join(prefix, 'tarball.tgz')
|
||||
await ncp(path.join(__dirname, 'pnpm-package-requester-0.8.1.tgz'), tarballPath)
|
||||
const tarball = `file:${tarballPath}`
|
||||
const wantedPackage = {pref: tarball}
|
||||
const wantedPackage = { pref: tarball }
|
||||
const storePath = path.join(__dirname, '..', '.store')
|
||||
const requestPackageOpts = {
|
||||
downloadPriority: 0,
|
||||
@@ -313,7 +314,7 @@ test('refetch local tarball if its integrity has changed. The requester does not
|
||||
const storeIndex = {}
|
||||
|
||||
{
|
||||
const requestPackage = createPackageRequester(localResolver as any, fetch, {
|
||||
const requestPackage = createPackageRequester(localResolver as ResolveFunction, fetch, {
|
||||
storePath,
|
||||
storeIndex,
|
||||
})
|
||||
@@ -334,7 +335,7 @@ test('refetch local tarball if its integrity has changed. The requester does not
|
||||
await delay(50)
|
||||
|
||||
{
|
||||
const requestPackage = createPackageRequester(localResolver as any, fetch, {
|
||||
const requestPackage = createPackageRequester(localResolver as ResolveFunction, fetch, {
|
||||
storePath,
|
||||
storeIndex,
|
||||
})
|
||||
@@ -352,7 +353,7 @@ test('refetch local tarball if its integrity has changed. The requester does not
|
||||
}
|
||||
|
||||
{
|
||||
const requestPackage = createPackageRequester(localResolver as any, fetch, {
|
||||
const requestPackage = createPackageRequester(localResolver as ResolveFunction, fetch, {
|
||||
storePath,
|
||||
storeIndex,
|
||||
})
|
||||
@@ -571,7 +572,7 @@ test('always return a package manifest in the response', async t => {
|
||||
const prefix = tempy.directory()
|
||||
|
||||
{
|
||||
const pkgResponse = await requestPackage({alias: 'is-positive', pref: '1.0.0'}, {
|
||||
const pkgResponse = await requestPackage({ alias: 'is-positive', pref: '1.0.0' }, {
|
||||
downloadPriority: 0,
|
||||
loggedPkg: {
|
||||
rawSpec: 'is-positive@1.0.0',
|
||||
@@ -587,7 +588,7 @@ test('always return a package manifest in the response', async t => {
|
||||
}
|
||||
|
||||
{
|
||||
const pkgResponse = await requestPackage({alias: 'is-positive', pref: '1.0.0'}, {
|
||||
const pkgResponse = await requestPackage({ alias: 'is-positive', pref: '1.0.0' }, {
|
||||
currentPkgId: 'registry.npmjs.org/is-positive/1.0.0',
|
||||
downloadPriority: 0,
|
||||
loggedPkg: {
|
||||
|
||||
@@ -79,8 +79,8 @@
|
||||
"scripts": {
|
||||
"info": "npm-scripts-info",
|
||||
"start": "npm run tsc -- --watch",
|
||||
"fix": "tslint -c tslint.json --project . --fix",
|
||||
"lint": "tslint -c tslint.json --project .",
|
||||
"fix": "tslint -c tslint.json src/**/*.ts test/**/*.ts --fix",
|
||||
"lint": "tslint -c tslint.json src/**/*.ts test/**/*.ts",
|
||||
"pretest": "rimraf .tmp",
|
||||
"test": "npm run lint && npm run tsc && ts-node test --type-check",
|
||||
"tsc": "rimraf lib && tsc",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import createResolver from '@pnpm/npm-resolver'
|
||||
import createFetcher from '@pnpm/tarball-fetcher'
|
||||
import createStore from '@pnpm/package-store'
|
||||
import * as packageStore from '@pnpm/package-store'
|
||||
import createStore, * as packageStore from '@pnpm/package-store'
|
||||
import path = require('path')
|
||||
import test = require('tape')
|
||||
import tempy = require('tempy')
|
||||
@@ -14,7 +13,7 @@ test('public API', t => {
|
||||
test('store.importPackage()', async (t) => {
|
||||
const store = tempy.directory()
|
||||
const registry = 'https://registry.npmjs.org/'
|
||||
const rawNpmConfig = {registry}
|
||||
const rawNpmConfig = { registry }
|
||||
const resolver = createResolver({
|
||||
metaCache: new Map(),
|
||||
rawNpmConfig,
|
||||
@@ -24,7 +23,7 @@ test('store.importPackage()', async (t) => {
|
||||
rawNpmConfig,
|
||||
registry,
|
||||
})
|
||||
const storeController = await createStore(resolver, fetcher, {store})
|
||||
const storeController = await createStore(resolver, fetcher, { store })
|
||||
const pkgId = 'registry.npmjs.org/is-positive/1.0.0'
|
||||
const fetchResult = await storeController.fetchPackage({
|
||||
force: false,
|
||||
@@ -50,7 +49,7 @@ test('store.importPackage()', async (t) => {
|
||||
test('store.importPackage() by copying', async (t) => {
|
||||
const store = tempy.directory()
|
||||
const registry = 'https://registry.npmjs.org/'
|
||||
const rawNpmConfig = {registry}
|
||||
const rawNpmConfig = { registry }
|
||||
const resolver = createResolver({
|
||||
metaCache: new Map(),
|
||||
rawNpmConfig,
|
||||
|
||||
@@ -115,6 +115,7 @@
|
||||
"path-exists": "3.0.0",
|
||||
"pnpm": "link:",
|
||||
"pnpm-registry-mock": "2.4.0",
|
||||
"pnpm-shrinkwrap": "8.1.3",
|
||||
"retry": "0.12.0",
|
||||
"rimraf": "2.6.2",
|
||||
"rimraf-then": "1.0.1",
|
||||
@@ -174,7 +175,7 @@
|
||||
"?commit": "echo 'Run Git commit wizard'",
|
||||
"commit": "commit",
|
||||
"commitmsg": "commitlint -e",
|
||||
"lint": "tslint -c tslint.json --project .",
|
||||
"lint": "tslint -c tslint.json src/**/*.ts test/**/*.ts",
|
||||
"pnpm-registry-mock": "pnpm-registry-mock",
|
||||
"test:tap": "ts-node test --type-check",
|
||||
"pretest:e2e": "rimraf ../../../.tmp/ && rimraf node_modules/.bin/pnpm && pnpm-registry-mock prepare",
|
||||
@@ -186,22 +187,5 @@
|
||||
},
|
||||
"publishconfig": {
|
||||
"tag": "next"
|
||||
},
|
||||
"greenkeeper": {
|
||||
"ignore": [
|
||||
"@pnpm/default-fetcher",
|
||||
"@pnpm/default-resolver",
|
||||
"@pnpm/logger",
|
||||
"@pnpm/outdated",
|
||||
"@pnpm/server",
|
||||
"@pnpm/types",
|
||||
"pnpm-default-reporter",
|
||||
"pnpm-file-reporter",
|
||||
"pnpm-install-checks",
|
||||
"pnpm-registry-mock",
|
||||
"remove-all-except-outer-links",
|
||||
"pnpm-shrinkwrap",
|
||||
"supi"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,10 +38,10 @@ test('production install (with production NODE_ENV)', async (t: tape.Test) => {
|
||||
test('install dev dependencies only', async (t: tape.Test) => {
|
||||
const project = prepare(t, {
|
||||
dependencies: {
|
||||
'is-positive': "^1.0.0",
|
||||
'is-positive': '^1.0.0',
|
||||
},
|
||||
devDependencies: {
|
||||
'is-negative': "^1.0.0",
|
||||
'is-negative': '^1.0.0',
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ test('self-update stops the store server', async (t: tape.Test) => {
|
||||
const server = spawn(['server', 'start'])
|
||||
|
||||
const serverJsonPath = path.resolve('..', 'store', '2', 'server', 'server.json')
|
||||
const serverJson = await retryLoadJsonFile(serverJsonPath)
|
||||
const serverJson = await retryLoadJsonFile<{ connectionOptions: object }>(serverJsonPath)
|
||||
t.ok(serverJson)
|
||||
t.ok(serverJson.connectionOptions)
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import fs = require('mz/fs')
|
||||
import tape = require('tape')
|
||||
import promisifyTape from 'tape-promise'
|
||||
import path = require('path')
|
||||
import { Shrinkwrap } from 'pnpm-shrinkwrap'
|
||||
import loadJsonFile from 'load-json-file'
|
||||
import loadYamlFile = require('load-yaml-file')
|
||||
import writeYamlFile = require('write-yaml-file')
|
||||
@@ -33,7 +34,7 @@ test('linking a package inside a monorepo', async (t: tape.Test) => {
|
||||
},
|
||||
])
|
||||
|
||||
await writeYamlFile('pnpm-workspace.yaml', {packages: ['**', '!store/**']})
|
||||
await writeYamlFile('pnpm-workspace.yaml', { packages: ['**', '!store/**'] })
|
||||
|
||||
process.chdir('project-1')
|
||||
|
||||
@@ -45,9 +46,9 @@ test('linking a package inside a monorepo', async (t: tape.Test) => {
|
||||
|
||||
const pkg = await import(path.resolve('package.json'))
|
||||
|
||||
t.deepEqual(pkg && pkg.dependencies, {'project-2': '^2.0.0'}, 'spec of linked package added to dependencies')
|
||||
t.deepEqual(pkg && pkg.devDependencies, {'project-3': '^3.0.0'}, 'spec of linked package added to devDependencies')
|
||||
t.deepEqual(pkg && pkg.optionalDependencies, {'project-4': '^4.0.0'}, 'spec of linked package added to optionalDependencies')
|
||||
t.deepEqual(pkg && pkg.dependencies, { 'project-2': '^2.0.0' }, 'spec of linked package added to dependencies')
|
||||
t.deepEqual(pkg && pkg.devDependencies, { 'project-3': '^3.0.0' }, 'spec of linked package added to devDependencies')
|
||||
t.deepEqual(pkg && pkg.optionalDependencies, { 'project-4': '^4.0.0' }, 'spec of linked package added to optionalDependencies')
|
||||
|
||||
await projects['project-1'].has('project-2')
|
||||
await projects['project-1'].has('project-3')
|
||||
@@ -75,7 +76,7 @@ test('linking a package inside a monorepo with --link-workspace-packages when in
|
||||
])
|
||||
|
||||
await fs.writeFile('.npmrc', 'link-workspace-packages = true', 'utf8')
|
||||
await writeYamlFile('pnpm-workspace.yaml', {packages: ['**', '!store/**']})
|
||||
await writeYamlFile('pnpm-workspace.yaml', { packages: ['**', '!store/**'] })
|
||||
|
||||
process.chdir('project-1')
|
||||
|
||||
@@ -87,9 +88,9 @@ test('linking a package inside a monorepo with --link-workspace-packages when in
|
||||
|
||||
const pkg = await import(path.resolve('package.json'))
|
||||
|
||||
t.deepEqual(pkg && pkg.dependencies, {'project-2': '^2.0.0'}, 'spec of linked package added to dependencies')
|
||||
t.deepEqual(pkg && pkg.devDependencies, {'project-3': '^3.0.0'}, 'spec of linked package added to devDependencies')
|
||||
t.deepEqual(pkg && pkg.optionalDependencies, {'project-4': '^4.0.0'}, 'spec of linked package added to optionalDependencies')
|
||||
t.deepEqual(pkg && pkg.dependencies, { 'project-2': '^2.0.0' }, 'spec of linked package added to dependencies')
|
||||
t.deepEqual(pkg && pkg.devDependencies, { 'project-3': '^3.0.0' }, 'spec of linked package added to devDependencies')
|
||||
t.deepEqual(pkg && pkg.optionalDependencies, { 'project-4': '^4.0.0' }, 'spec of linked package added to optionalDependencies')
|
||||
|
||||
await projects['project-1'].has('project-2')
|
||||
await projects['project-1'].has('project-3')
|
||||
@@ -136,7 +137,7 @@ test('linking a package inside a monorepo with --link-workspace-packages', async
|
||||
])
|
||||
|
||||
await fs.writeFile('.npmrc', 'link-workspace-packages = true', 'utf8')
|
||||
await writeYamlFile('pnpm-workspace.yaml', {packages: ['**', '!store/**']})
|
||||
await writeYamlFile('pnpm-workspace.yaml', { packages: ['**', '!store/**'] })
|
||||
|
||||
process.chdir('project-1')
|
||||
|
||||
@@ -348,9 +349,9 @@ test('shared-workspace-shrinkwrap: installation with --link-workspace-packages l
|
||||
await execPnpm('recursive', 'install')
|
||||
|
||||
{
|
||||
const shr = await loadYamlFile<any>('shrinkwrap.yaml') // tslint:disable:no-any
|
||||
t.equal(shr.importers.project.dependencies['is-positive'], '2.0.0')
|
||||
t.equal(shr.importers.project.dependencies['negative'], '/is-negative/1.0.0')
|
||||
const shr = await loadYamlFile<Shrinkwrap>('shrinkwrap.yaml') // tslint:disable:no-any
|
||||
t.equal(shr!.importers!.project!.dependencies!['is-positive'], '2.0.0')
|
||||
t.equal(shr!.importers!.project!.dependencies!['negative'], '/is-negative/1.0.0')
|
||||
}
|
||||
|
||||
await projects['is-positive'].writePackageJson({
|
||||
@@ -490,7 +491,7 @@ test('local packages should be preferred when running "pnpm link" inside a works
|
||||
})
|
||||
|
||||
// covers https://github.com/pnpm/pnpm/issues/1437
|
||||
test("shared-workspace-shrinkwrap: create shared shrinkwrap format when installation is inside workspace", async (t) => {
|
||||
test('shared-workspace-shrinkwrap: create shared shrinkwrap format when installation is inside workspace', async (t) => {
|
||||
const projects = prepare(t, {
|
||||
dependencies: {
|
||||
'is-positive': '1.0.0',
|
||||
|
||||
@@ -158,10 +158,10 @@ test('recursive installation with package-specific .npmrc', async t => {
|
||||
t.ok(projects['project-1'].requireModule('is-positive'))
|
||||
t.ok(projects['project-2'].requireModule('is-negative'))
|
||||
|
||||
const modulesYaml1 = await loadYamlFile<any>(path.resolve('project-1', 'node_modules', '.modules.yaml'))
|
||||
const modulesYaml1 = await loadYamlFile<{ shamefullyFlatten: boolean }>(path.resolve('project-1', 'node_modules', '.modules.yaml'))
|
||||
t.ok(modulesYaml1 && modulesYaml1.shamefullyFlatten)
|
||||
|
||||
const modulesYaml2 = await loadYamlFile<any>(path.resolve('project-2', 'node_modules', '.modules.yaml'))
|
||||
const modulesYaml2 = await loadYamlFile<{ shamefullyFlatten: boolean }>(path.resolve('project-2', 'node_modules', '.modules.yaml'))
|
||||
t.notOk(modulesYaml2 && modulesYaml2.shamefullyFlatten)
|
||||
})
|
||||
|
||||
@@ -192,7 +192,7 @@ test('workspace .npmrc is always read', async (t: tape.Test) => {
|
||||
|
||||
t.ok(projects['project-1'].requireModule('is-positive'))
|
||||
|
||||
const modulesYaml1 = await loadYamlFile<any>(path.resolve('node_modules', '.modules.yaml'))
|
||||
const modulesYaml1 = await loadYamlFile<{ shamefullyFlatten: boolean }>(path.resolve('node_modules', '.modules.yaml'))
|
||||
t.ok(modulesYaml1 && modulesYaml1.shamefullyFlatten)
|
||||
|
||||
process.chdir('..')
|
||||
@@ -202,7 +202,7 @@ test('workspace .npmrc is always read', async (t: tape.Test) => {
|
||||
|
||||
t.ok(projects['project-2'].requireModule('is-negative'))
|
||||
|
||||
const modulesYaml2 = await loadYamlFile<any>(path.resolve('node_modules', '.modules.yaml'))
|
||||
const modulesYaml2 = await loadYamlFile<{ shamefullyFlatten: boolean }>(path.resolve('node_modules', '.modules.yaml'))
|
||||
t.ok(modulesYaml2 && modulesYaml2.shamefullyFlatten === false)
|
||||
})
|
||||
|
||||
@@ -225,10 +225,10 @@ test('recursive installation using server', async (t: tape.Test) => {
|
||||
])
|
||||
|
||||
const storeDir = path.resolve('store')
|
||||
const server = spawn(['server', 'start'], {storeDir})
|
||||
const server = spawn(['server', 'start'], { storeDir })
|
||||
|
||||
const serverJsonPath = path.resolve(storeDir, '2', 'server', 'server.json')
|
||||
const serverJson = await retryLoadJsonFile(serverJsonPath)
|
||||
const serverJson = await retryLoadJsonFile<{ connectionOptions: object }>(serverJsonPath)
|
||||
t.ok(serverJson)
|
||||
t.ok(serverJson.connectionOptions)
|
||||
|
||||
@@ -348,7 +348,7 @@ test('running `pnpm recursive` on a subset of packages', async t => {
|
||||
},
|
||||
])
|
||||
|
||||
await writeYamlFile('pnpm-workspace.yaml', {packages: ['project-1']})
|
||||
await writeYamlFile('pnpm-workspace.yaml', { packages: ['project-1'] })
|
||||
|
||||
await execPnpm('recursive', 'install')
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export type ResolveFunction<T> = (value?: T | PromiseLike<T>) => void
|
||||
export type ResolveFunction<T> = (value?: T | PromiseLike<T>) => void
|
||||
|
||||
export type RejectFunction = (reason?: Error) => void
|
||||
|
||||
@@ -23,4 +23,4 @@ export default function <T>(): Deferred<T> {
|
||||
reject,
|
||||
resolve,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ export async function add (pkg: string, version: string, distTag: string) {
|
||||
const client = new RegClient()
|
||||
|
||||
// just to make verdaccio cache the package
|
||||
await new Promise((resolve, reject) => client.distTags.fetch('http://localhost:4873', {package: pkg}, (err: Error) => err ? reject(err) : resolve()))
|
||||
await new Promise((resolve, reject) => client.distTags.fetch('http://localhost:4873', { package: pkg }, (err: Error) => err ? reject(err) : resolve()))
|
||||
|
||||
// the tag has to be removed first because in verdaccio it is an array of versions
|
||||
await new Promise((resolve, reject) => client.distTags.rm('http://localhost:4873', {package: pkg, distTag}, (err: Error) => err ? reject(err) : resolve()))
|
||||
await new Promise((resolve, reject) => client.distTags.add('http://localhost:4873', {package: pkg, version, distTag}, (err: Error) => err ? reject(err) : resolve()))
|
||||
await new Promise((resolve, reject) => client.distTags.rm('http://localhost:4873', { package: pkg, distTag }, (err: Error) => err ? reject(err) : resolve()))
|
||||
await new Promise((resolve, reject) => client.distTags.add('http://localhost:4873', { package: pkg, version, distTag }, (err: Error) => err ? reject(err) : resolve()))
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import loadJsonFile from 'load-json-file'
|
||||
import retry = require('retry')
|
||||
|
||||
export default (filePath: string): Promise<any> => {
|
||||
export default <T>(filePath: string): Promise<T> => {
|
||||
const operation = retry.operation()
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
operation.attempt(async (currentAttempt) => {
|
||||
try {
|
||||
resolve(await loadJsonFile(filePath))
|
||||
resolve(await loadJsonFile<T>(filePath))
|
||||
} catch (err) {
|
||||
if (operation.retry(err)) {
|
||||
return
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {PnpmOptions} from 'supi'
|
||||
import { PnpmOptions } from 'supi'
|
||||
import path = require('path')
|
||||
|
||||
export default function testDefaults (opts?: PnpmOptions): PnpmOptions & {store: string} {
|
||||
export default function testDefaults (opts?: PnpmOptions): PnpmOptions & { store: string } {
|
||||
return Object.assign({
|
||||
store: path.resolve('..', '.store'),
|
||||
registry: 'http://localhost:4873/',
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"node": ">=6"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "tslint -c tslint.json --project .",
|
||||
"lint": "tslint -c tslint.json src/**/*.ts test/**/*.ts",
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"test": "rimraf .store && npm run tsc && npm run lint && ts-node test --type-check && mos t",
|
||||
"md": "mos",
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
import { PackageFilesResponse } from '@pnpm/store-controller-types'
|
||||
import got = require('got')
|
||||
import isPortReachable = require('is-port-reachable')
|
||||
import createResolver, {PackageMetaCache} from '@pnpm/npm-resolver'
|
||||
import createResolver, { PackageMetaCache } from '@pnpm/npm-resolver'
|
||||
import createStore from '@pnpm/package-store'
|
||||
import createFetcher from '@pnpm/tarball-fetcher'
|
||||
|
||||
@@ -31,7 +31,7 @@ async function createStoreController () {
|
||||
strictSsl: true,
|
||||
rawNpmConfig,
|
||||
})
|
||||
return await createStore(resolve, fetchers, {
|
||||
return createStore(resolve, fetchers, {
|
||||
networkConcurrency: 1,
|
||||
store: store,
|
||||
locks: undefined,
|
||||
@@ -48,12 +48,12 @@ test('server', async t => {
|
||||
port,
|
||||
hostname,
|
||||
})
|
||||
const storeCtrl = await connectStoreController({remotePrefix, concurrency: 100})
|
||||
const storeCtrl = await connectStoreController({ remotePrefix, concurrency: 100 })
|
||||
const response = await storeCtrl.requestPackage(
|
||||
{alias: 'is-positive', pref: '1.0.0'},
|
||||
{ alias: 'is-positive', pref: '1.0.0' },
|
||||
{
|
||||
downloadPriority: 0,
|
||||
loggedPkg: {rawSpec: 'sfdf'},
|
||||
loggedPkg: { rawSpec: 'sfdf' },
|
||||
prefix: process.cwd(),
|
||||
registry,
|
||||
verifyStoreIntegrity: false,
|
||||
@@ -89,7 +89,7 @@ test('fetchPackage', async t => {
|
||||
port,
|
||||
hostname,
|
||||
})
|
||||
const storeCtrl = await connectStoreController({remotePrefix, concurrency: 100})
|
||||
const storeCtrl = await connectStoreController({ remotePrefix, concurrency: 100 })
|
||||
const response = await storeCtrl.fetchPackage({
|
||||
fetchRawManifest: true,
|
||||
force: false,
|
||||
@@ -128,14 +128,14 @@ test('server errors should arrive to the client', async t => {
|
||||
port,
|
||||
hostname,
|
||||
})
|
||||
const storeCtrl = await connectStoreController({remotePrefix, concurrency: 100})
|
||||
const storeCtrl = await connectStoreController({ remotePrefix, concurrency: 100 })
|
||||
let caught = false
|
||||
try {
|
||||
await storeCtrl.requestPackage(
|
||||
{alias: 'not-an-existing-package', pref: '1.0.0'},
|
||||
{ alias: 'not-an-existing-package', pref: '1.0.0' },
|
||||
{
|
||||
downloadPriority: 0,
|
||||
loggedPkg: {rawSpec: 'sfdf'},
|
||||
loggedPkg: { rawSpec: 'sfdf' },
|
||||
prefix: process.cwd(),
|
||||
registry,
|
||||
verifyStoreIntegrity: false,
|
||||
@@ -167,7 +167,7 @@ test('server upload', async t => {
|
||||
hostname,
|
||||
port,
|
||||
})
|
||||
const storeCtrl = await connectStoreController({remotePrefix, concurrency: 100})
|
||||
const storeCtrl = await connectStoreController({ remotePrefix, concurrency: 100 })
|
||||
|
||||
const fakeEngine = 'client-engine'
|
||||
const fakePkgId = 'test.example.com/fake-pkg/1.0.0'
|
||||
@@ -198,7 +198,7 @@ test('disable server upload', async t => {
|
||||
ignoreUploadRequests: true,
|
||||
port,
|
||||
})
|
||||
const storeCtrl = await connectStoreController({remotePrefix, concurrency: 100})
|
||||
const storeCtrl = await connectStoreController({ remotePrefix, concurrency: 100 })
|
||||
|
||||
const fakeEngine = 'client-engine'
|
||||
const fakePkgId = 'test.example.com/fake-pkg/1.0.0'
|
||||
@@ -235,7 +235,7 @@ test('stop server with remote call', async t => {
|
||||
|
||||
t.ok(await isPortReachable(port), 'server is running')
|
||||
|
||||
const response = await got(`${remotePrefix}/stop`, {method: 'POST'})
|
||||
const response = await got(`${remotePrefix}/stop`, { method: 'POST' })
|
||||
|
||||
t.equal(response.statusCode, 200, 'success returned by server stopping endpoint')
|
||||
|
||||
@@ -258,7 +258,7 @@ test('disallow stop server with remote call', async t => {
|
||||
t.ok(await isPortReachable(port), 'server is running')
|
||||
|
||||
try {
|
||||
const response = await got(`${remotePrefix}/stop`, {method: 'POST'})
|
||||
const response = await got(`${remotePrefix}/stop`, { method: 'POST' })
|
||||
t.fail('request should have failed')
|
||||
} catch (err) {
|
||||
t.equal(err.statusCode, 403, 'server not stopped')
|
||||
@@ -283,7 +283,7 @@ test('disallow store prune', async t => {
|
||||
t.ok(await isPortReachable(port), 'server is running')
|
||||
|
||||
try {
|
||||
const response = await got(`${remotePrefix}/prune`, {method: 'POST'})
|
||||
const response = await got(`${remotePrefix}/prune`, { method: 'POST' })
|
||||
t.fail('request should have failed')
|
||||
} catch (err) {
|
||||
t.equal(err.statusCode, 403, 'store not pruned')
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"lib/"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "npm run tsc && tslint -c tslint.json -p . && ts-node test --type-check",
|
||||
"test": "npm run tsc && tslint -c tslint.json src/**/*.ts test/**/*.ts && ts-node test --type-check",
|
||||
"tsc": "rimraf lib && tsc",
|
||||
"prepublishOnly": "npm run tsc"
|
||||
},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {nameVerFromPkgSnapshot} from 'pnpm-shrinkwrap'
|
||||
import { nameVerFromPkgSnapshot } from 'pnpm-shrinkwrap'
|
||||
import test = require('tape')
|
||||
|
||||
test('nameVerFromPkgSnapshot()', (t) => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {pkgSnapshotToResolution} from 'pnpm-shrinkwrap'
|
||||
import { pkgSnapshotToResolution } from 'pnpm-shrinkwrap'
|
||||
import test = require('tape')
|
||||
|
||||
test('pkgSnapshotToResolution()', (t) => {
|
||||
|
||||
@@ -8,7 +8,9 @@ import yaml = require('yaml-tag')
|
||||
|
||||
const DEFAULT_OPTS = {
|
||||
defaultRegistry: 'https://registry.npmjs.org',
|
||||
warn (msg: string) {},
|
||||
warn (msg: string) {
|
||||
// ignore
|
||||
},
|
||||
}
|
||||
|
||||
test('remove one redundant package', t => {
|
||||
@@ -1110,7 +1112,7 @@ test("prune: don't remove package used by another importer", t => {
|
||||
}, {
|
||||
name: 'project-2',
|
||||
version: '1.0.0',
|
||||
dependencies: {'is-negative': '^1.0.0'},
|
||||
dependencies: { 'is-negative': '^1.0.0' },
|
||||
}, 'packages/package-2', DEFAULT_OPTS), {
|
||||
shrinkwrapVersion: 3,
|
||||
registry: 'https://registry.npmjs.org',
|
||||
|
||||
@@ -151,8 +151,8 @@ test('writeCurrentOnly()', async t => {
|
||||
}
|
||||
await mkdirp(path.join(projectPath, 'node_modules'))
|
||||
await writeCurrentOnly(projectPath, wantedShrinkwrap)
|
||||
t.equal(await readWanted(projectPath, {ignoreIncompatible: false}), null)
|
||||
t.deepEqual(await readCurrent(projectPath, {ignoreIncompatible: false}), wantedShrinkwrap)
|
||||
t.equal(await readWanted(projectPath, { ignoreIncompatible: false }), null)
|
||||
t.deepEqual(await readCurrent(projectPath, { ignoreIncompatible: false }), wantedShrinkwrap)
|
||||
t.end()
|
||||
})
|
||||
|
||||
@@ -238,8 +238,8 @@ test('write()', async t => {
|
||||
}
|
||||
}
|
||||
await write(projectPath, wantedShrinkwrap, wantedShrinkwrap)
|
||||
t.deepEqual(await readCurrent(projectPath, {ignoreIncompatible: false}), wantedShrinkwrap)
|
||||
t.deepEqual(await readWanted(projectPath, {ignoreIncompatible: false}), wantedShrinkwrap)
|
||||
t.deepEqual(await readCurrent(projectPath, { ignoreIncompatible: false }), wantedShrinkwrap)
|
||||
t.deepEqual(await readWanted(projectPath, { ignoreIncompatible: false }), wantedShrinkwrap)
|
||||
t.end()
|
||||
})
|
||||
|
||||
@@ -258,12 +258,12 @@ test('write() when no specifiers but dependencies present', async t => {
|
||||
},
|
||||
}
|
||||
await write(projectPath, wantedShrinkwrap, wantedShrinkwrap)
|
||||
t.deepEqual(await readCurrent(projectPath, {ignoreIncompatible: false}), wantedShrinkwrap)
|
||||
t.deepEqual(await readWanted(projectPath, {ignoreIncompatible: false}), wantedShrinkwrap)
|
||||
t.deepEqual(await readCurrent(projectPath, { ignoreIncompatible: false }), wantedShrinkwrap)
|
||||
t.deepEqual(await readWanted(projectPath, { ignoreIncompatible: false }), wantedShrinkwrap)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test("write does not use yaml anchors/aliases", async t => {
|
||||
test('write does not use yaml anchors/aliases', async t => {
|
||||
const projectPath = tempy.directory()
|
||||
const wantedShrinkwrap = {
|
||||
shrinkwrapVersion: 3,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import test = require('tape')
|
||||
import {satisfiesPackageJson} from 'pnpm-shrinkwrap'
|
||||
import { satisfiesPackageJson } from 'pnpm-shrinkwrap'
|
||||
|
||||
const DEFAULT_SHR_FIELDS = {
|
||||
shrinkwrapVersion: 3,
|
||||
@@ -16,98 +16,98 @@ test('satisfiesPackageJson()', t => {
|
||||
...DEFAULT_SHR_FIELDS,
|
||||
importers: {
|
||||
'.': {
|
||||
dependencies: {foo: '1.0.0'},
|
||||
specifiers: {foo: '^1.0.0'},
|
||||
dependencies: { foo: '1.0.0' },
|
||||
specifiers: { foo: '^1.0.0' },
|
||||
},
|
||||
},
|
||||
}, {
|
||||
...DEFAULT_PKG_FIELDS,
|
||||
dependencies: {foo: '^1.0.0'},
|
||||
dependencies: { foo: '^1.0.0' },
|
||||
}, '.'))
|
||||
t.ok(satisfiesPackageJson({
|
||||
...DEFAULT_SHR_FIELDS,
|
||||
importers: {
|
||||
'.': {
|
||||
dependencies: {foo: '1.0.0'},
|
||||
dependencies: { foo: '1.0.0' },
|
||||
devDependencies: {},
|
||||
specifiers: {foo: '^1.0.0'},
|
||||
specifiers: { foo: '^1.0.0' },
|
||||
},
|
||||
},
|
||||
}, {
|
||||
...DEFAULT_PKG_FIELDS,
|
||||
dependencies: {foo: '^1.0.0'}
|
||||
dependencies: { foo: '^1.0.0' }
|
||||
}, '.'))
|
||||
t.ok(satisfiesPackageJson({
|
||||
...DEFAULT_SHR_FIELDS,
|
||||
importers: {
|
||||
'.': {
|
||||
devDependencies: {foo: '1.0.0'},
|
||||
specifiers: {foo: '^1.0.0'},
|
||||
devDependencies: { foo: '1.0.0' },
|
||||
specifiers: { foo: '^1.0.0' },
|
||||
},
|
||||
},
|
||||
}, {
|
||||
...DEFAULT_PKG_FIELDS,
|
||||
devDependencies: {foo: '^1.0.0'},
|
||||
devDependencies: { foo: '^1.0.0' },
|
||||
}, '.'))
|
||||
t.ok(satisfiesPackageJson({
|
||||
...DEFAULT_SHR_FIELDS,
|
||||
importers: {
|
||||
'.': {
|
||||
optionalDependencies: {foo: '1.0.0'},
|
||||
specifiers: {foo: '^1.0.0'},
|
||||
optionalDependencies: { foo: '1.0.0' },
|
||||
specifiers: { foo: '^1.0.0' },
|
||||
},
|
||||
},
|
||||
}, {
|
||||
...DEFAULT_PKG_FIELDS,
|
||||
optionalDependencies: {foo: '^1.0.0'},
|
||||
optionalDependencies: { foo: '^1.0.0' },
|
||||
}, '.'))
|
||||
t.notOk(satisfiesPackageJson({
|
||||
...DEFAULT_SHR_FIELDS,
|
||||
importers: {
|
||||
'.': {
|
||||
dependencies: {foo: '1.0.0'},
|
||||
specifiers: {foo: '^1.0.0'},
|
||||
dependencies: { foo: '1.0.0' },
|
||||
specifiers: { foo: '^1.0.0' },
|
||||
},
|
||||
},
|
||||
}, {
|
||||
...DEFAULT_PKG_FIELDS,
|
||||
optionalDependencies: {foo: '^1.0.0'},
|
||||
optionalDependencies: { foo: '^1.0.0' },
|
||||
}, '.'), 'dep type differs')
|
||||
t.notOk(satisfiesPackageJson({
|
||||
...DEFAULT_SHR_FIELDS,
|
||||
importers: {
|
||||
'.': {
|
||||
dependencies: {foo: '1.0.0'},
|
||||
specifiers: {foo: '^1.0.0'},
|
||||
dependencies: { foo: '1.0.0' },
|
||||
specifiers: { foo: '^1.0.0' },
|
||||
},
|
||||
},
|
||||
}, {
|
||||
...DEFAULT_PKG_FIELDS,
|
||||
dependencies: {foo: '^1.1.0'},
|
||||
}, '.'), 'spec does not match' )
|
||||
dependencies: { foo: '^1.1.0' },
|
||||
}, '.'), 'spec does not match')
|
||||
t.notOk(satisfiesPackageJson({
|
||||
...DEFAULT_SHR_FIELDS,
|
||||
importers: {
|
||||
'.': {
|
||||
dependencies: {foo: '1.0.0'},
|
||||
specifiers: {foo: '^1.0.0'},
|
||||
dependencies: { foo: '1.0.0' },
|
||||
specifiers: { foo: '^1.0.0' },
|
||||
},
|
||||
},
|
||||
}, {
|
||||
...DEFAULT_PKG_FIELDS,
|
||||
dependencies: {foo: '^1.0.0', bar: '2.0.0'},
|
||||
dependencies: { foo: '^1.0.0', bar: '2.0.0' },
|
||||
}, '.'), 'dep spec missing')
|
||||
t.notOk(satisfiesPackageJson({
|
||||
...DEFAULT_SHR_FIELDS,
|
||||
importers: {
|
||||
'.': {
|
||||
dependencies: {foo: '1.0.0'},
|
||||
specifiers: {foo: '^1.0.0', bar: '2.0.0'},
|
||||
dependencies: { foo: '1.0.0' },
|
||||
specifiers: { foo: '^1.0.0', bar: '2.0.0' },
|
||||
},
|
||||
},
|
||||
}, {
|
||||
...DEFAULT_PKG_FIELDS,
|
||||
dependencies: {foo: '^1.0.0', bar: '2.0.0'},
|
||||
dependencies: { foo: '^1.0.0', bar: '2.0.0' },
|
||||
}, '.'))
|
||||
|
||||
{
|
||||
@@ -194,26 +194,26 @@ test('satisfiesPackageJson()', t => {
|
||||
...DEFAULT_SHR_FIELDS,
|
||||
importers: {
|
||||
'.': {
|
||||
dependencies: {foo: '1.0.0', linked: 'link:../linked'},
|
||||
specifiers: {foo: '^1.0.0'},
|
||||
dependencies: { foo: '1.0.0', linked: 'link:../linked' },
|
||||
specifiers: { foo: '^1.0.0' },
|
||||
},
|
||||
},
|
||||
}, {
|
||||
...DEFAULT_PKG_FIELDS,
|
||||
dependencies: {foo: '^1.0.0'},
|
||||
dependencies: { foo: '^1.0.0' },
|
||||
}, '.'), 'linked packages that are not in package.json are ignored')
|
||||
|
||||
t.notOk(satisfiesPackageJson({
|
||||
...DEFAULT_SHR_FIELDS,
|
||||
importers: {
|
||||
'packages/foo': {
|
||||
dependencies: {foo: '1.0.0'},
|
||||
specifiers: {foo: '^1.0.0'},
|
||||
dependencies: { foo: '1.0.0' },
|
||||
specifiers: { foo: '^1.0.0' },
|
||||
},
|
||||
},
|
||||
}, {
|
||||
...DEFAULT_PKG_FIELDS,
|
||||
dependencies: {foo: '^1.0.0'},
|
||||
dependencies: { foo: '^1.0.0' },
|
||||
}, '.'))
|
||||
|
||||
t.ok(satisfiesPackageJson({
|
||||
|
||||
@@ -790,6 +790,7 @@ importers:
|
||||
path-exists: 3.0.0
|
||||
pnpm: 'link:'
|
||||
pnpm-registry-mock: 2.4.0
|
||||
pnpm-shrinkwrap: 'link:../shrinkwrap'
|
||||
retry: 0.12.0
|
||||
rimraf: 2.6.2
|
||||
rimraf-then: 1.0.1
|
||||
@@ -887,6 +888,7 @@ importers:
|
||||
pnpm-file-reporter: 0.1.0
|
||||
pnpm-list: 4.1.5
|
||||
pnpm-registry-mock: 2.4.0
|
||||
pnpm-shrinkwrap: 8.1.3
|
||||
process-exists: 3.1.0
|
||||
ramda: 0.25.0
|
||||
read-ini-file: 1.0.0
|
||||
|
||||
Reference in New Issue
Block a user