mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 22:46:27 +00:00
feat(constants): Manager Constants (#5168)
This commit is contained in:
parent
36a37dada8
commit
4e7c938ec7
12 changed files with 179 additions and 68 deletions
38
lib/constants/managers.ts
Normal file
38
lib/constants/managers.ts
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
export const MANAGER_ANSIBLE = 'ansible';
|
||||||
|
export const MANAGER_BAZEL = 'bazel';
|
||||||
|
export const MANAGER_BUILDKITE = 'buildkite';
|
||||||
|
export const MANAGER_BUNDLER = 'bundler';
|
||||||
|
export const MANAGER_CARGO = 'cargo';
|
||||||
|
export const MANAGER_CIRCLE_CI = 'circleci';
|
||||||
|
export const MANAGER_COMPOSER = 'composer';
|
||||||
|
export const MANAGER_DEPS_EDN = 'deps-edn';
|
||||||
|
export const MANAGER_DOCKERFILE = 'dockerfile';
|
||||||
|
export const MANAGER_DOCKER_COMPOSE = 'docker-compose';
|
||||||
|
export const MANAGER_DRONE_CI = 'droneci';
|
||||||
|
export const MANAGER_GITHUB_ACTIONS = 'github-actions';
|
||||||
|
export const MANAGER_GITLAB_CI = 'gitlabci';
|
||||||
|
export const MANAGER_GITLAB_CI_INCLUDE = 'gitlabci-include';
|
||||||
|
export const MANAGER_GIT_SUBMODULES = 'git-submodules';
|
||||||
|
export const MANAGER_GO_MOD = 'gomod';
|
||||||
|
export const MANAGER_GRADLE = 'gradle';
|
||||||
|
export const MANAGER_GRADLE_WRAPPER = 'gradle-wrapper';
|
||||||
|
export const MANAGER_HELM_REQUIREMENTS = 'helm-requirements';
|
||||||
|
export const MANAGER_HOMEBREW = 'homebrew';
|
||||||
|
export const MANAGER_KUBERNETES = 'kubernetes';
|
||||||
|
export const MANAGER_LEININGEN = 'leiningen';
|
||||||
|
export const MANAGER_MAVEN = 'maven';
|
||||||
|
export const MANAGER_METEOR = 'meteor';
|
||||||
|
export const MANAGER_MIX = 'mix';
|
||||||
|
export const MANAGER_NPM = 'npm';
|
||||||
|
export const MANAGER_NUGET = 'nuget';
|
||||||
|
export const MANAGER_NVM = 'nvm';
|
||||||
|
export const MANAGER_PIPENV = 'pipenv';
|
||||||
|
export const MANAGER_PIP_REQUIREMENTS = 'pip_requirements';
|
||||||
|
export const MANAGER_PIP_SETUP = 'pip_setup';
|
||||||
|
export const MANAGER_POETRY = 'poetry';
|
||||||
|
export const MANAGER_PUB = 'pub';
|
||||||
|
export const MANAGER_RUBY_VERSION = 'ruby-version';
|
||||||
|
export const MANAGER_SBT = 'sbt';
|
||||||
|
export const MANAGER_SWIFT = 'swift';
|
||||||
|
export const MANAGER_TERRAFORM = 'terraform';
|
||||||
|
export const MANAGER_TRAVIS = 'travis';
|
|
@ -17,6 +17,7 @@ import {
|
||||||
} from './gradle-updates-report';
|
} from './gradle-updates-report';
|
||||||
import { PackageFile, ExtractConfig, Upgrade } from '../common';
|
import { PackageFile, ExtractConfig, Upgrade } from '../common';
|
||||||
import { platform } from '../../platform';
|
import { platform } from '../../platform';
|
||||||
|
import { MANAGER_GRADLE } from '../../constants/managers';
|
||||||
import {
|
import {
|
||||||
BINARY_SOURCE_DOCKER,
|
BINARY_SOURCE_DOCKER,
|
||||||
DATASOURCE_MAVEN,
|
DATASOURCE_MAVEN,
|
||||||
|
@ -144,7 +145,7 @@ export async function extractAllPackageFiles(
|
||||||
if (content) {
|
if (content) {
|
||||||
gradleFiles.push({
|
gradleFiles.push({
|
||||||
packageFile,
|
packageFile,
|
||||||
manager: 'gradle',
|
manager: MANAGER_GRADLE,
|
||||||
datasource: DATASOURCE_MAVEN,
|
datasource: DATASOURCE_MAVEN,
|
||||||
deps: dependencies,
|
deps: dependencies,
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,46 +8,86 @@ import {
|
||||||
PackageUpdateResult,
|
PackageUpdateResult,
|
||||||
} from './common';
|
} from './common';
|
||||||
import { RangeStrategy } from '../versioning';
|
import { RangeStrategy } from '../versioning';
|
||||||
|
import {
|
||||||
|
MANAGER_ANSIBLE,
|
||||||
|
MANAGER_BAZEL,
|
||||||
|
MANAGER_BUILDKITE,
|
||||||
|
MANAGER_BUNDLER,
|
||||||
|
MANAGER_CARGO,
|
||||||
|
MANAGER_CIRCLE_CI,
|
||||||
|
MANAGER_COMPOSER,
|
||||||
|
MANAGER_DEPS_EDN,
|
||||||
|
MANAGER_DOCKER_COMPOSE,
|
||||||
|
MANAGER_DOCKERFILE,
|
||||||
|
MANAGER_DRONE_CI,
|
||||||
|
MANAGER_GIT_SUBMODULES,
|
||||||
|
MANAGER_GITHUB_ACTIONS,
|
||||||
|
MANAGER_GITLAB_CI,
|
||||||
|
MANAGER_GITLAB_CI_INCLUDE,
|
||||||
|
MANAGER_GO_MOD,
|
||||||
|
MANAGER_GRADLE,
|
||||||
|
MANAGER_GRADLE_WRAPPER,
|
||||||
|
MANAGER_HELM_REQUIREMENTS,
|
||||||
|
MANAGER_HOMEBREW,
|
||||||
|
MANAGER_KUBERNETES,
|
||||||
|
MANAGER_LEININGEN,
|
||||||
|
MANAGER_MAVEN,
|
||||||
|
MANAGER_METEOR,
|
||||||
|
MANAGER_MIX,
|
||||||
|
MANAGER_NPM,
|
||||||
|
MANAGER_NUGET,
|
||||||
|
MANAGER_NVM,
|
||||||
|
MANAGER_PIP_REQUIREMENTS,
|
||||||
|
MANAGER_PIP_SETUP,
|
||||||
|
MANAGER_PIPENV,
|
||||||
|
MANAGER_POETRY,
|
||||||
|
MANAGER_PUB,
|
||||||
|
MANAGER_RUBY_VERSION,
|
||||||
|
MANAGER_SBT,
|
||||||
|
MANAGER_SWIFT,
|
||||||
|
MANAGER_TERRAFORM,
|
||||||
|
MANAGER_TRAVIS,
|
||||||
|
} from '../constants/managers';
|
||||||
|
|
||||||
const managerList = [
|
const managerList = [
|
||||||
'ansible',
|
MANAGER_ANSIBLE,
|
||||||
'bazel',
|
MANAGER_BAZEL,
|
||||||
'buildkite',
|
MANAGER_BUILDKITE,
|
||||||
'bundler',
|
MANAGER_BUNDLER,
|
||||||
'cargo',
|
MANAGER_CARGO,
|
||||||
'circleci',
|
MANAGER_CIRCLE_CI,
|
||||||
'composer',
|
MANAGER_COMPOSER,
|
||||||
'deps-edn',
|
MANAGER_DEPS_EDN,
|
||||||
'docker-compose',
|
MANAGER_DOCKER_COMPOSE,
|
||||||
'dockerfile',
|
MANAGER_DOCKERFILE,
|
||||||
'droneci',
|
MANAGER_DRONE_CI,
|
||||||
'git-submodules',
|
MANAGER_GIT_SUBMODULES,
|
||||||
'github-actions',
|
MANAGER_GITHUB_ACTIONS,
|
||||||
'gitlabci',
|
MANAGER_GITLAB_CI,
|
||||||
'gitlabci-include',
|
MANAGER_GITLAB_CI_INCLUDE,
|
||||||
'gomod',
|
MANAGER_GO_MOD,
|
||||||
'gradle',
|
MANAGER_GRADLE,
|
||||||
'gradle-wrapper',
|
MANAGER_GRADLE_WRAPPER,
|
||||||
'helm-requirements',
|
MANAGER_HELM_REQUIREMENTS,
|
||||||
'homebrew',
|
MANAGER_HOMEBREW,
|
||||||
'kubernetes',
|
MANAGER_KUBERNETES,
|
||||||
'leiningen',
|
MANAGER_LEININGEN,
|
||||||
'maven',
|
MANAGER_MAVEN,
|
||||||
'meteor',
|
MANAGER_METEOR,
|
||||||
'mix',
|
MANAGER_MIX,
|
||||||
'npm',
|
MANAGER_NPM,
|
||||||
'nuget',
|
MANAGER_NUGET,
|
||||||
'nvm',
|
MANAGER_NVM,
|
||||||
'pip_requirements',
|
MANAGER_PIP_REQUIREMENTS,
|
||||||
'pip_setup',
|
MANAGER_PIP_SETUP,
|
||||||
'pipenv',
|
MANAGER_PIPENV,
|
||||||
'poetry',
|
MANAGER_POETRY,
|
||||||
'pub',
|
MANAGER_PUB,
|
||||||
'sbt',
|
MANAGER_SBT,
|
||||||
'swift',
|
MANAGER_SWIFT,
|
||||||
'terraform',
|
MANAGER_TERRAFORM,
|
||||||
'travis',
|
MANAGER_TRAVIS,
|
||||||
'ruby-version',
|
MANAGER_RUBY_VERSION,
|
||||||
];
|
];
|
||||||
|
|
||||||
const managers: Record<string, ManagerApi> = {};
|
const managers: Record<string, ManagerApi> = {};
|
||||||
|
|
|
@ -17,6 +17,7 @@ import {
|
||||||
import { NpmPackage } from './common';
|
import { NpmPackage } from './common';
|
||||||
import { platform } from '../../../platform';
|
import { platform } from '../../../platform';
|
||||||
import { CONFIG_VALIDATION } from '../../../constants/error-messages';
|
import { CONFIG_VALIDATION } from '../../../constants/error-messages';
|
||||||
|
import { MANAGER_NPM } from '../../../constants/managers';
|
||||||
import {
|
import {
|
||||||
DATASOURCE_GITHUB,
|
DATASOURCE_GITHUB,
|
||||||
DATASOURCE_NPM,
|
DATASOURCE_NPM,
|
||||||
|
@ -352,7 +353,7 @@ export async function extractAllPackageFiles(
|
||||||
if (deps) {
|
if (deps) {
|
||||||
npmFiles.push({
|
npmFiles.push({
|
||||||
packageFile,
|
packageFile,
|
||||||
manager: 'npm',
|
manager: MANAGER_NPM,
|
||||||
...deps,
|
...deps,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { safeLoad } from 'js-yaml';
|
||||||
import { isValid } from '../../versioning/npm/index';
|
import { isValid } from '../../versioning/npm/index';
|
||||||
import { logger } from '../../logger';
|
import { logger } from '../../logger';
|
||||||
import { PackageDependency, PackageFile } from '../common';
|
import { PackageDependency, PackageFile } from '../common';
|
||||||
|
import { MANAGER_PUB } from '../../constants/managers';
|
||||||
import { DATASOURCE_DART } from '../../constants/data-binary-source';
|
import { DATASOURCE_DART } from '../../constants/data-binary-source';
|
||||||
|
|
||||||
function getDeps(
|
function getDeps(
|
||||||
|
@ -50,7 +51,7 @@ export function extractPackageFile(
|
||||||
if (deps.length) {
|
if (deps.length) {
|
||||||
return {
|
return {
|
||||||
packageFile,
|
packageFile,
|
||||||
manager: 'pub',
|
manager: MANAGER_PUB,
|
||||||
datasource: DATASOURCE_DART,
|
datasource: DATASOURCE_DART,
|
||||||
deps,
|
deps,
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,6 +3,11 @@ import { logger } from '../../../../logger';
|
||||||
import { configFileNames } from '../../../../config/app-strings';
|
import { configFileNames } from '../../../../config/app-strings';
|
||||||
import { RenovateConfig } from '../../../../config';
|
import { RenovateConfig } from '../../../../config';
|
||||||
import { PackageFile } from '../../../../manager/common';
|
import { PackageFile } from '../../../../manager/common';
|
||||||
|
import {
|
||||||
|
MANAGER_CIRCLE_CI,
|
||||||
|
MANAGER_DOCKER_COMPOSE,
|
||||||
|
MANAGER_DOCKERFILE,
|
||||||
|
} from '../../../../constants/managers';
|
||||||
|
|
||||||
const defaultConfigFile = configFileNames[0];
|
const defaultConfigFile = configFileNames[0];
|
||||||
|
|
||||||
|
@ -42,9 +47,9 @@ export function getConfigDesc(
|
||||||
const enabledManagers = packageFiles ? Object.keys(packageFiles) : [];
|
const enabledManagers = packageFiles ? Object.keys(packageFiles) : [];
|
||||||
if (
|
if (
|
||||||
!(
|
!(
|
||||||
enabledManagers.includes('dockerfile') ||
|
enabledManagers.includes(MANAGER_DOCKERFILE) ||
|
||||||
enabledManagers.includes('circleci') ||
|
enabledManagers.includes(MANAGER_CIRCLE_CI) ||
|
||||||
enabledManagers.includes('docker-compose')
|
enabledManagers.includes(MANAGER_DOCKER_COMPOSE)
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
descriptionArr = descriptionArr.filter(val => !val.includes('Docker-only'));
|
descriptionArr = descriptionArr.filter(val => !val.includes('Docker-only'));
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
import * as manager from '../../lib/manager';
|
import * as manager from '../../lib/manager';
|
||||||
|
import { MANAGER_DOCKERFILE } from '../../lib/constants/managers';
|
||||||
|
|
||||||
describe('manager', () => {
|
describe('manager', () => {
|
||||||
describe('get()', () => {
|
describe('get()', () => {
|
||||||
it('gets something', () => {
|
it('gets something', () => {
|
||||||
expect(manager.get('dockerfile', 'extractPackageFile')).not.toBeNull();
|
expect(
|
||||||
|
manager.get(MANAGER_DOCKERFILE, 'extractPackageFile')
|
||||||
|
).not.toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('getLanguageList()', () => {
|
describe('getLanguageList()', () => {
|
||||||
|
@ -19,7 +22,7 @@ describe('manager', () => {
|
||||||
describe('extractAllPackageFiles()', () => {
|
describe('extractAllPackageFiles()', () => {
|
||||||
it('returns null', () => {
|
it('returns null', () => {
|
||||||
expect(
|
expect(
|
||||||
manager.extractAllPackageFiles('dockerfile', {} as any, [])
|
manager.extractAllPackageFiles(MANAGER_DOCKERFILE, {} as any, [])
|
||||||
).toBeNull();
|
).toBeNull();
|
||||||
});
|
});
|
||||||
it('returns non-null', () => {
|
it('returns non-null', () => {
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
import { getRangeStrategy } from '../../lib/manager';
|
import { getRangeStrategy } from '../../lib/manager';
|
||||||
import { RangeConfig } from '../../lib/manager/common';
|
import { RangeConfig } from '../../lib/manager/common';
|
||||||
|
import { MANAGER_CIRCLE_CI, MANAGER_NPM } from '../../lib/constants/managers';
|
||||||
|
|
||||||
describe('getRangeStrategy', () => {
|
describe('getRangeStrategy', () => {
|
||||||
it('returns same if not auto', () => {
|
it('returns same if not auto', () => {
|
||||||
const config: RangeConfig = { manager: 'npm', rangeStrategy: 'widen' };
|
const config: RangeConfig = {
|
||||||
|
manager: MANAGER_NPM,
|
||||||
|
rangeStrategy: 'widen',
|
||||||
|
};
|
||||||
expect(getRangeStrategy(config)).toEqual('widen');
|
expect(getRangeStrategy(config)).toEqual('widen');
|
||||||
});
|
});
|
||||||
it('returns manager strategy', () => {
|
it('returns manager strategy', () => {
|
||||||
const config: RangeConfig = {
|
const config: RangeConfig = {
|
||||||
manager: 'npm',
|
manager: MANAGER_NPM,
|
||||||
rangeStrategy: 'auto',
|
rangeStrategy: 'auto',
|
||||||
depType: 'dependencies',
|
depType: 'dependencies',
|
||||||
packageJsonType: 'app',
|
packageJsonType: 'app',
|
||||||
|
@ -17,14 +21,14 @@ describe('getRangeStrategy', () => {
|
||||||
});
|
});
|
||||||
it('defaults to replace', () => {
|
it('defaults to replace', () => {
|
||||||
const config: RangeConfig = {
|
const config: RangeConfig = {
|
||||||
manager: 'circleci',
|
manager: MANAGER_CIRCLE_CI,
|
||||||
rangeStrategy: 'auto',
|
rangeStrategy: 'auto',
|
||||||
};
|
};
|
||||||
expect(getRangeStrategy(config)).toEqual('replace');
|
expect(getRangeStrategy(config)).toEqual('replace');
|
||||||
});
|
});
|
||||||
it('returns rangeStrategy if not auto', () => {
|
it('returns rangeStrategy if not auto', () => {
|
||||||
const config: RangeConfig = {
|
const config: RangeConfig = {
|
||||||
manager: 'circleci',
|
manager: MANAGER_CIRCLE_CI,
|
||||||
rangeStrategy: 'future',
|
rangeStrategy: 'future',
|
||||||
};
|
};
|
||||||
expect(getRangeStrategy(config)).toEqual('future');
|
expect(getRangeStrategy(config)).toEqual('future');
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
import { applyPackageRules, Config } from '../../lib/util/package-rules';
|
import { applyPackageRules, Config } from '../../lib/util/package-rules';
|
||||||
import { UpdateType } from '../../lib/config';
|
import { UpdateType } from '../../lib/config';
|
||||||
|
import {
|
||||||
|
MANAGER_DOCKERFILE,
|
||||||
|
MANAGER_METEOR,
|
||||||
|
MANAGER_NPM,
|
||||||
|
MANAGER_PIPENV,
|
||||||
|
} from '../../lib/constants/managers';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
DATASOURCE_DOCKER,
|
DATASOURCE_DOCKER,
|
||||||
DATASOURCE_ORB,
|
DATASOURCE_ORB,
|
||||||
|
@ -180,7 +187,7 @@ describe('applyPackageRules()', () => {
|
||||||
const config: TestConfig = {
|
const config: TestConfig = {
|
||||||
packageRules: [
|
packageRules: [
|
||||||
{
|
{
|
||||||
managers: ['npm', 'meteor'],
|
managers: [MANAGER_NPM, MANAGER_METEOR],
|
||||||
packageNames: ['node'],
|
packageNames: ['node'],
|
||||||
x: 1,
|
x: 1,
|
||||||
},
|
},
|
||||||
|
@ -189,7 +196,7 @@ describe('applyPackageRules()', () => {
|
||||||
const dep = {
|
const dep = {
|
||||||
depType: 'dependencies',
|
depType: 'dependencies',
|
||||||
language: 'js',
|
language: 'js',
|
||||||
manager: 'meteor',
|
manager: MANAGER_METEOR,
|
||||||
depName: 'node',
|
depName: 'node',
|
||||||
};
|
};
|
||||||
const res = applyPackageRules({ ...config, ...dep });
|
const res = applyPackageRules({ ...config, ...dep });
|
||||||
|
@ -199,7 +206,7 @@ describe('applyPackageRules()', () => {
|
||||||
const config: TestConfig = {
|
const config: TestConfig = {
|
||||||
packageRules: [
|
packageRules: [
|
||||||
{
|
{
|
||||||
managers: ['dockerfile', 'npm'],
|
managers: [MANAGER_DOCKERFILE, MANAGER_NPM],
|
||||||
packageNames: ['node'],
|
packageNames: ['node'],
|
||||||
x: 1,
|
x: 1,
|
||||||
},
|
},
|
||||||
|
@ -208,7 +215,7 @@ describe('applyPackageRules()', () => {
|
||||||
const dep = {
|
const dep = {
|
||||||
depType: 'dependencies',
|
depType: 'dependencies',
|
||||||
language: 'python',
|
language: 'python',
|
||||||
manager: 'pipenv',
|
manager: MANAGER_PIPENV,
|
||||||
depName: 'node',
|
depName: 'node',
|
||||||
};
|
};
|
||||||
const res = applyPackageRules({ ...config, ...dep });
|
const res = applyPackageRules({ ...config, ...dep });
|
||||||
|
@ -227,7 +234,7 @@ describe('applyPackageRules()', () => {
|
||||||
const dep = {
|
const dep = {
|
||||||
depType: 'dependencies',
|
depType: 'dependencies',
|
||||||
language: 'js',
|
language: 'js',
|
||||||
manager: 'meteor',
|
manager: MANAGER_METEOR,
|
||||||
depName: 'node',
|
depName: 'node',
|
||||||
};
|
};
|
||||||
const res = applyPackageRules({ ...config, ...dep });
|
const res = applyPackageRules({ ...config, ...dep });
|
||||||
|
@ -246,7 +253,7 @@ describe('applyPackageRules()', () => {
|
||||||
const dep = {
|
const dep = {
|
||||||
depType: 'dependencies',
|
depType: 'dependencies',
|
||||||
language: 'python',
|
language: 'python',
|
||||||
manager: 'pipenv',
|
manager: MANAGER_PIPENV,
|
||||||
depName: 'node',
|
depName: 'node',
|
||||||
};
|
};
|
||||||
const res = applyPackageRules({ ...config, ...dep });
|
const res = applyPackageRules({ ...config, ...dep });
|
||||||
|
|
|
@ -3,6 +3,11 @@ import * as _npm from '../../../lib/manager/npm';
|
||||||
import * as _gitSubmodules from '../../../lib/manager/git-submodules';
|
import * as _gitSubmodules from '../../../lib/manager/git-submodules';
|
||||||
import { getUpdatedPackageFiles } from '../../../lib/workers/branch/get-updated';
|
import { getUpdatedPackageFiles } from '../../../lib/workers/branch/get-updated';
|
||||||
import { mocked, defaultConfig, platform } from '../../util';
|
import { mocked, defaultConfig, platform } from '../../util';
|
||||||
|
import {
|
||||||
|
MANAGER_COMPOSER,
|
||||||
|
MANAGER_GIT_SUBMODULES,
|
||||||
|
MANAGER_NPM,
|
||||||
|
} from '../../../lib/constants/managers';
|
||||||
import { DATASOURCE_GIT_SUBMODULES } from '../../../lib/constants/data-binary-source';
|
import { DATASOURCE_GIT_SUBMODULES } from '../../../lib/constants/data-binary-source';
|
||||||
|
|
||||||
const composer = mocked(_composer);
|
const composer = mocked(_composer);
|
||||||
|
@ -31,14 +36,14 @@ describe('workers/branch/get-updated', () => {
|
||||||
it('handles null content', async () => {
|
it('handles null content', async () => {
|
||||||
config.parentBranch = 'some-branch';
|
config.parentBranch = 'some-branch';
|
||||||
config.upgrades.push({
|
config.upgrades.push({
|
||||||
manager: 'npm',
|
manager: MANAGER_NPM,
|
||||||
});
|
});
|
||||||
await expect(getUpdatedPackageFiles(config)).rejects.toThrow();
|
await expect(getUpdatedPackageFiles(config)).rejects.toThrow();
|
||||||
});
|
});
|
||||||
it('handles content change', async () => {
|
it('handles content change', async () => {
|
||||||
config.parentBranch = 'some-branch';
|
config.parentBranch = 'some-branch';
|
||||||
config.upgrades.push({
|
config.upgrades.push({
|
||||||
manager: 'npm',
|
manager: MANAGER_NPM,
|
||||||
});
|
});
|
||||||
npm.updateDependency.mockReturnValue('some new content');
|
npm.updateDependency.mockReturnValue('some new content');
|
||||||
const res = await getUpdatedPackageFiles(config);
|
const res = await getUpdatedPackageFiles(config);
|
||||||
|
@ -47,7 +52,7 @@ describe('workers/branch/get-updated', () => {
|
||||||
it('handles lock files', async () => {
|
it('handles lock files', async () => {
|
||||||
config.parentBranch = 'some-branch';
|
config.parentBranch = 'some-branch';
|
||||||
config.upgrades.push({
|
config.upgrades.push({
|
||||||
manager: 'composer',
|
manager: MANAGER_COMPOSER,
|
||||||
});
|
});
|
||||||
composer.updateDependency.mockReturnValue('some new content');
|
composer.updateDependency.mockReturnValue('some new content');
|
||||||
composer.updateArtifacts.mockResolvedValueOnce([
|
composer.updateArtifacts.mockResolvedValueOnce([
|
||||||
|
@ -64,7 +69,7 @@ describe('workers/branch/get-updated', () => {
|
||||||
it('handles lockFileMaintenance', async () => {
|
it('handles lockFileMaintenance', async () => {
|
||||||
// config.parentBranch = 'some-branch';
|
// config.parentBranch = 'some-branch';
|
||||||
config.upgrades.push({
|
config.upgrades.push({
|
||||||
manager: 'composer',
|
manager: MANAGER_COMPOSER,
|
||||||
updateType: 'lockFileMaintenance',
|
updateType: 'lockFileMaintenance',
|
||||||
});
|
});
|
||||||
composer.updateArtifacts.mockResolvedValueOnce([
|
composer.updateArtifacts.mockResolvedValueOnce([
|
||||||
|
@ -81,7 +86,7 @@ describe('workers/branch/get-updated', () => {
|
||||||
it('handles lockFileMaintenance error', async () => {
|
it('handles lockFileMaintenance error', async () => {
|
||||||
// config.parentBranch = 'some-branch';
|
// config.parentBranch = 'some-branch';
|
||||||
config.upgrades.push({
|
config.upgrades.push({
|
||||||
manager: 'composer',
|
manager: MANAGER_COMPOSER,
|
||||||
updateType: 'lockFileMaintenance',
|
updateType: 'lockFileMaintenance',
|
||||||
});
|
});
|
||||||
composer.updateArtifacts.mockResolvedValueOnce([
|
composer.updateArtifacts.mockResolvedValueOnce([
|
||||||
|
@ -98,7 +103,7 @@ describe('workers/branch/get-updated', () => {
|
||||||
it('handles lock file errors', async () => {
|
it('handles lock file errors', async () => {
|
||||||
config.parentBranch = 'some-branch';
|
config.parentBranch = 'some-branch';
|
||||||
config.upgrades.push({
|
config.upgrades.push({
|
||||||
manager: 'composer',
|
manager: MANAGER_COMPOSER,
|
||||||
});
|
});
|
||||||
composer.updateDependency.mockReturnValue('some new content');
|
composer.updateDependency.mockReturnValue('some new content');
|
||||||
composer.updateArtifacts.mockResolvedValueOnce([
|
composer.updateArtifacts.mockResolvedValueOnce([
|
||||||
|
@ -114,7 +119,7 @@ describe('workers/branch/get-updated', () => {
|
||||||
});
|
});
|
||||||
it('handles git submodules', async () => {
|
it('handles git submodules', async () => {
|
||||||
config.upgrades.push({
|
config.upgrades.push({
|
||||||
manager: 'git-submodules',
|
manager: MANAGER_GIT_SUBMODULES,
|
||||||
datasource: DATASOURCE_GIT_SUBMODULES,
|
datasource: DATASOURCE_GIT_SUBMODULES,
|
||||||
});
|
});
|
||||||
gitSubmodules.updateDependency.mockResolvedValueOnce('existing content');
|
gitSubmodules.updateDependency.mockResolvedValueOnce('existing content');
|
||||||
|
|
|
@ -3,6 +3,11 @@ import * as _fileMatch from '../../../../lib/workers/repository/extract/file-mat
|
||||||
import * as _dockerfile from '../../../../lib/manager/dockerfile';
|
import * as _dockerfile from '../../../../lib/manager/dockerfile';
|
||||||
import { mocked, platform, getConfig } from '../../../util';
|
import { mocked, platform, getConfig } from '../../../util';
|
||||||
import { RenovateConfig } from '../../../../lib/config';
|
import { RenovateConfig } from '../../../../lib/config';
|
||||||
|
import {
|
||||||
|
MANAGER_DOCKERFILE,
|
||||||
|
MANAGER_NPM,
|
||||||
|
MANAGER_TRAVIS,
|
||||||
|
} from '../../../../lib/constants/managers';
|
||||||
|
|
||||||
jest.mock('../../../../lib/workers/repository/extract/file-match');
|
jest.mock('../../../../lib/workers/repository/extract/file-match');
|
||||||
jest.mock('../../../../lib/manager/dockerfile');
|
jest.mock('../../../../lib/manager/dockerfile');
|
||||||
|
@ -18,7 +23,7 @@ describe('workers/repository/extract/manager-files', () => {
|
||||||
config = getConfig;
|
config = getConfig;
|
||||||
});
|
});
|
||||||
it('returns empty of manager is disabled', async () => {
|
it('returns empty of manager is disabled', async () => {
|
||||||
const managerConfig = { manager: 'travis', enabled: false };
|
const managerConfig = { manager: MANAGER_TRAVIS, enabled: false };
|
||||||
const res = await getManagerPackageFiles(managerConfig);
|
const res = await getManagerPackageFiles(managerConfig);
|
||||||
expect(res).toHaveLength(0);
|
expect(res).toHaveLength(0);
|
||||||
});
|
});
|
||||||
|
@ -29,13 +34,13 @@ describe('workers/repository/extract/manager-files', () => {
|
||||||
expect(res).toHaveLength(0);
|
expect(res).toHaveLength(0);
|
||||||
});
|
});
|
||||||
it('skips files if null content returned', async () => {
|
it('skips files if null content returned', async () => {
|
||||||
const managerConfig = { manager: 'npm', enabled: true };
|
const managerConfig = { manager: MANAGER_NPM, enabled: true };
|
||||||
fileMatch.getMatchingFiles.mockReturnValue(['package.json']);
|
fileMatch.getMatchingFiles.mockReturnValue(['package.json']);
|
||||||
const res = await getManagerPackageFiles(managerConfig);
|
const res = await getManagerPackageFiles(managerConfig);
|
||||||
expect(res).toHaveLength(0);
|
expect(res).toHaveLength(0);
|
||||||
});
|
});
|
||||||
it('returns files with extractPackageFile', async () => {
|
it('returns files with extractPackageFile', async () => {
|
||||||
const managerConfig = { manager: 'dockerfile', enabled: true };
|
const managerConfig = { manager: MANAGER_DOCKERFILE, enabled: true };
|
||||||
fileMatch.getMatchingFiles.mockReturnValue(['Dockerfile']);
|
fileMatch.getMatchingFiles.mockReturnValue(['Dockerfile']);
|
||||||
platform.getFile.mockResolvedValue('some content');
|
platform.getFile.mockResolvedValue('some content');
|
||||||
dockerfile.extractPackageFile = jest.fn(() => ({
|
dockerfile.extractPackageFile = jest.fn(() => ({
|
||||||
|
@ -45,7 +50,7 @@ describe('workers/repository/extract/manager-files', () => {
|
||||||
expect(res).toMatchSnapshot();
|
expect(res).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
it('returns files with extractAllPackageFiles', async () => {
|
it('returns files with extractAllPackageFiles', async () => {
|
||||||
const managerConfig = { manager: 'npm', enabled: true };
|
const managerConfig = { manager: MANAGER_NPM, enabled: true };
|
||||||
fileMatch.getMatchingFiles.mockReturnValue(['package.json']);
|
fileMatch.getMatchingFiles.mockReturnValue(['package.json']);
|
||||||
platform.getFile.mockResolvedValue('{}');
|
platform.getFile.mockResolvedValue('{}');
|
||||||
const res = await getManagerPackageFiles(managerConfig);
|
const res = await getManagerPackageFiles(managerConfig);
|
||||||
|
|
|
@ -11,6 +11,7 @@ import * as _docker from '../../../../../lib/datasource/docker';
|
||||||
import * as _gitSubmodules from '../../../../../lib/datasource/git-submodules';
|
import * as _gitSubmodules from '../../../../../lib/datasource/git-submodules';
|
||||||
import { mocked, getConfig } from '../../../../util';
|
import { mocked, getConfig } from '../../../../util';
|
||||||
import { CONFIG_VALIDATION } from '../../../../../lib/constants/error-messages';
|
import { CONFIG_VALIDATION } from '../../../../../lib/constants/error-messages';
|
||||||
|
import { MANAGER_PIP_REQUIREMENTS } from '../../../../../lib/constants/managers';
|
||||||
import {
|
import {
|
||||||
DATASOURCE_DOCKER,
|
DATASOURCE_DOCKER,
|
||||||
DATASOURCE_GIT_SUBMODULES,
|
DATASOURCE_GIT_SUBMODULES,
|
||||||
|
@ -1021,7 +1022,7 @@ describe('workers/repository/process/lookup', () => {
|
||||||
expect((await lookup.lookupUpdates(config)).updates).toMatchSnapshot();
|
expect((await lookup.lookupUpdates(config)).updates).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
it('handles PEP440', async () => {
|
it('handles PEP440', async () => {
|
||||||
config.manager = 'pip_requirements';
|
config.manager = MANAGER_PIP_REQUIREMENTS;
|
||||||
config.versionScheme = 'pep440';
|
config.versionScheme = 'pep440';
|
||||||
config.rangeStrategy = 'pin';
|
config.rangeStrategy = 'pin';
|
||||||
config.lockedVersion = '0.9.4';
|
config.lockedVersion = '0.9.4';
|
||||||
|
|
Loading…
Reference in a new issue