mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 23:16:26 +00:00
fix(packageRules): get packageFile from depTypeConfig
This commit is contained in:
parent
898b913f3b
commit
2606219485
2 changed files with 5 additions and 4 deletions
|
@ -49,7 +49,8 @@ async function renovateDepType(packageContent, config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDepConfig(depTypeConfig, dep) {
|
function getDepConfig(depTypeConfig, dep) {
|
||||||
const { depName: dependency, packageFile } = dep;
|
const { depName: dependency } = dep;
|
||||||
|
const { packageFile } = depTypeConfig;
|
||||||
let depConfig = configParser.mergeChildConfig(depTypeConfig, dep);
|
let depConfig = configParser.mergeChildConfig(depTypeConfig, dep);
|
||||||
// Apply any matching package rules
|
// Apply any matching package rules
|
||||||
if (depConfig.packageRules) {
|
if (depConfig.packageRules) {
|
||||||
|
|
|
@ -310,6 +310,7 @@ describe('lib/workers/package-file/dep-type', () => {
|
||||||
});
|
});
|
||||||
it('matches paths', () => {
|
it('matches paths', () => {
|
||||||
const config = {
|
const config = {
|
||||||
|
packageFile: 'examples/foo/package.json',
|
||||||
packageRules: [
|
packageRules: [
|
||||||
{
|
{
|
||||||
paths: ['examples/**', 'lib/'],
|
paths: ['examples/**', 'lib/'],
|
||||||
|
@ -319,17 +320,16 @@ describe('lib/workers/package-file/dep-type', () => {
|
||||||
};
|
};
|
||||||
const res1 = depTypeWorker.getDepConfig(config, {
|
const res1 = depTypeWorker.getDepConfig(config, {
|
||||||
depName: 'test',
|
depName: 'test',
|
||||||
packageFile: 'examples/foo/package.json',
|
|
||||||
});
|
});
|
||||||
expect(res1.x).toBeDefined();
|
expect(res1.x).toBeDefined();
|
||||||
|
config.packageFile = 'package.json';
|
||||||
const res2 = depTypeWorker.getDepConfig(config, {
|
const res2 = depTypeWorker.getDepConfig(config, {
|
||||||
depName: 'test',
|
depName: 'test',
|
||||||
packageFile: 'package.json',
|
|
||||||
});
|
});
|
||||||
expect(res2.x).toBeUndefined();
|
expect(res2.x).toBeUndefined();
|
||||||
|
config.packageFile = 'lib/a/package.json';
|
||||||
const res3 = depTypeWorker.getDepConfig(config, {
|
const res3 = depTypeWorker.getDepConfig(config, {
|
||||||
depName: 'test',
|
depName: 'test',
|
||||||
packageFile: 'lib/a/package.json',
|
|
||||||
});
|
});
|
||||||
expect(res3.x).toBeDefined();
|
expect(res3.x).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue