Commit Graph

33 Commits

Author SHA1 Message Date
Matthew Nitschke ac22678812 feat(datasource/npm): integrity and tarball extraction (#44315)
* added support for extracting integrity and tarball from npm datasource

* test(datasource/npm): keep integrity and tarball in packument shape assertions

The packument-trimming tests on main pinned a cached shape that dropped
`dist.tarball`, so they broke once the schema started retaining
`integrity` and `tarball`. Update both expectations to the new shape and
cover `integrity` alongside `tarball`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* test(workers/lookup): expect integrity and tarball on npm updates

`generateUpdate` copies `downloadUrl` and `newDigest` from the release
onto the update, so every npm lookup in these tests now carries the
tarball URL and, where the packument fixture has one, the integrity
hash. Pin and rollback updates are built without those release fields,
so their expectations are unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Michael Kriese <michael.kriese@mend.io>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-11 10:09:59 +00:00
Sebastian Poxhofer 05e1271376 test: use expect().resolves instead of awaiting inside expect (#45672)
Enables the vitest/prefer-expect-resolves oxlint rule and applies its
autofix across the spec suite.
2026-09-04 10:40:46 +00:00
Sebastian Poxhofer 7436b80cda test(linter): add renovate/no-redundant-mock-reset rule (#44557)
ci(linter): add renovate/no-redundant-mock-reset rule

Vitest sets mockReset: true globally in vitest.config.mts, which resets
all mocks before each test. This makes vi.resetAllMocks() /
vi.clearAllMocks() and per-mock .mockReset() / .mockClear() calls inside
beforeEach/afterEach hooks redundant. Add a custom oxlint rule (enabled
for **/*.spec.ts and test/**) flagging such calls, and remove the 40
redundant calls it found. restoreAllMocks/mockRestore are not flagged
because restoreMocks is not enabled globally.

Two sites keep an inline disable with a reason: nested beforeEach hooks
in filter-checks.spec.ts and onboarding/pr/index.spec.ts intentionally
call mockReset() to discard once-values queued by an outer beforeEach.

Requested by maintainer review feedback (review comment 3052324877).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 11:26:20 +00:00
Zack Kanter 371412d4c1 fix(datasource/npm): require public Cache-Control to cache responses (#42822)
* fix(datasource/npm): require public Cache-Control to cache responses

The npm datasource opts out of the authorization-header privacy check
(checkAuthorizationHeader: false) and relies on Cache-Control alone to
classify responses. Previously, when a registry omitted Cache-Control
entirely, cacheAllowed fell through to "cache it" — so private packages
served by GitHub Packages (which sends no Cache-Control header) were
cached in the shared package cache.

Flip the semantic of checkCacheControlHeader: true to require an
affirmative Cache-Control: public signal. Missing or non-public headers
now disallow caching. registry.npmjs.org is unaffected because it
already sends Cache-Control: public, max-age=...

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(cache): avoid renewing disallowed package cache on 304

* Revert "fix(cache): avoid renewing disallowed package cache on 304"

This reverts commit 64801bb036269352465aac580b9861c5b7716cc1.
2026-07-07 19:27:47 +00:00
Mike Ryan 8bbce59ece fix(datasource/npm): tolerate non-string time entries in packument (#43779)
* fix(datasource/npm): tolerate non-string `time` entries in packument

JFrog Artifactory npm registries emit `"unpublished": null` under the
packument `time` field. Since the schema declared `time` values as
`z.string()`, the `null` failed validation and Zod rejected the entire
packument, so every package lookup returned no-result.

Strip non-string `time` entries via a shared `PackumentTime` transform so
a stray metadata key cannot invalidate the whole packument, while keeping
the real version->timestamp entries the datasource relies on.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor(datasource/npm): use LooseRecord for packument time

Per PR review.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-04 14:04:51 +00:00
Sebastian Poxhofer 03baf6ee4a test(noNewURL): add new rule enforcing parseUrl() from 'lib/util/url.ts' (#43247)
* test(noNewURL): add new rule enforcing parseUrl() from 'lib/util/url.ts'

* replace newURL with parseUrl

* remove non-null assertions marks if appropiate

* test: add additional tests

* test: add additional tests and ignore where it makes sense

* implement suggestions

* test: further improve coverage

* apply suggestion
2026-05-13 16:23:10 +00:00
Felipe Santos 3afa38511b refactor(datasource/npm): extract defaultRegistryUrl constant (#42794)
* feat(datasource/npm): extract defaultRegistryUrl constant

* Fix some other places

* Remove useless defaultRegistryUrls export

* Fix another place

* Undo rules.spec.ts changes, which are not related

* Fix npm presets

* Restore line removed by mistake

* Fix another test file

* Restore changes to a file which is not relevant

* Fix another small place
2026-04-27 15:24:01 +00:00
Sergei Zharinov b359a1de4d feat(npm): Trim response data before caching (#42559)
* feat(cache): Add `writeSchema` transform to package cache

* feat(npm): Trim response data before caching
2026-04-12 17:22:32 +00:00
renovate[bot] e752a3db29 build(deps): update dependency got to v14 (main) (#41302)
* build(deps): update dependency got to v14

| datasource | package | from   | to     |
| ---------- | ------- | ------ | ------ |
| npm        | got     | 12.6.1 | 14.6.6 |

* test: fix tests

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2026-02-19 17:50:48 +00:00
Sergei Zharinov 9d857c1f68 refactor(lint): Organize imports with biome (#40966) 2026-02-06 13:40:01 +00:00
Sergei Zharinov 930cf6633c refactor: Rewrite imports with .ts extensions (#40700)
fix: Additional vi.mock path corrections and prettier formatting
2026-01-26 22:48:17 +00:00
Rhys Arkins 4e4a0f99b0 fix!: remove the "Bot" from user-agent header (#37535) 2025-11-06 08:07:40 +00:00
Martin Costello 6b1d198690 feat: Warn when an updated dependency loses an attestation (#37268) 2025-08-27 08:08:05 +00:00
Sergei Zharinov 87be63ce99 refactor(npm): Switch to package http cache provider (#33853) 2025-04-23 06:44:43 +00:00
Michael Kriese 19c115c813 test: cleanup (#34785) 2025-03-13 17:52:09 +00:00
renovate[bot] 0299455412 chore(deps): update dependency nock to v14 (main) (#34557)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-02-28 14:20:08 +00:00
Michael Kriese 997c23502e test: migrate to vitest (#34475)
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
2025-02-26 09:35:54 +00:00
Sergei Zharinov 4b97cefb7e test: Improve errors for missing/unused HTTP mocks (#31678) 2024-09-30 05:26:53 +00:00
Tobias 0445d3f4e0 fix(datasource/npm): respect abortOnError hostRule for registries (#26196) 2024-03-23 12:47:04 +00:00
Rhys Arkins c1517aa252 fix(datasource/npm): mark all releases deprecated if latest deprecated (#27875)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-03-15 07:46:17 +00:00
Sergei Zharinov b69416ce17 refactor(prettier): Force trailing commas (#25631) 2023-11-07 15:50:29 +00:00
Rhys Arkins ad0479a11b feat(npm): support constraintsFiltering=strict (#22447)
Closes #4826

Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
2023-07-04 19:21:52 +02:00
Rhys Arkins 78b8483953 feat(datasource/npm): cache etag for reuse (#19823) 2023-01-13 21:20:32 +00:00
Colin O'Dell 676768129d feat(helm): improve subdirectory support (#19181) 2022-12-09 12:48:20 +01:00
Jamie Magee 92eb2200fd refactor(jest): enable clearMocks (#18779) 2022-11-14 22:46:37 -08:00
Rhys Arkins e7e1322e24 fix(npm): support short sourceUrl format (#18073) 2022-10-04 07:55:59 +03:00
Rhys Arkins 55d234ec07 fix(npm): remove memcache (#17714) 2022-09-09 09:16:40 +02:00
Michael Kriese 0316a5e62d test: use jest v29 (#17151) 2022-08-16 14:22:29 +02:00
Michael Kriese 0838ca209c refactor: strict datasource tests (#16150) 2022-06-20 13:15:02 +02:00
Michael Kriese 443bef5c52 test: cleanup snapshot tests (#15082) 2022-04-12 15:09:19 +01:00
Rhys Arkins c56f5b9e72 fix(npm): allow for missing dist-tags/latest (#14821)
Closes #14814
2022-03-28 10:55:14 +02:00
Rhys Arkins a2b47c822f feat(npm): support custom registryUrls (#14622)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2022-03-14 09:13:21 +01:00
Rhys Arkins dca3418bbd refactor: lib/modules (#14488)
Moves datasource, manager, platform and versioning code from lib/ into new lib/modules/

BREAKING CHANGE: External tools must update paths to datasource, manager, platform and versioning
2022-03-04 09:04:02 +01:00