mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 22:46:27 +00:00
fix: imply lerna packages dir if not in config (#700)
This commit is contained in:
parent
d72dccfbe1
commit
68033a7040
3 changed files with 23 additions and 1 deletions
|
@ -58,7 +58,9 @@ async function checkForLerna(config) {
|
||||||
}
|
}
|
||||||
config.logger.debug({ lernaJson }, 'Found lerna config');
|
config.logger.debug({ lernaJson }, 'Found lerna config');
|
||||||
try {
|
try {
|
||||||
const packagesPath = lernaJson.packages[0].slice(0, -2);
|
const packagesPath = lernaJson.packages
|
||||||
|
? lernaJson.packages[0].slice(0, -2)
|
||||||
|
: 'packages';
|
||||||
const lernaPackages = await config.api.getSubDirectories(packagesPath);
|
const lernaPackages = await config.api.getSubDirectories(packagesPath);
|
||||||
if (lernaPackages.length === 0) {
|
if (lernaPackages.length === 0) {
|
||||||
return {};
|
return {};
|
||||||
|
|
|
@ -9,6 +9,15 @@ Object {
|
||||||
|
|
||||||
exports[`workers/repository/apis checkForLerna(config) ignores zero length lerna 1`] = `Object {}`;
|
exports[`workers/repository/apis checkForLerna(config) ignores zero length lerna 1`] = `Object {}`;
|
||||||
|
|
||||||
|
exports[`workers/repository/apis checkForLerna(config) implies lerna package path 1`] = `
|
||||||
|
Object {
|
||||||
|
"lernaPackages": Array [
|
||||||
|
"a",
|
||||||
|
"b",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`workers/repository/apis checkForLerna(config) returns lerna package names 1`] = `
|
exports[`workers/repository/apis checkForLerna(config) returns lerna package names 1`] = `
|
||||||
Object {
|
Object {
|
||||||
"lernaPackages": Array [
|
"lernaPackages": Array [
|
||||||
|
|
|
@ -92,6 +92,17 @@ describe('workers/repository/apis', () => {
|
||||||
const res = await apis.checkForLerna(config);
|
const res = await apis.checkForLerna(config);
|
||||||
expect(res).toMatchSnapshot();
|
expect(res).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
it('implies lerna package path', async () => {
|
||||||
|
const config = {
|
||||||
|
api: {
|
||||||
|
getFileJson: jest.fn(() => ({})),
|
||||||
|
getSubDirectories: jest.fn(() => ['a', 'b']),
|
||||||
|
},
|
||||||
|
logger,
|
||||||
|
};
|
||||||
|
const res = await apis.checkForLerna(config);
|
||||||
|
expect(res).toMatchSnapshot();
|
||||||
|
});
|
||||||
it('returns lerna package names', async () => {
|
it('returns lerna package names', async () => {
|
||||||
const config = {
|
const config = {
|
||||||
api: {
|
api: {
|
||||||
|
|
Loading…
Reference in a new issue