Commit Graph

34 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 fbedd41e82 test: replace env operation with vi.stubEnv() (#45490)
* test: replace manual process.env mutation with vi.stubEnv

Enable Vitest's `unstubEnvs` so env stubs are reverted automatically
before every test, and convert the manual `process.env.X = ...` /
`delete process.env.X` pairs in specs to `vi.stubEnv()`.

This removes the hand-written `afterEach` cleanup blocks and the
`const OLD_ENV = process.env` / `process.env = { ...OLD_ENV }`
save-restore dance, which silently leaked state between tests when a
test set a variable without a matching delete.

Left as-is (incompatible with `unstubEnvs`, which unstubs before each
test, not after):
- module top-level env writes (cocoapods, gomod, post-update, pip-compile
  and bundler artifacts specs)
- `beforeAll` env writes -- the two in `util/http` moved to `beforeEach`

* test: stop asserting on ambient environment variables

Three specs asserted on values that the surrounding environment can
override, so they only passed on a machine that happened not to set them:

- `util/exec/env`: `getChildProcessEnv()` forwards every entry of
  `basicEnvVars`, but the spec only seeded a subset. Any other forwarded
  variable that was set ambiently (e.g. a lowercase `http_proxy`) leaked
  into the `toEqual` assertion. Clear all of them first.
- `util/git/index`: `process.env.GIT_SSH_COMMAND` deliberately overrides
  the default that the two env-inheritance tests assert on. Clear it.
- `logger/pretty-stdout`: the colorized level strings are built at import
  time, so the `beforeEach` setting `FORCE_COLOR` could never affect them
  -- it was dead code, and the test silently assumed a terminal without
  colour support. Derive the expectation the same way the module does.

* test(datasource/nuget): use a throwaway cache dir for nupkg downloads

The `determine source URL from nupkg` tests do not mock the filesystem,
so they really wrote downloaded packages into a fixed `/tmp/cache` path.
That fails wherever the system tmpdir is not writable, and two checkouts
running the suite at once would share the same directory.

Use `tmp.dir({ unsafeCleanup: true })` and clean it up afterwards, which
is the pattern the other specs that touch disk already use.

* feat(lint): add renovate/prefer-stub-env rule

Enforces in specs what the migration to `vi.stubEnv` established:

- assigning to or deleting `process.env.X` inside `beforeEach`, `afterEach`,
  `it` or `test` is reported, with a fixer that rewrites it to `vi.stubEnv()`
- module scope, `describe` bodies and `beforeAll` / `afterAll` are left alone:
  `unstubEnvs` reverts stubs *before* each test, so a stub created there is
  gone by the time the first test runs, and those must keep assigning directly
- replacing the `process.env` object is reported everywhere and never fixed.
  `vi.stubEnv()` captures the original object when the worker starts, so after
  a reassignment its deletes silently target the old object

The rule found 28 further violations in specs the earlier sweep missed, since
that one was anchored on `delete process.env`. Twelve were auto-fixed; the
rest replaced `process.env` wholesale and are now `clearEnv()` from test/util.

`util/exec/index.spec.ts` opts out with a comment: it asserts on the whole
child env, and `vi.stubEnv()` cannot express that because it maps `PROD`,
`DEV` and `SSR` onto '' instead of deleting them.
2026-08-28 09:26:20 +00:00
Dharma Teja Thoutam bad5e2284e fix(git-submodule): handle ./ relative paths in URL resolution (#44742)
* fix(git-submodule): handle ./ relative paths in URL resolution

* Fix indentation

---------

Co-authored-by: Felipe Santos <felipe.santos@ericsson.com>
2026-07-21 08:17:08 +00:00
XLion a22c881fb2 fix(manager/git-submodules): strip .git suffix from sourceUrl (#43400)
The git-submodules extractor was setting sourceUrl to the raw git HTTP URL,
including the .git suffix (e.g. https://github.com/owner/repo.git).

This caused the 'githubDigestChangelogs' preset's changelogUrl template
'{{sourceUrl}}/compare/{{currentDigest}}..{{newDigest}}' to produce
invalid URLs like:
  https://github.com/owner/repo.git/compare/abc123..def456
which 404s because GitHub compare URLs don't support the .git suffix.

Other managers (bundler, deps-edn, flux) already strip .git from sourceUrl.
This fix follows the same pattern.
2026-05-18 09:09:21 +00:00
Dave e10a96bfd0 refactor: centralize SimpleGit creation (#43035)
* central function for creating SimpleGit instance

* Updated tests.

* Set the LANG and LC_ALL environment variables for all Git operations instead of just initRepo.

* Moved GIT_SSH_COMMAND to `createSimpleGit` function.

* Removed unnecessary custom env vars.
2026-05-11 15:05:08 +00:00
Sergei Zharinov 2b0e80b884 feat!: Switch to ESM modules (#40756) 2026-01-29 14:21:41 +00:00
Michael Kriese 17a1bbad96 refactor: use named simpleGit imports (#40759) 2026-01-28 16:55:14 +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
Jamie Tanna 8a6cb4742c fix(git-submodules): infer the sourceUrl from the packageName (#40472)
As noted in #30231, it would be useful to present a changelog URL for
Git submodule PRs, which is possible with
`helpers:githubDigestChangelogs`.

However, because the `sourceUrl` is not set, this doesn't get applied.

Given the `packageName` is the HTTP URL for the Git submodule, we can
use this for our `sourceUrl`.
2026-01-20 14:28:43 +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
Felipe Santos 7688550150 fix(git-submodules): avoid network call during extract (#39147) 2025-11-07 10:05:49 +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
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
Sebastian Poxhofer 3681b2a945 chore: eslint to enforce for typed imports (#30844) 2024-08-19 13:15:27 +00:00
Tobias ba7a39dec0 feat(managers/git-submodules): support updating git-tag versions (#30104)
Co-authored-by: Tom Plant <tom@tplant.com.au>
2024-07-26 07:03:59 +00:00
Sergei Zharinov b69416ce17 refactor(prettier): Force trailing commas (#25631) 2023-11-07 15:50:29 +00:00
Erwan Finot b89c37033b feat(manager/git-submodules): Support for special branch value . (#25507)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2023-11-04 13:28:33 +00:00
Tobias 5f82d9d2ce fix(git-submodules): take git-tags and git-refs hostRules into account (#24250) 2023-09-28 12:13:56 +00:00
Luís Cobucci 0b50feb90c fix(git-url): clean up state of parsed URL (#24306)
Signed-off-by: Luís Cobucci <lcobucci@gmail.com>
Co-authored-by: Tobias <github@tobiasgabriel.de>
2023-09-14 05:59:23 +00:00
Michael Kriese 84a97a62fa test(perf): improve test speed (#24323) 2023-09-08 11:40:04 +00:00
Tobias 095afcd0ba feat(git/auth): Support hostrules with username and password when authenticating git commands (#24081) 2023-09-04 09:48:17 +00:00
Tobias 807b79620b fix(git-submodule): remove token injection from submodule URL (#23458) 2023-07-21 17:29:25 +00:00
lfcyja ec44118056 fix(datasource): re-encode URL to support white spaces in Azure projects (#23354) 2023-07-19 15:05:25 +00:00
Tobias 01ee73c28a feat(manager/git-submodule): add authentication support (#22061)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2023-07-18 16:17:04 +00:00
Tobias 714bb276e9 test(git-submodules): separate and make tests easier mockable (#23065) 2023-07-13 12:59:11 +00:00
RahulGautamSingh 8432e76e8e fix: replace delay with setTimeout (#23123) 2023-07-06 10:20:55 +00:00
Michael Kriese 455de72ee7 fix(manager/git-submodule): use appropriate hostType for auth (#17400)
Co-authored-by: Jamie Magee <jamie.magee@gmail.com>
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2023-04-21 04:13:32 +00:00
Rhys Arkins 3cef2f2e4f refactor: PackageFile -> PackageFileContent (#20502) 2023-02-19 12:43:48 +00:00
renovate[bot] 7935a7b8ed chore(deps): lock file maintenance (#18082)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2022-10-10 21:47:23 -07:00
renovate[bot] 582f77371c chore(deps): update jest monorepo (#17737)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2022-09-12 16:58:52 +02:00
Michael Kriese b4319928f1 refactor: strict manager tests (#16155)
* refactor: strict manager tests

* chore: revert changes

* Update lib/modules/manager/gradle/extract.spec.ts
2022-06-20 17:05:39 +02:00
Michael Kriese 64f5bd5f03 test: enforce lint style rules (#15085) 2022-04-12 14:49:49 +00:00
Rhys Arkins 143c9a6751 refactor: rename lookupName -> packageName (#14494)
Renames `lookupName` to be `packageName`.

BREAKING CHANGE: Use `packageName` instead of `lookupName` if interacting with Renovate datasources directly.
2022-03-04 09:04:02 +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