Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove ignore line
  • Loading branch information
reggi committed Jul 22, 2025
commit 90acf90a201d6be49a21b85827394a096def06fc
1 change: 0 additions & 1 deletion lib/utils/oidc.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ async function oidc ({ packageName, registry, opts, config }) {
config.set(authTokenKey, response.token, 'user')
log.verbose('oidc', `Successfully retrieved and set token`)
} catch (error) {
/* istanbul ignore next */
log.verbose('oidc', `Failure with message "${error?.message || 'Unknown error'}"`)
}
return undefined
Expand Down
18 changes: 17 additions & 1 deletion test/lib/commands/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
const Arborist = require('@npmcli/arborist')
const path = require('node:path')
const fs = require('node:fs')
const { githubIdToken, gitlabIdToken, oidcPublishTest } = require('../../fixtures/mock-oidc')
const { githubIdToken, gitlabIdToken, oidcPublishTest, mockOidc } = require('../../fixtures/mock-oidc')
const { sigstoreIdToken } = require('@npmcli/mock-registry/lib/provenance')

const pkg = '@npmcli/test-package'
Expand Down Expand Up @@ -991,7 +991,7 @@
})
})

t.test('oidc token exchange - no provenance', t => {

Check failure on line 994 in test/lib/commands/publish.js

View workflow job for this annotation

GitHub Actions / Test - macOS - 22.9.0

test unfinished

Check failure on line 994 in test/lib/commands/publish.js

View workflow job for this annotation

GitHub Actions / Test - macOS - 20.x

test unfinished

Check failure on line 994 in test/lib/commands/publish.js

View workflow job for this annotation

GitHub Actions / Test - macOS - 20.17.0

test unfinished

Check failure on line 994 in test/lib/commands/publish.js

View workflow job for this annotation

GitHub Actions / Test - Linux - 22.9.0

test unfinished

Check failure on line 994 in test/lib/commands/publish.js

View workflow job for this annotation

GitHub Actions / Test - Linux - 22.x

test unfinished

Check failure on line 994 in test/lib/commands/publish.js

View workflow job for this annotation

GitHub Actions / Test - macOS - 22.x

test unfinished

Check failure on line 994 in test/lib/commands/publish.js

View workflow job for this annotation

GitHub Actions / Test - Linux - 20.x

test unfinished

Check failure on line 994 in test/lib/commands/publish.js

View workflow job for this annotation

GitHub Actions / Test - Linux - 20.17.0

test unfinished
const githubPrivateIdToken = githubIdToken({ visibility: 'private' })
const gitlabPrivateIdToken = gitlabIdToken({ visibility: 'private' })

Expand Down Expand Up @@ -1135,6 +1135,22 @@
},
}))

t.test('global try / catch failure via malformed url', async (t) => {
mockOidc(t, {
config: {
'//registry.npmjs.org/:_authToken': 'existing-fallback-token',
},
oidcOptions: {
github: true,
// malformed url should trigger a global try / catch
ACTIONS_ID_TOKEN_REQUEST_URL: '//github.com',
},
publishOptions: {
token: 'existing-fallback-token',
},
})
})

t.test('default registry success gitlab', oidcPublishTest({
oidcOptions: { gitlab: true, NPM_ID_TOKEN: gitlabPrivateIdToken },
config: {
Expand Down
Loading