mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-29 12:31:52 -04:00
* chore(deps): add `libnpmpublish` to catalog
* chore(deps): install `libnpmpublish`
* feat: publishableManifest (wip)
* feat: publishableManifest (wip)
* chore(cspell): libnpmpublish
* test: fix
* feat: validate field and version
* chore: @npm/types
* chore: todo
* refactor: reorganize
* feat: transformRequiredFields
* chore(deps): patch `libnpmpublish`
* fix: `BaseManifest.config`
* fix: eslint
* chore(git): revert a patch that doesn't work
This reverts commit 45f2c6a6c2.
We will use type casting
* feat: `engines.runtime`
* feat: normalize bin
* fix: `bin === ''`
* test: fix
* refactor: inference friendly
* feat: `peerDependenciesMeta`
* refactor: group into a directory
* refactor: use `ramda.pipe`
* refactor: less intrusive type assertion
* feat!: returning `ExportedManifest`
* refactor: remove unnecessary file
* docs: add a todo
* refactor: getNetworkConfigs (#10458)
Some tests are added as a bonus
* feat: `publishPackedPkg` (wip)
* feat: replace `\t` with 4 spaces
* fix: newline
* fix: newline
* refactor: extract `FailedToPublishError`
* test: FailedToPublishError
* feat: registryConfigKeys
* feat: `publishPackedPkg` (wip)
* feat(config/getNetworkConfigs): load auth info
* feat(config/getNetworkConfigs): load auth info (#10491)
* feat: `publishPackedPkg` (wip)
* refactor: extract a `static` function
* fix: inheritance, override, and merge
* feat: `executeTokenHelper`
* fix: use the visible `globalWarn`
* feat: add options
* feat: add more options
* docs: more links
* fix: private packages
* fix: --dry-run
* feat: log more things
* fix: name
* fix: tag
* refactor: remove extraneous `assertPublicPackage`
* feat: use `publishPackedPkg` for directories
* refactor: require only necessary fields
* refactor: extractManifestFromPacked
* fix: extractManifestFromPacked
* test: extractManifestFromPacked
* feat: isTarballPath
* feat: use `publishPackedPkg` for tarballs
* style: add an empty line for clarity
* refactor: remove unnecessary works
* feat: --otp
* feat: PNPM_CONFIG_OTP
* feat: oidc
* test: fix name collision
* fix: eslint
* test: disable a false test
* feat: set `provenance`
* docs(todo): auto provenance
* refactor: run oidc in `createPublishOptions`
* fix: correct auth keys for `libnpmpublish`
* docs: changeset
* fix: incorrect `password` field
* fix: typo, grammar
* chore(git): resolve merge conflict ahead of time
In preparation for https://github.com/pnpm/pnpm/pull/10385
* fix: field name
* fix(config): decoding `_password`
* fix: edge case of partial `cert`/`key`
* fix: ensure `registry` always match its config key
* fix: `_password`
* test: correct a name
* test: more specific assertions
* fix: grammar
* docs(changeset): fix grammar
* docs: fix grammar
* fix: clean up after failure
* test: fix windows
* feat(provenance): auto detect
* refactor: consistent name
* fix: correct error names
* refactor: extract the `provenance` code
* feat: show code and body of an error
* refactor: use `encodeURIComponent`
* refactor: rename a type
* refactor: use the try-catch model
* refactor: move `normalizeBinObject`
* refactor: split `oidc` into `idToken` and `authToken`
* refactor: run `next` on `stream`'s `'end'`
* fix: use the correct encoding
* feat: guard against weird names
* test: `transform/engines`
Closes https://github.com/pnpm/pnpm/pull/10599
* test: `transformPeerDependenciesMeta`
Closes https://github.com/pnpm/pnpm/pull/10600
* refactor: dependency inject the `Date` too
* refactor: export an interface
* test: oidc
Closes https://github.com/pnpm/pnpm/pull/10598
* refactor: re-arrange imports
* refactor: remove unnecessary type casts
* refactor: improve test
46 lines
1.8 KiB
TypeScript
46 lines
1.8 KiB
TypeScript
import { jest } from '@jest/globals'
|
|
import { executeTokenHelper } from '../src/executeTokenHelper.js'
|
|
|
|
test('executeTokenHelper returns stdout of the tokenHelper command', () => {
|
|
const globalWarn = jest.fn<(message: string) => void>()
|
|
expect(executeTokenHelper([process.execPath, '--print', '"hello world"'], { globalWarn })).toBe('hello world')
|
|
expect(globalWarn).not.toHaveBeenCalled()
|
|
})
|
|
|
|
test('executeTokenHelper trims the output', () => {
|
|
const globalWarn = jest.fn<(message: string) => void>()
|
|
expect(executeTokenHelper([process.execPath, '--print', '" hello world \\n"'], { globalWarn })).toBe('hello world')
|
|
expect(globalWarn).not.toHaveBeenCalled()
|
|
})
|
|
|
|
test('executeTokenHelper logs line of stderr via warnings', () => {
|
|
const globalWarn = jest.fn<(message: string) => void>()
|
|
expect(executeTokenHelper([process.execPath, '--eval', [
|
|
'console.log("foo")',
|
|
'console.error("hello")',
|
|
'console.log("bar")',
|
|
'console.error("world")',
|
|
].join('\n')], { globalWarn })).toBe('foo\nbar')
|
|
expect(globalWarn.mock.calls).toStrictEqual([
|
|
['(tokenHelper stderr) hello'],
|
|
['(tokenHelper stderr) world'],
|
|
])
|
|
})
|
|
|
|
test('executeTokenHelper does not log empty stderr', () => {
|
|
const globalWarn = jest.fn<(message: string) => void>()
|
|
expect(executeTokenHelper([process.execPath, '--eval', [
|
|
'console.log("foo")',
|
|
'console.error(" ")',
|
|
'console.log("bar")',
|
|
'console.error()',
|
|
].join('\n')], { globalWarn })).toBe('foo\nbar')
|
|
expect(globalWarn).not.toHaveBeenCalled()
|
|
})
|
|
|
|
test('executeTokenHelper rejects non-zero exit codes', () => {
|
|
const globalWarn = jest.fn<(message: string) => void>()
|
|
expect(() => executeTokenHelper([process.execPath, '--eval', 'process.exit(12)'], { globalWarn })).toThrow()
|
|
expect(globalWarn).not.toHaveBeenCalled()
|
|
})
|