fix(packageRules): get packageFile from depTypeConfig

This commit is contained in:
Rhys Arkins 2018-04-28 15:47:09 +02:00
parent 898b913f3b
commit 2606219485
2 changed files with 5 additions and 4 deletions

View file

@ -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) {

View file

@ -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();
}); });