chore: upgrade @typescript/native-preview to 7.0.0-dev.20260421.2 (#11332)

* chore: upgrade @typescript/native-preview to 7.0.0-dev.20260421.2

- Add explicit `types: ["node"]` to the shared tsconfig because tsgo
  20260421 no longer auto-acquires `@types/*` from `node_modules`.
- Refactor test files to explicitly import jest globals (`describe`,
  `it`, `test`, `expect`, `beforeEach`, etc.) from `@jest/globals`
  instead of relying on `@types/jest` ambient declarations. Under the
  new tsgo build, `import { jest } from '@jest/globals'` shadows the
  ambient `jest` namespace, breaking `@types/jest`'s `declare var
  describe: jest.Describe;` globals.
- Add `@jest/globals` to each package's devDependencies where tests
  now import from it, and add `@types/node` to packages that need it
  but were relying on hoisted resolution.
- Replace `fail()` calls with `throw new Error(...)` since `fail` is
  no longer globally available.

* chore: fix remaining tsgo type-strictness errors

- Strip `as <PnpmType>` casts on objects passed to toMatchObject /
  toStrictEqual / toEqual; @jest/globals rejects the typed objects
  (which include AsymmetricMatchers) vs. the repo-specific type.
- Type `jest.fn<...>()` explicitly where the mock's signature matters
  for toHaveBeenCalledWith.
- Replace `beforeEach(() => X)` with `beforeEach(() => { X })` so the
  return value is void, as the stricter jest typing requires.
- Use `expect.objectContaining({...})` in one place where the full
  expected object triggered stricter type resolution.
- Cast `prompt.mock.calls` arg through `as unknown as Record<...>[]`
  for patch.test.ts's nested-array matchers.
- Fix off-by-one `<reference path>` in pnpm/test/getConfig.test.ts
  that only surfaced now.
- Move `@jest/globals` from devDependencies to dependencies in the
  two `__utils__` packages that import it from `src/`.
- Clean up unused imports from the @jest/globals migration.

* chore: address Copilot review on #11332

- Move misplaced `@jest/globals` imports to the top import block in
  checkEngine, run.ts, and workspace/root-finder tests where the
  script dropped them below executable code.
- Replace `try { await x(); throw new Error('should have thrown') } catch`
  in bins/linker, lockfile/fs, and resolving/local-resolver tests with
  `await expect(x()).rejects.toMatchObject({...})`. The old pattern
  swallowed an unrelated `throw` if the under-test call silently
  succeeded, which would fail on the catch-block assertion with a
  misleading message.
This commit is contained in:
Zoltan Kochan committed 2026-04-21 23:21:52 +02:00
1 parent a50c5d23f9
commit 4d7cd56ccc
579 files changed
+1182 -378

No files matched your search

+1
View File
@@ -45,6 +45,7 @@
"test": "pn pretest && pn compile && jest" "test": "pn pretest && pn compile && jest"
}, },
"dependencies": { "dependencies": {
"@jest/globals": "catalog:",
"@pnpm/assert-store": "workspace:*", "@pnpm/assert-store": "workspace:*",
"@pnpm/constants": "workspace:*", "@pnpm/constants": "workspace:*",
"@pnpm/installing.modules-yaml": "workspace:*", "@pnpm/installing.modules-yaml": "workspace:*",
+1
View File
@@ -3,6 +3,7 @@ import { createRequire } from 'node:module'
import path from 'node:path' import path from 'node:path'
import util from 'node:util' import util from 'node:util'
import { expect } from '@jest/globals'
import { assertStore } from '@pnpm/assert-store' import { assertStore } from '@pnpm/assert-store'
import { WANTED_LOCKFILE } from '@pnpm/constants' import { WANTED_LOCKFILE } from '@pnpm/constants'
import type { Modules } from '@pnpm/installing.modules-yaml' import type { Modules } from '@pnpm/installing.modules-yaml'
+2
View File
@@ -1,6 +1,8 @@
/// <reference path="../../../__typings__/index.d.ts"/> /// <reference path="../../../__typings__/index.d.ts"/>
import path from 'node:path' import path from 'node:path'
import { expect, test } from '@jest/globals'
import { assertProject } from '../src/index.js' import { assertProject } from '../src/index.js'
test('assertProject()', async () => { test('assertProject()', async () => {
+3 -1
View File
@@ -32,12 +32,14 @@
"test": "pn pretest && pn compile && jest" "test": "pn pretest && pn compile && jest"
}, },
"dependencies": { "dependencies": {
"@jest/globals": "catalog:",
"@pnpm/registry-mock": "catalog:", "@pnpm/registry-mock": "catalog:",
"@pnpm/store.cafs": "workspace:*", "@pnpm/store.cafs": "workspace:*",
"@pnpm/store.index": "workspace:*" "@pnpm/store.index": "workspace:*"
}, },
"devDependencies": { "devDependencies": {
"@pnpm/assert-store": "workspace:*", "@pnpm/assert-store": "workspace:*",
"@pnpm/constants": "workspace:*" "@pnpm/constants": "workspace:*",
"@types/node": "catalog:"
} }
} }
+1
View File
@@ -1,6 +1,7 @@
import fs from 'node:fs' import fs from 'node:fs'
import path from 'node:path' import path from 'node:path'
import { expect } from '@jest/globals'
import { getIntegrity, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import { getIntegrity, REGISTRY_MOCK_PORT } from '@pnpm/registry-mock'
import { StoreIndex, storeIndexKey } from '@pnpm/store.index' import { StoreIndex, storeIndexKey } from '@pnpm/store.index'
+1
View File
@@ -1,6 +1,7 @@
/// <reference path="../../../__typings__/index.d.ts"/> /// <reference path="../../../__typings__/index.d.ts"/>
import path from 'node:path' import path from 'node:path'
import { expect, test } from '@jest/globals'
import { assertStore } from '@pnpm/assert-store' import { assertStore } from '@pnpm/assert-store'
import { STORE_VERSION } from '@pnpm/constants' import { STORE_VERSION } from '@pnpm/constants'
+1
View File
@@ -9,6 +9,7 @@
"test-ipc-server-client": "./bin/test-ipc-server-client.js" "test-ipc-server-client": "./bin/test-ipc-server-client.js"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "catalog:",
"@pnpm/prepare": "workspace:*", "@pnpm/prepare": "workspace:*",
"@pnpm/test-ipc-server": "workspace:*", "@pnpm/test-ipc-server": "workspace:*",
"@types/node": "catalog:", "@types/node": "catalog:",
@@ -5,6 +5,7 @@ import path from 'node:path'
import { setTimeout } from 'node:timers/promises' import { setTimeout } from 'node:timers/promises'
import { promisify } from 'node:util' import { promisify } from 'node:util'
import { describe, expect, it } from '@jest/globals'
import { prepare } from '@pnpm/prepare' import { prepare } from '@pnpm/prepare'
import { createTestIpcServer } from '@pnpm/test-ipc-server' import { createTestIpcServer } from '@pnpm/test-ipc-server'
import { safeExeca as execa } from 'execa' import { safeExeca as execa } from 'execa'
+1
View File
@@ -14,6 +14,7 @@
"sourceMap": true, "sourceMap": true,
"strict": true, "strict": true,
"target": "es2022", "target": "es2022",
"types": ["node"],
"verbatimModuleSyntax": true "verbatimModuleSyntax": true
}, },
"atom": { "atom": {
-1
View File
@@ -4,7 +4,6 @@ import os from 'node:os'
import path from 'node:path' import path from 'node:path'
import { afterAll, beforeAll, describe, expect, it, jest } from '@jest/globals' import { afterAll, beforeAll, describe, expect, it, jest } from '@jest/globals'
// First run downloads packages from registry-mock — slow on Windows CI // First run downloads packages from registry-mock — slow on Windows CI
jest.setTimeout(600_000) jest.setTimeout(600_000)
import { fetchFromPnpmRegistry } from '@pnpm/agent.client' import { fetchFromPnpmRegistry } from '@pnpm/agent.client'
+1 -1
View File
@@ -1,6 +1,6 @@
import path from 'node:path' import path from 'node:path'
import { jest } from '@jest/globals' import { describe, expect, it, jest } from '@jest/globals'
import { login, type LoginContext, type LoginFetchResponse } from '../src/login.js' import { login, type LoginContext, type LoginFetchResponse } from '../src/login.js'
+5 -5
View File
@@ -1,6 +1,6 @@
import path from 'node:path' import path from 'node:path'
import { jest } from '@jest/globals' import { describe, expect, it, jest } from '@jest/globals'
import { logout, type LogoutContext, type LogoutFetchResponse } from '../src/logout.js' import { logout, type LogoutContext, type LogoutFetchResponse } from '../src/logout.js'
@@ -64,7 +64,7 @@ describe('logout', () => {
}) })
it('should revoke token on registry and remove from auth.ini', async () => { it('should revoke token on registry and remove from auth.ini', async () => {
const fetch = jest.fn(async () => createMockResponse({ ok: true, status: 200 })) const fetch = jest.fn<LogoutContext['fetch']>(async () => createMockResponse({ ok: true, status: 200 }))
let savedPath = '' let savedPath = ''
let savedSettings: Record<string, unknown> = {} let savedSettings: Record<string, unknown> = {}
@@ -104,7 +104,7 @@ describe('logout', () => {
}) })
it('should logout from a custom registry', async () => { it('should logout from a custom registry', async () => {
const fetch = jest.fn(async () => createMockResponse({ ok: true, status: 200 })) const fetch = jest.fn<LogoutContext['fetch']>(async () => createMockResponse({ ok: true, status: 200 }))
let savedSettings: Record<string, unknown> = {} let savedSettings: Record<string, unknown> = {}
const context = createMockContext({ const context = createMockContext({
@@ -320,7 +320,7 @@ describe('logout', () => {
}) })
it('should URL-encode the token when revoking', async () => { it('should URL-encode the token when revoking', async () => {
const fetch = jest.fn(async () => createMockResponse({ ok: true, status: 200 })) const fetch = jest.fn<LogoutContext['fetch']>(async () => createMockResponse({ ok: true, status: 200 }))
const globalWarn = jest.fn() const globalWarn = jest.fn()
const context = createMockContext({ const context = createMockContext({
@@ -375,7 +375,7 @@ describe('logout', () => {
}) })
it('should handle registry with a path', async () => { it('should handle registry with a path', async () => {
const fetch = jest.fn(async () => createMockResponse({ ok: true, status: 200 })) const fetch = jest.fn<LogoutContext['fetch']>(async () => createMockResponse({ ok: true, status: 200 }))
let savedSettings: Record<string, unknown> = {} let savedSettings: Record<string, unknown> = {}
const context = createMockContext({ const context = createMockContext({
+1
View File
@@ -1,6 +1,7 @@
import fs, { promises as fsPromises } from 'node:fs' import fs, { promises as fsPromises } from 'node:fs'
import path from 'node:path' import path from 'node:path'
import { expect, test } from '@jest/globals'
import { temporaryDirectory } from 'tempy' import { temporaryDirectory } from 'tempy'
import { getBinNodePaths } from '../src/getBinNodePaths.js' import { getBinNodePaths } from '../src/getBinNodePaths.js'
+9 -10
View File
@@ -3,7 +3,7 @@ import { spawnSync } from 'node:child_process'
import fs from 'node:fs' import fs from 'node:fs'
import path from 'node:path' import path from 'node:path'
import { jest } from '@jest/globals' import { beforeEach, describe, expect, jest, test } from '@jest/globals'
import { fixtures } from '@pnpm/test-fixtures' import { fixtures } from '@pnpm/test-fixtures'
import { cmdExtension as CMD_EXTENSION } from 'cmd-extension' import { cmdExtension as CMD_EXTENSION } from 'cmd-extension'
import isWindows from 'is-windows' import isWindows from 'is-windows'
@@ -466,19 +466,18 @@ test('linkBins() would throw error if package has no name field', async () => {
const binTarget = temporaryDirectory() const binTarget = temporaryDirectory()
const noNameFixture = f.prepare('no-name') const noNameFixture = f.prepare('no-name')
const warn = jest.fn() const warn = jest.fn()
const packagePath = normalizePath(path.join(noNameFixture, 'node_modules/simple'))
try { await expect(
await linkBins(path.join(noNameFixture, 'node_modules'), binTarget, { linkBins(path.join(noNameFixture, 'node_modules'), binTarget, {
allowExoticManifests: true, allowExoticManifests: true,
warn, warn,
}) })
fail('linkBins should fail when package has no name') ).rejects.toMatchObject({
} catch (err: any) { // eslint-disable-line message: `Package in ${packagePath} must have a name to get bin linked.`,
const packagePath = normalizePath(path.join(noNameFixture, 'node_modules/simple')) code: 'ERR_PNPM_INVALID_PACKAGE_NAME',
expect(err.message).toBe(`Package in ${packagePath} must have a name to get bin linked.`) })
expect(err.code).toBe('ERR_PNPM_INVALID_PACKAGE_NAME') expect(warn).not.toHaveBeenCalled()
expect(warn).not.toHaveBeenCalled()
}
}) })
test('linkBins() would give warning if package has no bin field', async () => { test('linkBins() would give warning if package has no bin field', async () => {
+1
View File
@@ -38,6 +38,7 @@
"tinyglobby": "catalog:" "tinyglobby": "catalog:"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "catalog:",
"@pnpm/bins.resolver": "workspace:*", "@pnpm/bins.resolver": "workspace:*",
"@types/node": "catalog:", "@types/node": "catalog:",
"tempy": "catalog:" "tempy": "catalog:"
+1
View File
@@ -1,5 +1,6 @@
import path from 'node:path' import path from 'node:path'
import { expect, test } from '@jest/globals'
import { getBinsFromPackageManifest } from '@pnpm/bins.resolver' import { getBinsFromPackageManifest } from '@pnpm/bins.resolver'
test('getBinsFromPackageManifest()', async () => { test('getBinsFromPackageManifest()', async () => {
@@ -2,6 +2,7 @@
import fs from 'node:fs' import fs from 'node:fs'
import path from 'node:path' import path from 'node:path'
import { expect, test } from '@jest/globals'
import { getBinsFromPackageManifest } from '@pnpm/bins.resolver' import { getBinsFromPackageManifest } from '@pnpm/bins.resolver'
import { temporaryDirectory } from 'tempy' import { temporaryDirectory } from 'tempy'
+1 -1
View File
@@ -2,7 +2,7 @@
import fs from 'node:fs' import fs from 'node:fs'
import path from 'node:path' import path from 'node:path'
import { jest } from '@jest/globals' import { afterAll, expect, jest, test } from '@jest/globals'
import { rebuild } from '@pnpm/building.commands' import { rebuild } from '@pnpm/building.commands'
import { ENGINE_NAME, STORE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants' import { ENGINE_NAME, STORE_VERSION, WANTED_LOCKFILE } from '@pnpm/constants'
import { hashObject } from '@pnpm/crypto.object-hasher' import { hashObject } from '@pnpm/crypto.object-hasher'
@@ -1,5 +1,6 @@
import path from 'node:path' import path from 'node:path'
import { expect, test } from '@jest/globals'
import { assertProject } from '@pnpm/assert-project' import { assertProject } from '@pnpm/assert-project'
import { rebuild } from '@pnpm/building.commands' import { rebuild } from '@pnpm/building.commands'
import { preparePackages } from '@pnpm/prepare' import { preparePackages } from '@pnpm/prepare'
@@ -1,7 +1,7 @@
import fs from 'node:fs' import fs from 'node:fs'
import path from 'node:path' import path from 'node:path'
import { jest } from '@jest/globals' import { expect, jest, test } from '@jest/globals'
import type { ApproveBuildsCommandOpts, RebuildCommandOpts } from '@pnpm/building.commands' import type { ApproveBuildsCommandOpts, RebuildCommandOpts } from '@pnpm/building.commands'
import { getConfig } from '@pnpm/config.reader' import { getConfig } from '@pnpm/config.reader'
import { readModulesManifest } from '@pnpm/installing.modules-yaml' import { readModulesManifest } from '@pnpm/installing.modules-yaml'
@@ -1,6 +1,7 @@
import fs from 'node:fs' import fs from 'node:fs'
import path from 'node:path' import path from 'node:path'
import { expect, test } from '@jest/globals'
import { ignoredBuilds } from '@pnpm/building.commands' import { ignoredBuilds } from '@pnpm/building.commands'
import { writeModulesManifest } from '@pnpm/installing.modules-yaml' import { writeModulesManifest } from '@pnpm/installing.modules-yaml'
import { tempDir } from '@pnpm/prepare-temp-dir' import { tempDir } from '@pnpm/prepare-temp-dir'
+1
View File
@@ -56,6 +56,7 @@
"@pnpm/worker": "workspace:^" "@pnpm/worker": "workspace:^"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "catalog:",
"@pnpm/building.during-install": "workspace:*", "@pnpm/building.during-install": "workspace:*",
"@pnpm/logger": "workspace:*", "@pnpm/logger": "workspace:*",
"@types/ramda": "catalog:" "@types/ramda": "catalog:"
@@ -1,3 +1,5 @@
import { expect, test } from '@jest/globals'
import { buildSequence } from '../lib/buildSequence.js' import { buildSequence } from '../lib/buildSequence.js'
test('buildSequence() test 1', () => { test('buildSequence() test 1', () => {
+1
View File
@@ -35,6 +35,7 @@
"@pnpm/types": "workspace:*" "@pnpm/types": "workspace:*"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "catalog:",
"@pnpm/building.policy": "workspace:*" "@pnpm/building.policy": "workspace:*"
}, },
"engines": { "engines": {
+1
View File
@@ -1,3 +1,4 @@
import { expect, it } from '@jest/globals'
import { createAllowBuildFunction } from '@pnpm/building.policy' import { createAllowBuildFunction } from '@pnpm/building.policy'
it('should allowBuilds with true value', () => { it('should allowBuilds with true value', () => {
+1
View File
@@ -45,6 +45,7 @@
"@pnpm/logger": "catalog:" "@pnpm/logger": "catalog:"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "catalog:",
"@pnpm/cache.commands": "workspace:*", "@pnpm/cache.commands": "workspace:*",
"@pnpm/logger": "workspace:*", "@pnpm/logger": "workspace:*",
"@pnpm/prepare": "workspace:*", "@pnpm/prepare": "workspace:*",
+1
View File
@@ -1,5 +1,6 @@
import path from 'node:path' import path from 'node:path'
import { beforeEach, describe, expect, test } from '@jest/globals'
import { cache } from '@pnpm/cache.commands' import { cache } from '@pnpm/cache.commands'
import { prepare } from '@pnpm/prepare' import { prepare } from '@pnpm/prepare'
import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock'
+1
View File
@@ -1,5 +1,6 @@
import path from 'node:path' import path from 'node:path'
import { beforeAll, describe, expect, test } from '@jest/globals'
import { cache } from '@pnpm/cache.commands' import { cache } from '@pnpm/cache.commands'
import { prepare } from '@pnpm/prepare' import { prepare } from '@pnpm/prepare'
import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock'
+1
View File
@@ -1,5 +1,6 @@
import path from 'node:path' import path from 'node:path'
import { beforeEach, describe, expect, test } from '@jest/globals'
import { cache } from '@pnpm/cache.commands' import { cache } from '@pnpm/cache.commands'
import { prepare } from '@pnpm/prepare' import { prepare } from '@pnpm/prepare'
import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock' import { REGISTRY_MOCK_PORT } from '@pnpm/registry-mock'
+1
View File
@@ -35,6 +35,7 @@
"@pnpm/error": "workspace:*" "@pnpm/error": "workspace:*"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "catalog:",
"@pnpm/catalogs.config": "workspace:*", "@pnpm/catalogs.config": "workspace:*",
"@pnpm/catalogs.types": "workspace:*", "@pnpm/catalogs.types": "workspace:*",
"@pnpm/workspace.workspace-manifest-reader": "workspace:*" "@pnpm/workspace.workspace-manifest-reader": "workspace:*"
@@ -1,3 +1,4 @@
import { expect, test } from '@jest/globals'
import { getCatalogsFromWorkspaceManifest } from '@pnpm/catalogs.config' import { getCatalogsFromWorkspaceManifest } from '@pnpm/catalogs.config'
test('combines implicit default and named catalogs', () => { test('combines implicit default and named catalogs', () => {
+1
View File
@@ -32,6 +32,7 @@
".test": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules --disable-warning=ExperimentalWarning --disable-warning=DEP0169\" jest" ".test": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules --disable-warning=ExperimentalWarning --disable-warning=DEP0169\" jest"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "catalog:",
"@pnpm/catalogs.protocol-parser": "workspace:*" "@pnpm/catalogs.protocol-parser": "workspace:*"
}, },
"engines": { "engines": {
@@ -1,3 +1,4 @@
import { describe, expect, test } from '@jest/globals'
import { parseCatalogProtocol } from '@pnpm/catalogs.protocol-parser' import { parseCatalogProtocol } from '@pnpm/catalogs.protocol-parser'
test('parses named catalog', () => { test('parses named catalog', () => {
@@ -1,4 +1,4 @@
import { jest } from '@jest/globals' import { describe, expect, jest, test } from '@jest/globals'
import { matchCatalogResolveResult, resolveFromCatalog, type WantedDependency } from '@pnpm/catalogs.resolver' import { matchCatalogResolveResult, resolveFromCatalog, type WantedDependency } from '@pnpm/catalogs.resolver'
import type { Catalogs } from '@pnpm/catalogs.types' import type { Catalogs } from '@pnpm/catalogs.types'
import { PnpmError } from '@pnpm/error' import { PnpmError } from '@pnpm/error'
@@ -1,3 +1,5 @@
import { expect, test } from '@jest/globals'
import { complete } from '../../src/completion/complete.js' import { complete } from '../../src/completion/complete.js'
test('complete an option value', async () => { test('complete an option value', async () => {
@@ -1,4 +1,4 @@
import { jest } from '@jest/globals' import { expect, jest, test } from '@jest/globals'
import { generateCompletion } from '@pnpm/cli.commands' import { generateCompletion } from '@pnpm/cli.commands'
import { SUPPORTED_SHELLS } from '@pnpm/tabtab' import { SUPPORTED_SHELLS } from '@pnpm/tabtab'
@@ -1,3 +1,5 @@
import { expect, test } from '@jest/globals'
import { import {
currentTypedWordType, currentTypedWordType,
getLastOption, getLastOption,
@@ -1,3 +1,5 @@
import { expect, test } from '@jest/globals'
import { getShellFromParams, getShellFromString } from '../../src/completion/getShell.js' import { getShellFromParams, getShellFromString } from '../../src/completion/getShell.js'
test('getShellFromString errors on undefined', () => { test('getShellFromString errors on undefined', () => {
@@ -1,3 +1,5 @@
import { expect, test } from '@jest/globals'
import { optionTypesToCompletions } from '../../src/completion/optionTypesToCompletions.js' import { optionTypesToCompletions } from '../../src/completion/optionTypesToCompletions.js'
test('optionTypesToCompletions', () => { test('optionTypesToCompletions', () => {
+1
View File
@@ -58,6 +58,7 @@
"@pnpm/logger": "catalog:" "@pnpm/logger": "catalog:"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "catalog:",
"@pnpm/cli.default-reporter": "workspace:*", "@pnpm/cli.default-reporter": "workspace:*",
"@pnpm/logger": "workspace:*", "@pnpm/logger": "workspace:*",
"@types/normalize-path": "catalog:", "@types/normalize-path": "catalog:",
@@ -1,3 +1,4 @@
import { expect, test } from '@jest/globals'
import { toOutput$ } from '@pnpm/cli.default-reporter' import { toOutput$ } from '@pnpm/cli.default-reporter'
import type { Log } from '@pnpm/core-loggers' import type { Log } from '@pnpm/core-loggers'
import { createStreamParser, logger } from '@pnpm/logger' import { createStreamParser, logger } from '@pnpm/logger'
+1
View File
@@ -1,6 +1,7 @@
/// <reference path="../../../__typings__/index.d.ts"/> /// <reference path="../../../__typings__/index.d.ts"/>
import path from 'node:path' import path from 'node:path'
import { expect, test } from '@jest/globals'
import { toOutput$ } from '@pnpm/cli.default-reporter' import { toOutput$ } from '@pnpm/cli.default-reporter'
import type { Config, ConfigContext } from '@pnpm/config.reader' import type { Config, ConfigContext } from '@pnpm/config.reader'
import { import {
@@ -1,5 +1,6 @@
import { setTimeout } from 'node:timers/promises' import { setTimeout } from 'node:timers/promises'
import { expect, test } from '@jest/globals'
import { toOutput$ } from '@pnpm/cli.default-reporter' import { toOutput$ } from '@pnpm/cli.default-reporter'
import { contextLogger, packageImportMethodLogger } from '@pnpm/core-loggers' import { contextLogger, packageImportMethodLogger } from '@pnpm/core-loggers'
import { import {
@@ -1,3 +1,4 @@
import { expect, test } from '@jest/globals'
import { toOutput$ } from '@pnpm/cli.default-reporter' import { toOutput$ } from '@pnpm/cli.default-reporter'
import type { Config, ConfigContext } from '@pnpm/config.reader' import type { Config, ConfigContext } from '@pnpm/config.reader'
import { import {
@@ -1,5 +1,6 @@
import path from 'node:path' import path from 'node:path'
import { expect, test } from '@jest/globals'
import { toOutput$ } from '@pnpm/cli.default-reporter' import { toOutput$ } from '@pnpm/cli.default-reporter'
import { PnpmError } from '@pnpm/error' import { PnpmError } from '@pnpm/error'
import { import {
@@ -1,5 +1,6 @@
import { setTimeout } from 'node:timers/promises' import { setTimeout } from 'node:timers/promises'
import { expect, test } from '@jest/globals'
import { toOutput$ } from '@pnpm/cli.default-reporter' import { toOutput$ } from '@pnpm/cli.default-reporter'
import { packageManager } from '@pnpm/cli.meta' import { packageManager } from '@pnpm/cli.meta'
import { executionTimeLogger } from '@pnpm/core-loggers' import { executionTimeLogger } from '@pnpm/core-loggers'
@@ -1,5 +1,6 @@
import path from 'node:path' import path from 'node:path'
import { expect, test } from '@jest/globals'
import { toOutput$ } from '@pnpm/cli.default-reporter' import { toOutput$ } from '@pnpm/cli.default-reporter'
import { lifecycleLogger } from '@pnpm/core-loggers' import { lifecycleLogger } from '@pnpm/core-loggers'
import { createStreamParser } from '@pnpm/logger' import { createStreamParser } from '@pnpm/logger'
@@ -1,3 +1,4 @@
import { expect, test } from '@jest/globals'
import { toOutput$ } from '@pnpm/cli.default-reporter' import { toOutput$ } from '@pnpm/cli.default-reporter'
import { peerDependencyIssuesLogger } from '@pnpm/core-loggers' import { peerDependencyIssuesLogger } from '@pnpm/core-loggers'
import { import {
@@ -1,3 +1,4 @@
import { expect, test } from '@jest/globals'
import { toOutput$ } from '@pnpm/cli.default-reporter' import { toOutput$ } from '@pnpm/cli.default-reporter'
import type { Config, ConfigContext } from '@pnpm/config.reader' import type { Config, ConfigContext } from '@pnpm/config.reader'
import { import {
@@ -1,3 +1,4 @@
import { expect, test } from '@jest/globals'
import { toOutput$ } from '@pnpm/cli.default-reporter' import { toOutput$ } from '@pnpm/cli.default-reporter'
import { requestRetryLogger } from '@pnpm/core-loggers' import { requestRetryLogger } from '@pnpm/core-loggers'
import { import {
@@ -1,5 +1,6 @@
import { setTimeout } from 'node:timers/promises' import { setTimeout } from 'node:timers/promises'
import { expect, test } from '@jest/globals'
import { toOutput$ } from '@pnpm/cli.default-reporter' import { toOutput$ } from '@pnpm/cli.default-reporter'
import type { Config, ConfigContext } from '@pnpm/config.reader' import type { Config, ConfigContext } from '@pnpm/config.reader'
import { scopeLogger } from '@pnpm/core-loggers' import { scopeLogger } from '@pnpm/core-loggers'
@@ -1,6 +1,7 @@
import { setTimeout } from 'node:timers/promises' import { setTimeout } from 'node:timers/promises'
import { stripVTControlCharacters as stripAnsi } from 'node:util' import { stripVTControlCharacters as stripAnsi } from 'node:util'
import { expect, test } from '@jest/globals'
import { toOutput$ } from '@pnpm/cli.default-reporter' import { toOutput$ } from '@pnpm/cli.default-reporter'
import type { Config, ConfigContext } from '@pnpm/config.reader' import type { Config, ConfigContext } from '@pnpm/config.reader'
import { updateCheckLogger } from '@pnpm/core-loggers' import { updateCheckLogger } from '@pnpm/core-loggers'
+1
View File
@@ -35,6 +35,7 @@
"load-json-file": "catalog:" "load-json-file": "catalog:"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "catalog:",
"@pnpm/cli.meta": "workspace:*" "@pnpm/cli.meta": "workspace:*"
}, },
"engines": { "engines": {
@@ -1,3 +1,4 @@
import { describe, expect, test } from '@jest/globals'
import { detectIfCurrentPkgIsExecutable, getCurrentPackageName, isExecutedByCorepack } from '@pnpm/cli.meta' import { detectIfCurrentPkgIsExecutable, getCurrentPackageName, isExecutedByCorepack } from '@pnpm/cli.meta'
describe('detectIfCurrentPkgIsExecutable()', () => { describe('detectIfCurrentPkgIsExecutable()', () => {
+1
View File
@@ -38,6 +38,7 @@
"didyoumean2": "catalog:" "didyoumean2": "catalog:"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "catalog:",
"@pnpm/cli.parse-cli-args": "workspace:*", "@pnpm/cli.parse-cli-args": "workspace:*",
"tempy": "catalog:" "tempy": "catalog:"
}, },
+1
View File
@@ -1,5 +1,6 @@
import os from 'node:os' import os from 'node:os'
import { expect, test } from '@jest/globals'
import { parseCliArgs } from '@pnpm/cli.parse-cli-args' import { parseCliArgs } from '@pnpm/cli.parse-cli-args'
import type { PnpmError } from '@pnpm/error' import type { PnpmError } from '@pnpm/error'
import { temporaryDirectory } from 'tempy' import { temporaryDirectory } from 'tempy'
@@ -1,6 +1,7 @@
import fs from 'node:fs' import fs from 'node:fs'
import path from 'node:path' import path from 'node:path'
import { expect, test } from '@jest/globals'
import { config } from '@pnpm/config.commands' import { config } from '@pnpm/config.commands'
import { tempDir } from '@pnpm/prepare' import { tempDir } from '@pnpm/prepare'
import { readIniFileSync } from 'read-ini-file' import { readIniFileSync } from 'read-ini-file'
+1
View File
@@ -1,3 +1,4 @@
import { describe, expect, test } from '@jest/globals'
import { config } from '@pnpm/config.commands' import { config } from '@pnpm/config.commands'
import { createConfigCommandOpts, getOutputString } from './utils/index.js' import { createConfigCommandOpts, getOutputString } from './utils/index.js'
+1
View File
@@ -1,3 +1,4 @@
import { expect, test } from '@jest/globals'
import { config } from '@pnpm/config.commands' import { config } from '@pnpm/config.commands'
import { createConfigCommandOpts, getOutputString } from './utils/index.js' import { createConfigCommandOpts, getOutputString } from './utils/index.js'
+1
View File
@@ -1,6 +1,7 @@
import fs from 'node:fs' import fs from 'node:fs'
import path from 'node:path' import path from 'node:path'
import { expect, test } from '@jest/globals'
import { config } from '@pnpm/config.commands' import { config } from '@pnpm/config.commands'
import { PnpmError } from '@pnpm/error' import { PnpmError } from '@pnpm/error'
import { tempDir } from '@pnpm/prepare' import { tempDir } from '@pnpm/prepare'
@@ -1,5 +1,6 @@
import path from 'node:path' import path from 'node:path'
import { describe, expect, it } from '@jest/globals'
import { config } from '@pnpm/config.commands' import { config } from '@pnpm/config.commands'
import { tempDir } from '@pnpm/prepare' import { tempDir } from '@pnpm/prepare'
+1
View File
@@ -37,6 +37,7 @@
"escape-string-regexp": "catalog:" "escape-string-regexp": "catalog:"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "catalog:",
"@pnpm/config.matcher": "workspace:*" "@pnpm/config.matcher": "workspace:*"
}, },
"engines": { "engines": {
+1
View File
@@ -1,3 +1,4 @@
import { expect, test } from '@jest/globals'
import { createMatcher, createMatcherWithIndex } from '@pnpm/config.matcher' import { createMatcher, createMatcherWithIndex } from '@pnpm/config.matcher'
test('matcher()', () => { test('matcher()', () => {
@@ -1,3 +1,5 @@
import { expect, test } from '@jest/globals'
import { checkEngine } from '../lib/checkEngine.js' import { checkEngine } from '../lib/checkEngine.js'
const packageId = 'registry.npmjs.org/foo/1.0.0' const packageId = 'registry.npmjs.org/foo/1.0.0'
@@ -1,4 +1,4 @@
import { jest } from '@jest/globals' import { expect, jest, test } from '@jest/globals'
import type * as DetectLibc from 'detect-libc' import type * as DetectLibc from 'detect-libc'
const packageId = 'registry.npmjs.org/foo/1.0.0' const packageId = 'registry.npmjs.org/foo/1.0.0'
+1
View File
@@ -37,6 +37,7 @@
"@pnpm/resolving.parse-wanted-dependency": "workspace:*" "@pnpm/resolving.parse-wanted-dependency": "workspace:*"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "catalog:",
"@pnpm/config.parse-overrides": "workspace:*" "@pnpm/config.parse-overrides": "workspace:*"
}, },
"engines": { "engines": {
+1
View File
@@ -1,3 +1,4 @@
import { expect, test } from '@jest/globals'
import { parseOverrides } from '@pnpm/config.parse-overrides' import { parseOverrides } from '@pnpm/config.parse-overrides'
test.each([ test.each([
@@ -34,6 +34,7 @@
"@pnpm/types": "workspace:*" "@pnpm/types": "workspace:*"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "catalog:",
"@pnpm/config.pick-registry-for-package": "workspace:*" "@pnpm/config.pick-registry-for-package": "workspace:*"
}, },
"engines": { "engines": {
@@ -1,3 +1,4 @@
import { expect, test } from '@jest/globals'
import { pickRegistryForPackage } from '@pnpm/config.pick-registry-for-package' import { pickRegistryForPackage } from '@pnpm/config.pick-registry-for-package'
test('pick correct scope', () => { test('pick correct scope', () => {
+2
View File
@@ -1,3 +1,5 @@
import { expect, test } from '@jest/globals'
import type { InheritableConfigPair } from './inheritPickedConfig.js' import type { InheritableConfigPair } from './inheritPickedConfig.js'
import { inheritAuthConfig, inheritDlxConfig } from './localConfig.js' import { inheritAuthConfig, inheritDlxConfig } from './localConfig.js'
+1 -1
View File
@@ -1,6 +1,6 @@
import os, { cpus } from 'node:os' import os, { cpus } from 'node:os'
import { jest } from '@jest/globals' import { afterEach, beforeEach, expect, jest, test } from '@jest/globals'
import { getDefaultWorkspaceConcurrency, getWorkspaceConcurrency, resetAvailableParallelismCache } from '../lib/concurrency.js' import { getDefaultWorkspaceConcurrency, getWorkspaceConcurrency, resetAvailableParallelismCache } from '../lib/concurrency.js'
+2
View File
@@ -1,6 +1,8 @@
import os from 'node:os' import os from 'node:os'
import path from 'node:path' import path from 'node:path'
import { expect, test } from '@jest/globals'
import { getCacheDir, getConfigDir, getDataDir, getStateDir } from '../lib/dirs.js' import { getCacheDir, getConfigDir, getDataDir, getStateDir } from '../lib/dirs.js'
test('getCacheDir()', () => { test('getCacheDir()', () => {
+2
View File
@@ -1,6 +1,8 @@
import path from 'node:path' import path from 'node:path'
import url from 'node:url' import url from 'node:url'
import { expect, test } from '@jest/globals'
import { type ConfigPair, type GetSchema, parseEnvVars, type Schema } from '../src/env.js' import { type ConfigPair, type GetSchema, parseEnvVars, type Schema } from '../src/env.js'
function assertSchemaKey (key: string): void { function assertSchemaKey (key: string): void {
@@ -1,5 +1,6 @@
import fs from 'node:fs' import fs from 'node:fs'
import { expect, test } from '@jest/globals'
import { prepareEmpty } from '@pnpm/prepare' import { prepareEmpty } from '@pnpm/prepare'
import { getNetworkConfigs, type NetworkConfigs } from '../src/getNetworkConfigs.js' import { getNetworkConfigs, type NetworkConfigs } from '../src/getNetworkConfigs.js'
@@ -1,3 +1,5 @@
import { afterEach, expect, test } from '@jest/globals'
import { getOptionsFromPnpmSettings } from '../lib/getOptionsFromRootManifest.js' import { getOptionsFromPnpmSettings } from '../lib/getOptionsFromRootManifest.js'
const ORIGINAL_ENV = process.env const ORIGINAL_ENV = process.env
+1
View File
@@ -3,6 +3,7 @@ import fs from 'node:fs'
import { homedir } from 'node:os' import { homedir } from 'node:os'
import path from 'node:path' import path from 'node:path'
import { expect, test } from '@jest/globals'
import { getConfig } from '@pnpm/config.reader' import { getConfig } from '@pnpm/config.reader'
import { tempDir } from '@pnpm/prepare' import { tempDir } from '@pnpm/prepare'
import pathName from 'path-name' import pathName from 'path-name'
+1 -1
View File
@@ -3,7 +3,7 @@ import fs from 'node:fs'
import os from 'node:os' import os from 'node:os'
import path from 'node:path' import path from 'node:path'
import { jest } from '@jest/globals' import { afterEach, beforeEach, describe, expect, jest, test } from '@jest/globals'
import { prepare, prepareEmpty } from '@pnpm/prepare' import { prepare, prepareEmpty } from '@pnpm/prepare'
import { fixtures } from '@pnpm/test-fixtures' import { fixtures } from '@pnpm/test-fixtures'
import PATH from 'path-name' import PATH from 'path-name'
@@ -1,3 +1,4 @@
import { expect, test } from '@jest/globals'
import type { SupportedArchitectures } from '@pnpm/types' import type { SupportedArchitectures } from '@pnpm/types'
import { type CliOptions, overrideSupportedArchitecturesWithCLI, type TargetConfig } from '../src/overrideSupportedArchitecturesWithCLI.js' import { type CliOptions, overrideSupportedArchitecturesWithCLI, type TargetConfig } from '../src/overrideSupportedArchitecturesWithCLI.js'
+2
View File
@@ -1,3 +1,5 @@
import { describe, expect, test } from '@jest/globals'
import { import {
AuthMissingSeparatorError, AuthMissingSeparatorError,
type Creds, type Creds,
+1
View File
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals'
import { omit } from 'ramda' import { omit } from 'ramda'
import type { import type {
+2
View File
@@ -1,5 +1,7 @@
import path from 'node:path' import path from 'node:path'
import { describe, expect, test } from '@jest/globals'
import type { Config } from '../src/Config.js' import type { Config } from '../src/Config.js'
import { transformPath, transformPathKeys } from '../src/transformPath.js' import { transformPath, transformPathKeys } from '../src/transformPath.js'
+1
View File
@@ -37,6 +37,7 @@
"semver": "catalog:" "semver": "catalog:"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "catalog:",
"@pnpm/config.version-policy": "workspace:*", "@pnpm/config.version-policy": "workspace:*",
"@types/semver": "catalog:" "@types/semver": "catalog:"
}, },
+1
View File
@@ -1,3 +1,4 @@
import { expect, test } from '@jest/globals'
import { createPackageVersionPolicy } from '@pnpm/config.version-policy' import { createPackageVersionPolicy } from '@pnpm/config.version-policy'
test('createPackageVersionPolicy()', () => { test('createPackageVersionPolicy()', () => {
+1
View File
@@ -35,6 +35,7 @@
"@pnpm/constants": "workspace:*" "@pnpm/constants": "workspace:*"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "catalog:",
"@pnpm/error": "workspace:*" "@pnpm/error": "workspace:*"
}, },
"engines": { "engines": {
+1
View File
@@ -1,3 +1,4 @@
import { expect, test } from '@jest/globals'
import { FetchError, PnpmError } from '@pnpm/error' import { FetchError, PnpmError } from '@pnpm/error'
test('PnpmError exposes cause when provided', () => { test('PnpmError exposes cause when provided', () => {
+1
View File
@@ -36,6 +36,7 @@
"split2": "catalog:" "split2": "catalog:"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "catalog:",
"@pnpm/logger": "workspace:*" "@pnpm/logger": "workspace:*"
}, },
"engines": { "engines": {
+1
View File
@@ -1,3 +1,4 @@
import { expect, test } from '@jest/globals'
import { type LogBase, logger, streamParser } from '@pnpm/logger' import { type LogBase, logger, streamParser } from '@pnpm/logger'
test('logger logs', async () => { test('logger logs', async () => {
+1
View File
@@ -37,6 +37,7 @@
"ssri": "catalog:" "ssri": "catalog:"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "catalog:",
"@pnpm/crypto.hash": "workspace:*", "@pnpm/crypto.hash": "workspace:*",
"@pnpm/prepare": "workspace:*", "@pnpm/prepare": "workspace:*",
"@types/ssri": "catalog:", "@types/ssri": "catalog:",
+1
View File
@@ -2,6 +2,7 @@
import fs from 'node:fs' import fs from 'node:fs'
import { pipeline } from 'node:stream/promises' import { pipeline } from 'node:stream/promises'
import { expect, test } from '@jest/globals'
import { createHashFromFile, createShortHash, getTarballIntegrity } from '@pnpm/crypto.hash' import { createHashFromFile, createShortHash, getTarballIntegrity } from '@pnpm/crypto.hash'
import { tempDir } from '@pnpm/prepare' import { tempDir } from '@pnpm/prepare'
import tar from 'tar-stream' import tar from 'tar-stream'
+1
View File
@@ -36,6 +36,7 @@
"@pnpm/error": "workspace:*" "@pnpm/error": "workspace:*"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "catalog:",
"@pnpm/crypto.integrity": "workspace:*" "@pnpm/crypto.integrity": "workspace:*"
}, },
"engines": { "engines": {
+1
View File
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals'
import { formatIntegrity, parseIntegrity } from '@pnpm/crypto.integrity' import { formatIntegrity, parseIntegrity } from '@pnpm/crypto.integrity'
describe('parseIntegrity', () => { describe('parseIntegrity', () => {
+1
View File
@@ -37,6 +37,7 @@
"ramda": "catalog:" "ramda": "catalog:"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "catalog:",
"@pnpm/crypto.object-hasher": "workspace:*", "@pnpm/crypto.object-hasher": "workspace:*",
"@types/object-hash": "catalog:", "@types/object-hash": "catalog:",
"@types/ramda": "catalog:" "@types/ramda": "catalog:"
+1
View File
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals'
import { hashObject, hashObjectNullableWithPrefix, hashObjectWithoutSorting } from '@pnpm/crypto.object-hasher' import { hashObject, hashObjectNullableWithPrefix, hashObjectWithoutSorting } from '@pnpm/crypto.object-hasher'
describe('hashObject', () => { describe('hashObject', () => {
+1
View File
@@ -38,6 +38,7 @@
"@pnpm/fetching.types": "workspace:*" "@pnpm/fetching.types": "workspace:*"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "catalog:",
"@pnpm/crypto.shasums-file": "workspace:*" "@pnpm/crypto.shasums-file": "workspace:*"
}, },
"engines": { "engines": {
+1
View File
@@ -1,3 +1,4 @@
import { describe, expect, it } from '@jest/globals'
import { pickFileChecksumFromShasumsFile } from '@pnpm/crypto.shasums-file' import { pickFileChecksumFromShasumsFile } from '@pnpm/crypto.shasums-file'
describe('pickFileChecksumFromShasumsFile', () => { describe('pickFileChecksumFromShasumsFile', () => {
+1
View File
@@ -48,6 +48,7 @@
"@pnpm/logger": "catalog:" "@pnpm/logger": "catalog:"
}, },
"devDependencies": { "devDependencies": {
"@jest/globals": "catalog:",
"@pnpm/constants": "workspace:*", "@pnpm/constants": "workspace:*",
"@pnpm/deps.compliance.audit": "workspace:*", "@pnpm/deps.compliance.audit": "workspace:*",
"@pnpm/logger": "workspace:*", "@pnpm/logger": "workspace:*",
+1
View File
@@ -1,3 +1,4 @@
import { describe, expect, test } from '@jest/globals'
import { LOCKFILE_VERSION } from '@pnpm/constants' import { LOCKFILE_VERSION } from '@pnpm/constants'
import { audit, buildAuditPathIndex, lockfileToAuditRequest } from '@pnpm/deps.compliance.audit' import { audit, buildAuditPathIndex, lockfileToAuditRequest } from '@pnpm/deps.compliance.audit'
import type { PnpmError } from '@pnpm/error' import type { PnpmError } from '@pnpm/error'
+1
View File
@@ -1,5 +1,6 @@
import path from 'node:path' import path from 'node:path'
import { afterEach, beforeEach, expect, test } from '@jest/globals'
import { audit } from '@pnpm/deps.compliance.commands' import { audit } from '@pnpm/deps.compliance.commands'
import { fixtures } from '@pnpm/test-fixtures' import { fixtures } from '@pnpm/test-fixtures'
import { getMockAgent, setupMockAgent, teardownMockAgent } from '@pnpm/testing.mock-agent' import { getMockAgent, setupMockAgent, teardownMockAgent } from '@pnpm/testing.mock-agent'
+1
View File
@@ -1,5 +1,6 @@
import { join } from 'node:path' import { join } from 'node:path'
import { afterEach, beforeEach, describe, expect, test } from '@jest/globals'
import { audit } from '@pnpm/deps.compliance.commands' import { audit } from '@pnpm/deps.compliance.commands'
import { readWantedLockfile } from '@pnpm/lockfile.fs' import { readWantedLockfile } from '@pnpm/lockfile.fs'
import { addDistTag } from '@pnpm/registry-mock' import { addDistTag } from '@pnpm/registry-mock'
+1
View File
@@ -1,5 +1,6 @@
import path from 'node:path' import path from 'node:path'
import { afterEach, beforeEach, expect, test } from '@jest/globals'
import { audit } from '@pnpm/deps.compliance.commands' import { audit } from '@pnpm/deps.compliance.commands'
import { fixtures } from '@pnpm/test-fixtures' import { fixtures } from '@pnpm/test-fixtures'
import { getMockAgent, setupMockAgent, teardownMockAgent } from '@pnpm/testing.mock-agent' import { getMockAgent, setupMockAgent, teardownMockAgent } from '@pnpm/testing.mock-agent'
Loaded 100 of 579 files, more files were not shown because too many files have changed in this diff. Show more