refactor(typings): Use @types/tape‑promise

This commit is contained in:
ExE Boss
2019-12-28 13:15:00 +01:00
parent fa74b516ec
commit 56c54e8d4e
53 changed files with 26 additions and 67 deletions

View File

@@ -32,6 +32,7 @@
"@types/ramda": "^0.26.38",
"@types/rimraf": "^2.0.3",
"@types/sinon": "^7.5.1",
"@types/tape-promise": "4.0.0",
"@zkochan/rimraf": "1.0.0",
"fs-extra": "8.1.0",
"is-windows": "1.0.2",

View File

@@ -77,6 +77,7 @@
"@types/retry": "0.12.0",
"@types/semver": "^6.2.0",
"@types/table": "^4.0.7",
"@types/tape-promise": "4.0.0",
"@types/update-notifier": "2.5.0",
"@zkochan/rimraf": "1.0.0",
"anonymous-npm-registry-client": "0.1.2",

View File

@@ -11,7 +11,6 @@ import {
} from './utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('some commands pass through to npm', t => {
const result = execPnpmSync('dist-tag', 'ls', 'is-positive')

View File

@@ -11,7 +11,6 @@ import {
} from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('global installation', async (t: tape.Test) => {
prepare(t)

View File

@@ -6,7 +6,6 @@ import writeYamlFile = require('write-yaml-file')
import { execPnpm } from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('hoist the dependency graph', async function (t) {
const project = prepare(t)

View File

@@ -13,7 +13,6 @@ import {
} from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('readPackage hook', async (t: tape.Test) => {
const project = prepare(t)

View File

@@ -10,7 +10,6 @@ const pkgRoot = path.join(__dirname, '..', '..')
const pnpmPkg = loadJsonFile.sync<PackageManifest>(path.join(pkgRoot, 'package.json'))
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('installation fails if lifecycle script fails', t => {
const project = prepare(t, {

View File

@@ -23,7 +23,6 @@ import {
} from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('bin files are found by lifecycle scripts', t => {
const project = prepare(t, {

View File

@@ -8,7 +8,7 @@ import { execPnpm } from '../utils'
const basicPackageManifest = loadJsonFile.sync<PackageManifest>(path.join(__dirname, '../utils/simple-package.json'))
const test = promisifyTape(tape)
test['only'] = promisifyTape(tape.only)
test('production install (with --production flag)', async (t: tape.Test) => {
const project = prepare(t, basicPackageManifest)

View File

@@ -5,7 +5,6 @@ import promisifyTape from 'tape-promise'
import { execPnpm } from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('installing optional dependencies when --no-optional is not used', async (t: tape.Test) => {
const project = prepare(t, {

View File

@@ -10,7 +10,7 @@ import {
} from '../utils'
const test = promisifyTape(tape)
test['only'] = promisifyTape(tape.only)
test('self-update stops the store server', async (t: tape.Test) => {
const project = prepare(t)

View File

@@ -8,7 +8,6 @@ import promisifyTape from 'tape-promise'
import { execPnpm } from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
const ENGINE_DIR = `${process.platform}-${process.arch}-node-${process.version.split('.')[0]}`

View File

@@ -10,7 +10,6 @@ import { promisify } from 'util'
import { execPnpm } from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
const ncp = promisify(ncpCB)
test('corrupted tarball should be redownloaded to the store', async (t: tape.Test) => {

View File

@@ -17,7 +17,6 @@ import {
const ncp = promisify(ncpCB.ncp)
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('linking multiple packages', async (t: tape.Test) => {
const project = prepare(t)

View File

@@ -18,7 +18,6 @@ import writeYamlFile = require('write-yaml-file')
import { execPnpm, execPnpxSync } from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('linking a package inside a monorepo', async (t: tape.Test) => {
const projects = preparePackages(t, [

View File

@@ -16,7 +16,6 @@ import {
} from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('recursive installation with package-specific .npmrc', async t => {
const projects = preparePackages(t, [

View File

@@ -7,7 +7,6 @@ import writeYamlFile = require('write-yaml-file')
import { execPnpm } from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('pnpm recursive run finds bins from the root of the workspace', async (t: tape.Test) => {
preparePackages(t, [

View File

@@ -7,7 +7,6 @@ import promisifyTape from 'tape-promise'
import { execPnpm } from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('recursive update --latest should update deps with correct specs', async (t: tape.Test) => {
await addDistTag({ package: 'foo', version: '100.1.0', distTag: 'latest' })

View File

@@ -6,7 +6,6 @@ import promisifyTape from 'tape-promise'
import { execPnpmSync } from './utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('pnpm root', async (t: tape.Test) => {
tempDir(t)

View File

@@ -6,7 +6,6 @@ import promisifyTape from 'tape-promise'
import { execPnpm, execPnpmSync } from './utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
const RECORD_ARGS_FILE = `require('fs').writeFileSync('args.json', JSON.stringify(require('./args.json').concat([process.argv.slice(2)])), 'utf8')`

View File

@@ -30,8 +30,7 @@ interface ServerProcess {
}
const IS_WINDOWS = isWindows()
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test['only'] = promisifyTape(tape.only)
const kill = promisify(killcb) as (pid: number, signal: string) => Promise<void>
test('installation using pnpm server', async (t: tape.Test) => {
@@ -328,7 +327,7 @@ test('installation without store server running in the background', async (t: ta
// per @etamponi:
// > I update it on the host, which triggers a restart of the pnpm server,
// and then I update it on the container images, but that doesn't restart the running containers
test['skip']('fail if the store server is run by a different version of pnpm', async (t: tape.Test) => {
test.skip('fail if the store server is run by a different version of pnpm', async (t: tape.Test) => {
const project = prepare(t)
const serverJsonPath = path.resolve('..', 'store', '2', 'server', 'server.json')

View File

@@ -8,7 +8,6 @@ import promisifyTape from 'tape-promise'
import { execPnpm } from './utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('uninstall package and remove from appropriate property', async function (t: tape.Test) {
const project = prepare(t)

View File

@@ -11,7 +11,6 @@ import {
} from './utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('update <dep>', async function (t: tape.Test) {
const project = prepare(t)

View File

@@ -96,6 +96,7 @@
"@types/ramda": "^0.26.38",
"@types/semver": "^6.2.0",
"@types/sinon": "^7.5.1",
"@types/tape-promise": "4.0.0",
"anonymous-npm-registry-client": "0.1.2",
"cross-spawn": "7.0.1",
"deep-require-cwd": "1.0.0",

View File

@@ -15,7 +15,7 @@ test('API', (t) => {
// this seems illogical as even though all save types are false,
// the dependency will be saved
// tslint:disable-next-line:no-string-literal
test['skip']('install fails when all saving types are false', async (t: test.Test) => {
test.skip('install fails when all saving types are false', async (t: test.Test) => {
try {
await pnpm.install({}, await testDefaults({ save: false, saveDev: false, saveOptional: false }))
t.fail('installation should have failed')

View File

@@ -11,7 +11,6 @@ import promisifyTape from 'tape-promise'
import { testDefaults } from './utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('fail on non-compatible node_modules', async (t: tape.Test) => {
prepareEmpty(t)

View File

@@ -10,7 +10,6 @@ import {
} from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('installing aliased dependency', async (t: tape.Test) => {
const project = prepareEmpty(t)

View File

@@ -9,7 +9,6 @@ import promisifyTape from 'tape-promise'
import { testDefaults } from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('a package that need authentication', async (t: tape.Test) => {
const project = prepareEmpty(t)

View File

@@ -6,7 +6,6 @@ import promisifyTape from 'tape-promise'
import { testDefaults } from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
const addDistTag = pnpmRegistryMock.addDistTag
test('prefer version ranges specified for top dependencies', async (t: tape.Test) => {

View File

@@ -15,7 +15,6 @@ import promisifyTape from 'tape-promise'
import { testDefaults } from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('from a github repo', async (t: tape.Test) => {
const project = prepareEmpty(t)
@@ -137,7 +136,7 @@ test('from a git repo', async (t: tape.Test) => {
// This test is unstable due to dependency on third party registry
// tslint:disable-next-line:no-string-literal
test['skip']('from a non-github git repo', async (t: tape.Test) => {
test.skip('from a non-github git repo', async (t: tape.Test) => {
const project = prepareEmpty(t)
await addDependenciesToPackage({}, ['git+http://ikt.pm2.io/ikt.git#3325a3e39a502418dc2e2e4bf21529cbbde96228'], await testDefaults())

View File

@@ -12,7 +12,6 @@ import promisifyTape from 'tape-promise'
import { testDefaults } from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test(`frozen-lockfile: installation fails if specs in package.json don't match the ones in ${WANTED_LOCKFILE}`, async (t) => {
prepareEmpty(t)

View File

@@ -15,7 +15,6 @@ import promisifyTape from 'tape-promise'
import { addDistTag, testDefaults } from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('should hoist dependencies', async (t) => {
const project = prepareEmpty(t)

View File

@@ -13,7 +13,6 @@ import {
} from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('readPackage, afterAllResolved hooks', async (t: tape.Test) => {
const project = prepareEmpty(t)

View File

@@ -9,7 +9,6 @@ import promisifyTape from 'tape-promise'
import { testDefaults } from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('install with --independent-leaves', async (t: tape.Test) => {
const project = prepareEmpty(t)

View File

@@ -6,7 +6,6 @@ import promisifyTape from 'tape-promise'
import { testDefaults } from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('fail if installed package does not support the current engine and engine-strict = true', async (t) => {
const project = prepareEmpty(t)

View File

@@ -18,7 +18,6 @@ import promisifyTape from 'tape-promise'
import { testDefaults } from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('run pre/postinstall scripts', async (t: tape.Test) => {
const project = prepareEmpty(t)
@@ -147,7 +146,7 @@ test('installation fails if lifecycle script fails', async (t: tape.Test) => {
// TODO: unskip
// For some reason this fails on CI environments
// tslint:disable-next-line:no-string-literal
test['skip']('creates env for scripts', async (t: tape.Test) => {
test.skip('creates env for scripts', async (t: tape.Test) => {
prepareEmpty(t)
const manifest = await addDependenciesToPackage({
scripts: {

View File

@@ -18,7 +18,6 @@ import promisifyTape from 'tape-promise'
import { testDefaults } from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('scoped modules from a directory', async (t: tape.Test) => {
const project = prepareEmpty(t)

View File

@@ -11,7 +11,6 @@ import promisifyTape from 'tape-promise'
import { testDefaults } from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
const testSkip = promisifyTape(tape.skip)
testSkip('subsequent installation uses same lockfile directory by default', async (t: tape.Test) => {

View File

@@ -13,7 +13,6 @@ import promisifyTape from 'tape-promise'
import { testDefaults } from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('install with lockfileOnly = true', async (t: tape.Test) => {
const project = prepareEmpty(t)

View File

@@ -36,7 +36,6 @@ import {
} from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
const IS_WINDOWS = isWindows()
@@ -423,7 +422,7 @@ test("don't refetch package to store if it has been modified and verify-store-in
// TODO: decide what to do with this case
// tslint:disable-next-line:no-string-literal
test['skip']('relink package to project if the dependency is not linked from store', async (t: tape.Test) => {
test.skip('relink package to project if the dependency is not linked from store', async (t: tape.Test) => {
prepareEmpty(t)
const manifest = await addDependenciesToPackage({}, ['magic-hook@2.0.0'], await testDefaults({ save: true, pinnedVersion: 'patch' }))

View File

@@ -17,7 +17,6 @@ import writeYamlFile = require('write-yaml-file')
import { addDistTag, testDefaults } from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('install only the dependencies of the specified importer', async (t) => {
const projects = preparePackages(t, [

View File

@@ -14,7 +14,6 @@ import promisifyTape from 'tape-promise'
import { testDefaults } from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('successfully install optional dependency with subdependencies', async (t) => {
prepareEmpty(t)

View File

@@ -21,7 +21,6 @@ import promisifyTape from 'tape-promise'
import { testDefaults } from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test("don't fail when peer dependency is fetched from GitHub", async (t) => {
prepareEmpty(t)
@@ -330,7 +329,7 @@ test('peer dependencies are linked when running two separate named installations
})
// tslint:disable-next-line:no-string-literal
test['skip']('peer dependencies are linked', async (t: tape.Test) => {
test.skip('peer dependencies are linked', async (t: tape.Test) => {
const project = prepareEmpty(t)
await install({
dependencies: {

View File

@@ -10,7 +10,6 @@ import promisifyTape from 'tape-promise'
import { testDefaults } from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
const ENGINE_DIR = `${process.platform}-${process.arch}-node-${process.version.split('.')[0]}`

View File

@@ -12,7 +12,6 @@ import {
} from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('preserve subdeps on update', async (t: tape.Test) => {
const project = prepareEmpty(t)

View File

@@ -13,7 +13,6 @@ import {
} from '../utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('save to package.json (is-positive@^1.0.0)', async (t) => {
const project = prepareEmpty(t)

View File

@@ -24,7 +24,6 @@ import writeJsonFile = require('write-json-file')
import { testDefaults } from './utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
const ncp = promisify(ncpCB.ncp)
test('relative link', async (t: tape.Test) => {
@@ -260,7 +259,7 @@ test('relative link uses realpath when contained in a symlinked dir', async (t:
}
})
// test['skip']('relative link when an external lockfile is used', async (t: tape.Test) => {
// test.skip('relative link when an external lockfile is used', async (t: tape.Test) => {
// const projects = prepare(t, [
// {
// name: 'project',

View File

@@ -26,8 +26,6 @@ import {
} from './utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test['skip'] = promisifyTape(tape.skip) // tslint:disable-line:no-string-literal
const LOCKFILE_WARN_LOG = {
level: 'warn',
@@ -559,7 +557,7 @@ test('repeat install with no inner lockfile should not rewrite packages in node_
// Skipped because the npm-registry.compass.com server was down
// might be a good idea to mock it
// tslint:disable-next-line:no-string-literal
test['skip']('installing from lockfile when using npm enterprise', async (t: tape.Test) => {
test.skip('installing from lockfile when using npm enterprise', async (t: tape.Test) => {
const project = prepareEmpty(t)
const opts = await testDefaults({ registry: 'https://npm-registry.compass.com/' })

View File

@@ -14,7 +14,6 @@ import promisifyTape from 'tape-promise'
import { testDefaults } from './utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('prune removes extraneous packages', async (t: tape.Test) => {
const project = prepareEmpty(t)

View File

@@ -27,7 +27,6 @@ import writeJsonFile = require('write-json-file')
import { testDefaults } from './utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
const ncp = promisify(ncpCB.ncp)
test('uninstall package with no dependencies', async (t: tape.Test) => {

View File

@@ -19,7 +19,6 @@ import {
} from './utils'
const test = promisifyTape(tape)
const testOnly = promisifyTape(tape.only)
test('unlink 1 package that exists in package.json', async (t: tape.Test) => {
const project = prepareEmpty(t)

12
pnpm-lock.yaml generated
View File

@@ -603,6 +603,7 @@ importers:
'@types/ramda': 0.26.38
'@types/rimraf': 2.0.3
'@types/sinon': 7.5.1
'@types/tape-promise': 4.0.0
'@zkochan/rimraf': 1.0.0
fs-extra: 8.1.0
is-windows: 1.0.2
@@ -649,6 +650,7 @@ importers:
'@types/ramda': ^0.26.38
'@types/rimraf': ^2.0.3
'@types/sinon': ^7.5.1
'@types/tape-promise': 4.0.0
'@zkochan/rimraf': 1.0.0
dependency-path: 'workspace:4.0.2'
fs-extra: 8.1.0
@@ -1962,6 +1964,7 @@ importers:
'@types/retry': 0.12.0
'@types/semver': 6.2.0
'@types/table': 4.0.7
'@types/tape-promise': 4.0.0
'@types/update-notifier': 2.5.0
'@zkochan/rimraf': 1.0.0
anonymous-npm-registry-client: 0.1.2
@@ -2037,6 +2040,7 @@ importers:
'@types/retry': 0.12.0
'@types/semver': ^6.2.0
'@types/table': ^4.0.7
'@types/tape-promise': 4.0.0
'@types/update-notifier': 2.5.0
'@zkochan/libnpx': 11.0.3
'@zkochan/rimraf': 1.0.0
@@ -2441,6 +2445,7 @@ importers:
'@types/ramda': 0.26.38
'@types/semver': 6.2.0
'@types/sinon': 7.5.1
'@types/tape-promise': 4.0.0
anonymous-npm-registry-client: 0.1.2
cross-spawn: 7.0.1
deep-require-cwd: 1.0.0
@@ -2515,6 +2520,7 @@ importers:
'@types/ramda': ^0.26.38
'@types/semver': ^6.2.0
'@types/sinon': ^7.5.1
'@types/tape-promise': 4.0.0
'@zkochan/npm-package-arg': 1.0.2
'@zkochan/rimraf': 1.0.0
anonymous-npm-registry-client: 0.1.2
@@ -3430,6 +3436,12 @@ packages:
dev: true
resolution:
integrity: sha512-HKtXvBxU8U8evZCSlUi9HbfT/SFW7nSGCoiBEheB06jAhXeW6JbGh8biEAqIFG5rZo9f8xeJVdIn455sddmIcw==
/@types/tape-promise/4.0.0:
dependencies:
'@types/tape': 4.2.33
dev: true
resolution:
integrity: sha512-Ek6EryyaAvP3Lm1aol660YfmhpDkf04TJHK6Vc+R68EQrecK8Qkbv7Ct5jvY2Yf0fkhmkeim4DOz3yDiEYEnNQ==
/@types/tape/4.2.33:
dependencies:
'@types/node': 12.12.21

10
typings/typed.d.ts vendored
View File

@@ -21,16 +21,6 @@ declare module 'read-ini-file' {
export = readIniFile;
}
declare module 'tape-promise' {
import tape = require('tape')
export = tapePromise;
function tapePromise(tape: any): (name: string, cb: tape.TestCase) => void;
function tapePromise(tape: any): (name: string, opts: tape.TestOptions, cb: tape.TestCase) => void;
function tapePromise(tape: any): (cb: tape.TestCase) => void;
function tapePromise(tape: any): (opts: tape.TestOptions, cb: tape.TestCase) => void;
}
declare module 'semver-utils' {
export function parseRange (range: string): Array<{
semver?: string,