mirror of
https://github.com/renovatebot/renovate.git
synced 2026-11-01 18:19:51 +00:00
0e6429b13e
* refactor(types): document `localDir` isn't a `globalOnly` option To make sure that it's clear when reviewing `GlobalConfig`, as well as working with our types, we can move the `localDir` definition into a separate type. * fixup! refactor(types): document `localDir` isn't a `globalOnly` option * fixup! refactor(types): document `localDir` isn't a `globalOnly` option Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io> * fixup! refactor(types): document `localDir` isn't a `globalOnly` option Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io> * fixup! refactor(types): document `localDir` isn't a `globalOnly` option Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io> --------- Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io>
80 lines
2.0 KiB
TypeScript
80 lines
2.0 KiB
TypeScript
import upath from 'upath';
|
|
import { GlobalConfig } from '../../../config/global.ts';
|
|
import type {
|
|
InternalGlobalConfigOptions,
|
|
RepoGlobalConfig,
|
|
UpdateType,
|
|
} from '../../../config/types.ts';
|
|
import * as terraformLockfile from '../terraform/lockfile/index.ts';
|
|
import type { UpdateArtifactsConfig } from '../types.ts';
|
|
import { updateArtifacts } from './artifacts.ts';
|
|
|
|
vi.mock('../terraform/lockfile/index.ts');
|
|
|
|
const config = {
|
|
constraints: {},
|
|
};
|
|
|
|
const adminConfig: RepoGlobalConfig & InternalGlobalConfigOptions = {
|
|
// `join` fixes Windows CI
|
|
localDir: upath.join('/tmp/github/some/repo'),
|
|
cacheDir: upath.join('/tmp/renovate/cache'),
|
|
containerbaseDir: upath.join('/tmp/renovate/cache/containerbase'),
|
|
binarySource: 'global',
|
|
};
|
|
|
|
describe('modules/manager/terragrunt/artifacts', () => {
|
|
const updateTypes: UpdateType[] = [
|
|
'digest',
|
|
'pin',
|
|
'rollback',
|
|
'patch',
|
|
'minor',
|
|
'major',
|
|
'replacement',
|
|
'pinDigest',
|
|
'lockfileUpdate',
|
|
'bump',
|
|
];
|
|
|
|
beforeEach(() => {
|
|
GlobalConfig.set(adminConfig);
|
|
});
|
|
|
|
it('calls terraform updateArtifacts if the update type is lockfileMaintenance', async () => {
|
|
const localConfig: UpdateArtifactsConfig = {
|
|
isLockFileMaintenance: true,
|
|
...config,
|
|
};
|
|
|
|
const param = {
|
|
packageFileName: '',
|
|
updatedDeps: [],
|
|
newPackageFileContent: '',
|
|
config: localConfig,
|
|
};
|
|
await updateArtifacts(param);
|
|
expect(terraformLockfile.updateArtifacts).toHaveBeenCalledExactlyOnceWith(
|
|
param,
|
|
);
|
|
});
|
|
|
|
it.each(updateTypes)(
|
|
'does not call terraform updateArtifacts if the update type is %s',
|
|
async (updateType) => {
|
|
const localConfig: UpdateArtifactsConfig = {
|
|
updateType,
|
|
...config,
|
|
};
|
|
|
|
await updateArtifacts({
|
|
packageFileName: '',
|
|
updatedDeps: [],
|
|
newPackageFileContent: '',
|
|
config: localConfig,
|
|
});
|
|
expect(terraformLockfile.updateArtifacts).not.toHaveBeenCalled();
|
|
},
|
|
);
|
|
});
|