mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-10 18:18:56 -04:00
* refactor: rename workspace.sort-packages and workspace.pkgs-graph - workspace.sort-packages -> workspace.projects-sorter - workspace.pkgs-graph -> workspace.projects-graph Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: rename packages/ to core/ and pkg-manifest.read-package-json to reader - Rename packages/ directory to core/ for clarity - Rename pkg-manifest/read-package-json to pkg-manifest/reader (@pnpm/pkg-manifest.reader) - Update all tsconfig, package.json, and lockfile references Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: consolidate runtime resolvers under engine/runtime domain - Remove unused @pnpm/engine.runtime.node.fetcher package - Rename engine/runtime/node.resolver to node-resolver (dash convention) - Move resolving/bun-resolver to engine/runtime/bun-resolver - Move resolving/deno-resolver to engine/runtime/deno-resolver - Update all package names, tsconfig paths, and lockfile references Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: update lockfile after removing node.fetcher Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: sort tsconfig references and package.json deps alphabetically Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: auto-fix import sorting Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update __typings__ paths in tsconfig.lint.json for moved resolvers Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: remove deno-resolver from deps of bun-resolver --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
/// <reference path="../../../__typings__/index.d.ts"/>
|
|
import path from 'node:path'
|
|
|
|
import { readPackageJson, readPackageJsonFromDir } from '@pnpm/pkg-manifest.reader'
|
|
|
|
const fixtures = path.join(import.meta.dirname, 'fixtures')
|
|
|
|
test('readPackageJson()', async () => {
|
|
expect((await readPackageJson(path.join(import.meta.dirname, '..', 'package.json'))).name).toBe('@pnpm/pkg-manifest.reader')
|
|
})
|
|
|
|
test('fromDir()', async () => {
|
|
expect((await readPackageJsonFromDir(path.join(import.meta.dirname, '..'))).name).toBe('@pnpm/pkg-manifest.reader')
|
|
})
|
|
|
|
test('readPackageJson() throw error when name is invalid', async () => {
|
|
let err
|
|
try {
|
|
await readPackageJson(path.join(fixtures, 'invalid-name', 'package.json'))
|
|
} catch (_: any) { // eslint-disable-line
|
|
err = _
|
|
}
|
|
expect(err.code).toBe('ERR_PNPM_BAD_PACKAGE_JSON')
|
|
})
|
|
|
|
test('readPackageJson() throw initial error when package.json not found', async () => {
|
|
let err
|
|
try {
|
|
await readPackageJson(path.join(fixtures, 'package.json'))
|
|
} catch (_: any) { // eslint-disable-line
|
|
err = _
|
|
}
|
|
expect(err.code).toBe('ENOENT')
|
|
})
|