Commit Graph

67 Commits

Author SHA1 Message Date
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 762ac01133 test(platform): replace file snapshots with explicit assertions (#45684)
* test(manager): replace file snapshots with explicit assertions

* test(manager): replace inline snapshots with explicit assertions

* test(manager): assert on relevant sections instead of full bodies

* test(manager): drop assertions implied by full equality

* test(manager): address review feedback

* test(manager): assert depType and versioning in the regex matcher

* test(bundler): replace file snapshots with explicit assertions

* test(bundler): replace inline snapshots with explicit assertions

* test(bundler): drop assertions implied by full equality

* test(bundler): address review feedback

* test(npm): replace file snapshots with explicit assertions

* test(npm): replace inline snapshots with explicit assertions

* test(platform): replace file snapshots with explicit assertions

* test(platform): replace inline snapshots with explicit assertions

* test(platform): assert on relevant sections instead of full bodies

* test(platform): address review feedback

* test(platform): use resolves instead of awaiting inside expect
2026-09-04 10:28:54 +00:00
Abizer 7a6e7b2880 fix(azure): filter pull request queries by Renovate author (#45359)
* implement plan

* add tests

* fix initialization order

* cast contexts to WebApi for type safety in authHandler checks

* fix(azure): scope PR filtering to effective credentials (#1)

* fix(azure): scope PR filtering to effective credentials

* fix(azure): address authentication review feedback

* fix: reorder import statements

* Address review comments

* fetch renovate user id in initPlatform

---------

Co-authored-by: Sergei Zharinov <zharinov@users.noreply.github.com>
2026-09-03 08:26:18 +00:00
RahulGautamSingh d678372061 fix(platform/azure): skip work item Markdown format on Azure DevOps Server (#45237) 2026-08-12 14:04:20 +00:00
Jamie Tanna 7ac677dc9b fix(platform/azure): evaluate policies before attempting to merge PR (#44631)
When a PR created on Azure is inside a project or repository that has
additional policy evaluations that need to be fulfilled for a given PR,
we should not attempt to perform a manual `mergePr` unless the policies
allow us to.

Previously, we would attempt to `mergePr` and would result in

    DEBUG: Failed to set the PR as completed.

Platform-native auto-merge functionality would still work as expected,
as once the evaluations had succeeded (for instance, a PR is approved by
a human) Azure will auto-merge it.

However, the failure in attempting to merge it is noisy, and should be
avoided by evaluating the policies before attempting to merge.

Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io>
2026-07-20 09:21:55 +00:00
Sebastian Poxhofer 5ad36a2387 test(linters): add linting rule to enforce usage of host rules test util (#44692)
* ci(linter): add renovate/no-host-rules-mock rule

Flags vi.mock()/vi.doMock() calls whose module specifier contains
"host-rules" in spec files. Tests should configure real rules via
hostRules.add() instead of mocking the host-rules module.

Enabled at "warn" severity instead of "error": the repo currently has
35 pre-existing violations across 34 spec files, which exceeds the
agreed fix threshold of 12 files. No violation fixes are included;
migrating each spec to real hostRules.add()/clear() setup is a
semantic test rewrite that should be done incrementally, after which
the rule can be promoted to "error".

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* ci(linter): enforce renovate/no-host-rules-mock at error

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test(datasource): use real host-rules instead of mocking

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test(manager): use real host-rules instead of mocking

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test(platform): use real host-rules instead of mocking

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test(util,workers): use real host-rules instead of mocking

Also narrow renovate/no-host-rules-mock to the host-rules module itself so that mocking e.g. host-rules-from-env is not flagged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* ci(linter): mention '~test/host-rules.ts' util in no-host-rules-mock message

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 10:36:12 +00:00
Sebastian Poxhofer 4add67e86e test: add linter for as any in test files (#44658)
* ci(linter): add prefer-partial-in-specs oxlint rule

Flags object literals cast to `any` (`{...} as any`) in spec/test files and steers toward `partial<T>()` from `test/util`. Enabled at error in the spec-files override so CI blocks new occurrences.

Closes #44646

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* test: drop unnecessary object-literal `as any` casts

The casts masked values already assignable to the expected type (migration configs accepted as Record<string, unknown>, all-optional param types, etc.); removing them restores real type checking.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* test: replace object-literal `as any` casts with partial<T>()

Uses partial<T>() from test/util so incomplete mock/config objects keep proper typing. Azure API mocks switch to mockResolvedValue(partial<T>()) and their inner method mocks to mockResolvedValue(), matching the sibling-file idiom.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* test: suppress prefer-partial-in-specs for intentionally-invalid inputs

Some tests deliberately pass malformed or legacy data to exercise validation/error paths, where no real type fits; keep the cast with a reasoned oxlint-disable-next-line.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-17 10:47:30 +00:00
Emanuel Besliu 2d431ea7a7 fix(platform/azure): don't create Dependency Dashboard for projects without an Issue type (#44592)
* fix(platform/azure): guard against null work item on issue creation

The Azure DevOps REST client resolves createWorkItem to null (instead of
throwing) on a 404 or any 2xx response with an empty/non-JSON body, such
as a 203 sign-in page returned by an expired token or an SSO/proxy in
front of the instance. ensureIssue then dereferenced newWorkItem.id
unconditionally, crashing the dependency dashboard run with
"Cannot read properties of null (reading 'id')".

Guard the result and skip the issue with a warning instead.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(platform/azure): detect missing Issue work item type

Check that the project's process defines the 'Issue' work item type
before attempting to create one. Processes such as Scrum do not define
it, so createWorkItem returned a 404 that the REST client surfaces as
null, producing a cryptic crash. Log an actionable warning instead.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* test(platform/azure): mock getWorkItemTypes in ensureIssue create test

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-07-15 09:57:02 +00:00
Sebastian Poxhofer ad0b59f8b7 refactor(oxlint): enable vitest/require-to-throw-message (#44421) 2026-07-07 17:47:04 +00:00
Sebastian Poxhofer aac8365dd6 refactor(oxlint): enable vitest/prefer-snapshot-hint (#44420)
Add distinct hints to the multi-snapshot tests flagged by the rule
and regenerate the affected snapshot files, then re-enable the rule.

Part of #43845

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 16:35:22 +00:00
Illia Mazuriak fed1eb1066 fix(platform/azure): avoid corrupting HTML entities and URL anchors in massageMarkdown (#44131)
The `#(\d+)` -> `!$1` replacement added in #42758 over-matched any `#`
followed by digits, corrupting HTML entities such as `&#8203;` (becomes
`&!8203;`) and changelog URL anchors such as `CHANGELOG.md#4780` (becomes
`!4780`) in Azure DevOps PR bodies.

Only convert a standalone reference preceded by start-of-string, whitespace
or `(`, matching the boundary already used in util/markdown.ts.
2026-06-23 14:43:59 +00:00
RahulGautamSingh eaa2cea3e1 feat(platform/azure): add dependency dashboard support (#42758)
* Add support for Azure DevOps in dependency dashboards feature

related #9592

* Add missing test for got wrapper

* Apply all current CR suggestions

* fix: resolve eslint and tsx issues in Azure platform code

* test: add coverage for issue.number undefined cases

Add test cases to ensure proper handling when:
- Trying to reopen an issue without a number
- Trying to update an issue without a number

This improves code coverage for the null checks added in previous commit.

* test: fix and add tests of azure/issue.ts to up coverage

there was mismatch in mock resulting in testing of different code branch

* refactor: address review feedback

* fix: type-check

* refactor: address review feedback round 2

* apply suggestions

* Apply suggestions from code review

Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>

* refactor: use partial helper and remove host-rules mock in issue.spec.ts

* more changes from suggestions

* Update lib/modules/platform/azure/issue.spec.ts

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>

---------

Co-authored-by: Viktorie Novotná <viktorie.novotna@drmax.eu>
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2026-06-03 15:56:14 +00:00
Michael Kriese 440e353145 chore: use ts extension (#42300) 2026-04-01 07:46:34 +00:00
Sergei Zharinov 9d857c1f68 refactor(lint): Organize imports with biome (#40966) 2026-02-06 13:40:01 +00:00
Michael Kriese e36d080d22 chore: add proper imports from azure-devops-node-api (#40762) 2026-01-28 17:01:15 +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
renovate[bot] acacad57c6 chore(deps): update linters (main) (#40277)
* chore(deps): update linters

| datasource | package              | from   | to     |
| ---------- | -------------------- | ------ | ------ |
| npm        | eslint-plugin-oxlint | 1.36.0 | 1.38.0 |
| npm        | typescript-eslint    | 8.50.1 | 8.52.0 |

* chore: enable oxlint gha format

* chore: fix lint

* chore: fix lint

* chore: fix lint

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2026-01-14 15:32:48 +00:00
RahulGautamSingh 76f911041a refactor: use named exports (#39196)
* use named exports

* fix test

* add missing imnport

* fix prettier
2025-11-10 12:00:35 +00:00
renovate[bot] 1280fe4dc7 chore(deps): update dependency @vitest/eslint-plugin to v1.3.16 (main) (#38502)
* chore(deps): update dependency @vitest/eslint-plugin to v1.3.16

| datasource | package               | from   | to     |
| ---------- | --------------------- | ------ | ------ |
| npm        | @vitest/eslint-plugin | 1.3.13 | 1.3.16 |

* fix linting errors

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: secustor <sebastian@poxhofer.at>
2025-10-13 09:24:15 +00:00
Bas Stottelaar 6c40f185e4 feat(azure): add support for rebase-merge (#33732)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2025-07-29 08:14:27 +00:00
Christoffer 02e3f3c613 fix(platform/azure): support getRawFile from tags if branch lookup fails (#36874)
Co-authored-by: RahulGautamSingh <rahultesnik@gmail.com>
2025-07-09 08:20:54 +00:00
Michael Kriese 19c115c813 test: cleanup (#34785) 2025-03-13 17:52:09 +00:00
Michael Kriese 4f60a8b7fe test: mock git globally (#34783) 2025-03-13 15:48:02 +00:00
Michael Kriese 3f0f6a04b6 build: compile with nodenext target (still cjs) (#34584) 2025-03-04 07:37:06 +00:00
Michael Kriese 1644d9cb18 test: migrate more to vitest (#34500) 2025-02-26 15:45:17 +00:00
Trim21 6e5731b554 test: migrate from jest to vitest (#34499) 2025-02-26 14:18:38 +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
Rhys Arkins 6cfa52e885 fix(azure): update cache after PR create or update (#31766) 2024-10-03 07:39:42 +00:00
Sebastian Poxhofer 3681b2a945 chore: eslint to enforce for typed imports (#30844) 2024-08-19 13:15:27 +00:00
RahulGautamSingh 4b502025fe refactor: rename platformOptions -> platformPrOptions (#30173) 2024-07-16 07:33:55 +00:00
sindrekroknes f4440364e8 fix(azure): getRawFile not handling 404 for Azure DevOps (#30066) 2024-07-09 09:43:29 +00:00
ddovile 8d78ca2ec8 fix(azure): paginate getTeams() (#29060)
Co-authored-by: Dovile Dikoviciute <Dovile.Dikoviciute@bentley.com>
2024-05-14 10:18:02 +00:00
jeley1000 5a1eef985c feat(azure): Log if we cannot find a reviewer (#26826) 2024-02-22 14:21:52 +00:00
Rhys Arkins 59df10183a feat(platform): getRepoForceRebase -> getBranchForceRebase (#27052)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-02-06 09:14:11 +00:00
joegoldman2 4345212cff test(platform/azure): replace squashMerge by mergeStrategy (#26436) 2023-12-27 12:52:08 +00:00
joegoldman2 1786438d33 feat(platform/azure): implement automergeStrategy for Azure DevOps platform (#26429) 2023-12-27 09:17:03 +00:00
Wessel Terpstra 552dba5cff fix(azure): exclude disabled repositories when discovering (#25104)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2023-11-11 08:33:35 +00:00
renovate[bot] e5cbbaaf09 build(deps): update dependency prettier to v3 (#23627)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Sergei Zharinov <zharinov@users.noreply.github.com>
2023-11-07 17:12:01 +00:00
Sergei Zharinov b69416ce17 refactor(prettier): Force trailing commas (#25631) 2023-11-07 15:50:29 +00:00
ikarami 66a48b943e fix(branch/handle-existing): improve prEditedNotification message (#24200)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2023-09-16 07:49:58 +00:00
Michael Kriese 84a97a62fa test(perf): improve test speed (#24323) 2023-09-08 11:40:04 +00:00
Sergei Zharinov 6f7ac34a2f fix: Type errors (#24108) 2023-08-27 08:13:10 +00:00
kroonprins 03636915e4 feat(platform/azure): check targetBranch when finding PRs (#23941)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2023-08-25 08:26:14 +00:00
Rhys Arkins 36e2b328bb chore: update types reference 2023-08-15 11:31:15 +02:00
RahulGautamSingh 8432e76e8e fix: replace delay with setTimeout (#23123) 2023-07-06 10:20:55 +00:00
RahulGautamSingh 4180370e01 feat(platform): update PR target branch if baseBranch changed (#23010) 2023-07-01 14:58:34 +00:00
Chris van der Pennen a67d251401 fix(azure): use target branch to select platform automerge strategy (#22439)
Co-authored-by: Jamie Magee <jamie.magee@gmail.com>
2023-06-26 05:48:57 +00:00
horihel 08233ff705 feat(platform/azure): Recreate Auto-Approve on PR-Update (#22028)
Signed-off-by: Heiko Helmle <heiko.helmle@horiba.com>
Co-authored-by: Jamie Magee <jamie.magee@gmail.com>
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2023-05-11 05:15:33 +00:00
Michael Kriese bce88c862e feat(config): rename azureAutoApprove to autoApprove (#21576) 2023-04-18 09:09:46 +00:00
Michael Kriese c79b209032 refactor(platform): optional getVulnerabilityAlerts (#21449) 2023-04-12 15:12:15 +00:00