Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(containerbase): remove circular datasource import #25685

Merged
merged 2 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 0 additions & 2 deletions lib/modules/manager/bundler/artifacts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
15 changes: 14 additions & 1 deletion lib/util/exec/containerbase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -198,6 +198,19 @@ const allToolConfig: Record<string, ToolConfig> = {
},
};

let _getPkgReleases: Promise<typeof import('../../modules/datasource')> | null =
null;

async function getPkgReleases(
toolConfig: ToolConfig,
): Promise<ReleaseResult | null> {
if (_getPkgReleases === null) {
_getPkgReleases = import('../../modules/datasource');
}
const { getPkgReleases } = await _getPkgReleases;
return getPkgReleases(toolConfig);
}

export function supportsDynamicInstall(toolName: string): boolean {
return !!allToolConfig[toolName];
}
Expand Down
1 change: 0 additions & 1 deletion lib/util/exec/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ describe('util/exec/index', () => {
beforeEach(() => {
dockerModule.resetPrefetchedImages();
jest.restoreAllMocks();
jest.resetModules();
processEnvOrig = process.env;
GlobalConfig.reset();
});
Expand Down
1 change: 0 additions & 1 deletion lib/util/git/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions lib/util/object.spec.ts
Original file line number Diff line number Diff line change
@@ -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();
});
Expand Down
Loading