diff --git a/lib/modules/manager/bundler/artifacts.spec.ts b/lib/modules/manager/bundler/artifacts.spec.ts index df9b06bdad2c77..a9997153188c79 100644 --- a/lib/modules/manager/bundler/artifacts.spec.ts +++ b/lib/modules/manager/bundler/artifacts.spec.ts @@ -53,8 +53,6 @@ const updatedGemfileLock = { describe('modules/manager/bundler/artifacts', () => { describe('updateArtifacts', () => { beforeEach(() => { - jest.resetModules(); - delete process.env.GEM_HOME; env.getChildProcessEnv.mockReturnValue(envMock.basic); diff --git a/lib/util/exec/containerbase.ts b/lib/util/exec/containerbase.ts index 5a27d1dd0d2082..3df791e8dfe3a8 100644 --- a/lib/util/exec/containerbase.ts +++ b/lib/util/exec/containerbase.ts @@ -2,7 +2,7 @@ import is from '@sindresorhus/is'; import { quote } from 'shlex'; import { GlobalConfig } from '../../config/global'; import { logger } from '../../logger'; -import { getPkgReleases } from '../../modules/datasource'; +import type { ReleaseResult } from '../../modules/datasource'; import * as allVersioning from '../../modules/versioning'; import { id as composerVersioningId } from '../../modules/versioning/composer'; import { id as gradleVersioningId } from '../../modules/versioning/gradle'; @@ -198,6 +198,19 @@ const allToolConfig: Record = { }, }; +let _getPkgReleases: Promise | null = + null; + +async function getPkgReleases( + toolConfig: ToolConfig, +): Promise { + if (_getPkgReleases === null) { + _getPkgReleases = import('../../modules/datasource'); + } + const { getPkgReleases } = await _getPkgReleases; + return getPkgReleases(toolConfig); +} + export function supportsDynamicInstall(toolName: string): boolean { return !!allToolConfig[toolName]; } diff --git a/lib/util/exec/index.spec.ts b/lib/util/exec/index.spec.ts index 68616cbf372216..3e3385b44204de 100644 --- a/lib/util/exec/index.spec.ts +++ b/lib/util/exec/index.spec.ts @@ -47,7 +47,6 @@ describe('util/exec/index', () => { beforeEach(() => { dockerModule.resetPrefetchedImages(); jest.restoreAllMocks(); - jest.resetModules(); processEnvOrig = process.env; GlobalConfig.reset(); }); diff --git a/lib/util/git/index.spec.ts b/lib/util/git/index.spec.ts index 3e36ab49fff75f..c2be59f4a42910 100644 --- a/lib/util/git/index.spec.ts +++ b/lib/util/git/index.spec.ts @@ -95,7 +95,6 @@ describe('util/git/index', () => { const OLD_ENV = process.env; beforeEach(async () => { - jest.resetModules(); process.env = { ...OLD_ENV }; origin = await tmp.dir({ unsafeCleanup: true }); const repo = Git(origin.path); diff --git a/lib/util/object.spec.ts b/lib/util/object.spec.ts index 046c7c0f472924..ab2f62d0df222d 100644 --- a/lib/util/object.spec.ts +++ b/lib/util/object.spec.ts @@ -1,10 +1,6 @@ import { coerceObject, hasKey } from './object'; describe('util/object', () => { - beforeEach(() => { - jest.resetModules(); - }); - it('finds key in regular object', () => { expect(hasKey('foo', { foo: true })).toBeTrue(); });