Skip to content
Snippets Groups Projects
Unverified Commit d81b2c5e authored by Maxime Brunet's avatar Maxime Brunet Committed by GitHub
Browse files

fix(gomod): use plural for additional dependencies notice (#29361)

parent 27b08bc5
No related branches found
No related tags found
No related merge requests found
...@@ -91,7 +91,7 @@ describe('modules/manager/gomod/artifacts-extra', () => { ...@@ -91,7 +91,7 @@ describe('modules/manager/gomod/artifacts-extra', () => {
expect(res).toBeNull(); expect(res).toBeNull();
}); });
it('returns a notice when there are extra dependencies', () => { it('returns a notice when there is an extra dependency', () => {
const excludeDeps = ['go', 'github.com/foo/foo']; const excludeDeps = ['go', 'github.com/foo/foo'];
const res = getExtraDepsNotice(goModBefore, goModAfter, excludeDeps); const res = getExtraDepsNotice(goModBefore, goModAfter, excludeDeps);
...@@ -112,6 +112,28 @@ describe('modules/manager/gomod/artifacts-extra', () => { ...@@ -112,6 +112,28 @@ describe('modules/manager/gomod/artifacts-extra', () => {
); );
}); });
it('returns a notice when there are extra dependencies', () => {
const excludeDeps = ['go'];
const res = getExtraDepsNotice(goModBefore, goModAfter, excludeDeps);
expect(res).toEqual(
[
'In order to perform the update(s) described in the table above, Renovate ran the `go get` command, which resulted in the following additional change(s):',
'',
'',
'- 2 additional dependencies were updated',
'',
'',
'Details:',
'| **Package** | **Change** |',
'| :------------------- | :------------------- |',
'| `github.com/foo/foo` | `v1.0.0` -> `v1.1.1` |',
'| `github.com/bar/bar` | `v2.0.0` -> `v2.2.2` |',
].join('\n'),
);
});
it('adds special notice for updated `go` version', () => { it('adds special notice for updated `go` version', () => {
const excludeDeps = ['github.com/foo/foo']; const excludeDeps = ['github.com/foo/foo'];
......
...@@ -94,8 +94,12 @@ export function getExtraDepsNotice( ...@@ -94,8 +94,12 @@ export function getExtraDepsNotice(
const goUpdated = extraDeps.some(({ depName }) => depName === 'go'); const goUpdated = extraDeps.some(({ depName }) => depName === 'go');
const otherDepsCount = extraDeps.length - (goUpdated ? 1 : 0); const otherDepsCount = extraDeps.length - (goUpdated ? 1 : 0);
if (otherDepsCount > 0) { if (otherDepsCount === 1) {
noticeLines.push(`- ${otherDepsCount} additional dependency was updated`); noticeLines.push(`- ${otherDepsCount} additional dependency was updated`);
} else if (otherDepsCount > 1) {
noticeLines.push(
`- ${otherDepsCount} additional dependencies were updated`,
);
} }
if (goUpdated) { if (goUpdated) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment