diff --git a/lib/workers/repository/__snapshots__/dependency-dashboard.spec.ts.snap b/lib/workers/repository/__snapshots__/dependency-dashboard.spec.ts.snap index 02d286d9fd624d..73af65201bc704 100644 --- a/lib/workers/repository/__snapshots__/dependency-dashboard.spec.ts.snap +++ b/lib/workers/repository/__snapshots__/dependency-dashboard.spec.ts.snap @@ -59,15 +59,3 @@ These updates are awaiting their schedule. Click on a checkbox to get an update " `; - -exports[`workers/repository/dependency-dashboard readDashboardBody() reads dashboard body 1`] = ` -Object { - "dependencyDashboardChecks": Object { - "branchName1": "approve", - }, - "dependencyDashboardIssue": 1, - "dependencyDashboardRebaseAllOpen": true, - "dependencyDashboardTitle": "Dependency Dashboard", - "prCreation": "approval", -} -`; diff --git a/lib/workers/repository/__snapshots__/index.spec.ts.snap b/lib/workers/repository/__snapshots__/index.spec.ts.snap deleted file mode 100644 index b51587e46bcac5..00000000000000 --- a/lib/workers/repository/__snapshots__/index.spec.ts.snap +++ /dev/null @@ -1,3 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`workers/repository/index renovateRepository() runs 1`] = `undefined`; diff --git a/lib/workers/repository/dependency-dashboard.spec.ts b/lib/workers/repository/dependency-dashboard.spec.ts index ef16629b7a969c..ac1c353cbe2202 100644 --- a/lib/workers/repository/dependency-dashboard.spec.ts +++ b/lib/workers/repository/dependency-dashboard.spec.ts @@ -53,8 +53,15 @@ describe('workers/repository/dependency-dashboard', () => { '\n\n - [x] ', }); await dependencyDashboard.readDashboardBody(conf); - // FIXME: explicit assert condition - expect(conf).toMatchSnapshot(); + expect(conf).toEqual({ + dependencyDashboardChecks: { + branchName1: 'approve', + }, + dependencyDashboardIssue: 1, + dependencyDashboardRebaseAllOpen: true, + dependencyDashboardTitle: 'Dependency Dashboard', + prCreation: 'approval', + }); }); }); diff --git a/lib/workers/repository/extract/__snapshots__/index.spec.ts.snap b/lib/workers/repository/extract/__snapshots__/index.spec.ts.snap deleted file mode 100644 index 310997713ce6df..00000000000000 --- a/lib/workers/repository/extract/__snapshots__/index.spec.ts.snap +++ /dev/null @@ -1,9 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`workers/repository/extract/index extractAllDependencies() skips non-enabled managers 1`] = ` -Object { - "npm": Array [ - Object {}, - ], -} -`; diff --git a/lib/workers/repository/extract/__snapshots__/manager-files.spec.ts.snap b/lib/workers/repository/extract/__snapshots__/manager-files.spec.ts.snap index 281f2250844f50..125d5e754a4b09 100644 --- a/lib/workers/repository/extract/__snapshots__/manager-files.spec.ts.snap +++ b/lib/workers/repository/extract/__snapshots__/manager-files.spec.ts.snap @@ -33,20 +33,3 @@ Array [ }, ] `; - -exports[`workers/repository/extract/manager-files getManagerPackageFiles() returns files with extractPackageFile 1`] = ` -Array [ - Object { - "deps": Array [ - Object { - "depIndex": 0, - }, - Object { - "depIndex": 1, - "replaceString": "abc", - }, - ], - "packageFile": "Dockerfile", - }, -] -`; diff --git a/lib/workers/repository/extract/index.spec.ts b/lib/workers/repository/extract/index.spec.ts index 2e75237e523db3..f7afcf2bc2d548 100644 --- a/lib/workers/repository/extract/index.spec.ts +++ b/lib/workers/repository/extract/index.spec.ts @@ -27,8 +27,7 @@ describe('workers/repository/extract/index', () => { config.enabledManagers = ['npm']; managerFiles.getManagerPackageFiles.mockResolvedValue([{} as never]); const res = await extractAllDependencies(config); - // FIXME: explicit assert condition - expect(res).toMatchSnapshot(); + expect(res).toEqual({ npm: [{}] }); }); it('warns if no packages found for a enabled manager', async () => { diff --git a/lib/workers/repository/extract/manager-files.spec.ts b/lib/workers/repository/extract/manager-files.spec.ts index c83f5a55f7ad60..79f5b14cbee4ee 100644 --- a/lib/workers/repository/extract/manager-files.spec.ts +++ b/lib/workers/repository/extract/manager-files.spec.ts @@ -47,8 +47,12 @@ describe('workers/repository/extract/manager-files', () => { deps: [{}, { replaceString: 'abc' }], })) as never; const res = await getManagerPackageFiles(managerConfig); - // FIXME: explicit assert condition - expect(res).toMatchSnapshot(); + expect(res).toEqual([ + { + packageFile: 'Dockerfile', + deps: [{ depIndex: 0 }, { depIndex: 1, replaceString: 'abc' }], + }, + ]); }); it('returns files with extractAllPackageFiles', async () => { const managerConfig = { @@ -61,8 +65,20 @@ describe('workers/repository/extract/manager-files', () => { '{"dependencies":{"chalk":"2.0.0"}}' ); const res = await getManagerPackageFiles(managerConfig); - // FIXME: explicit assert condition - expect(res).toMatchSnapshot(); + expect(res).toMatchSnapshot([ + { + packageFile: 'package.json', + packageJsonType: 'app', + deps: [ + { + currentValue: '2.0.0', + datasource: 'npm', + depName: 'chalk', + depType: 'dependencies', + }, + ], + }, + ]); }); }); }); diff --git a/lib/workers/repository/index.spec.ts b/lib/workers/repository/index.spec.ts index 28fda468626ce3..212de3ee05947e 100644 --- a/lib/workers/repository/index.spec.ts +++ b/lib/workers/repository/index.spec.ts @@ -23,8 +23,7 @@ describe('workers/repository/index', () => { it('runs', async () => { process.extractDependencies.mockResolvedValue(mock()); const res = await renovateRepository(config); - // FIXME: explicit assert condition - expect(res).toMatchSnapshot(); + expect(res).toBeUndefined(); }); }); }); diff --git a/lib/workers/repository/init/__snapshots__/index.spec.ts.snap b/lib/workers/repository/init/__snapshots__/index.spec.ts.snap deleted file mode 100644 index 802c8eb539672e..00000000000000 --- a/lib/workers/repository/init/__snapshots__/index.spec.ts.snap +++ /dev/null @@ -1,3 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`workers/repository/init/index initRepo runs 1`] = `Object {}`; diff --git a/lib/workers/repository/init/__snapshots__/merge.spec.ts.snap b/lib/workers/repository/init/__snapshots__/merge.spec.ts.snap deleted file mode 100644 index 2271e01caa04df..00000000000000 --- a/lib/workers/repository/init/__snapshots__/merge.spec.ts.snap +++ /dev/null @@ -1,76 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`workers/repository/init/merge detectRepoFileConfig() finds .github/renovate.json 1`] = ` -Object { - "configFileName": ".github/renovate.json", - "configFileParsed": Object {}, -} -`; - -exports[`workers/repository/init/merge detectRepoFileConfig() finds .gitlab/renovate.json 1`] = ` -Object { - "configFileName": ".gitlab/renovate.json", - "configFileParsed": Object {}, -} -`; - -exports[`workers/repository/init/merge detectRepoFileConfig() finds .renovaterc.json 1`] = ` -Object { - "configFileName": ".renovaterc.json", - "configFileParsed": Object {}, -} -`; - -exports[`workers/repository/init/merge detectRepoFileConfig() finds .renovaterc.json 2`] = ` -Object { - "configFileName": ".renovaterc.json", - "configFileParsed": "{\\"something\\":\\"new\\"}", -} -`; - -exports[`workers/repository/init/merge detectRepoFileConfig() finds and parse renovate.json5 1`] = ` -Object { - "configFileName": "renovate.json5", - "configFileParsed": Object {}, -} -`; - -exports[`workers/repository/init/merge detectRepoFileConfig() returns config if not found 1`] = `Object {}`; - -exports[`workers/repository/init/merge detectRepoFileConfig() returns error if cannot parse 1`] = ` -Object { - "configFileName": "renovate.json", - "configFileParseError": Object { - "validationError": "Invalid JSON (parsing failed)", - "validationMessage": "Syntax error near cannot par", - }, -} -`; - -exports[`workers/repository/init/merge detectRepoFileConfig() throws error if duplicate keys 1`] = ` -Object { - "configFileName": ".renovaterc", - "configFileParseError": Object { - "validationError": "Duplicate keys in JSON", - "validationMessage": "\\"Syntax error: duplicated keys \\\\\\"enabled\\\\\\" near \\\\\\": false }\\"", - }, -} -`; - -exports[`workers/repository/init/merge detectRepoFileConfig() uses package.json config if found 1`] = ` -Object { - "configFileName": "package.json", - "configFileParsed": Object { - "prHourlyLimit": 10, - }, -} -`; - -exports[`workers/repository/init/merge detectRepoFileConfig() uses package.json config if found 2`] = ` -Object { - "configFileName": "package.json", - "configFileParsed": undefined, -} -`; - -exports[`workers/repository/init/merge mergeRenovateConfig() throws error if misconfigured 1`] = `[Error: config-validation]`; diff --git a/lib/workers/repository/init/index.spec.ts b/lib/workers/repository/init/index.spec.ts index 16b7e0bbe36987..d21970e174a77d 100644 --- a/lib/workers/repository/init/index.spec.ts +++ b/lib/workers/repository/init/index.spec.ts @@ -38,8 +38,7 @@ describe('workers/repository/init/index', () => { merge.mergeRenovateConfig.mockResolvedValueOnce({}); secrets.applySecretsToConfig.mockReturnValueOnce({} as never); const renovateConfig = await initRepo({}); - // FIXME: explicit assert condition - expect(renovateConfig).toMatchSnapshot(); + expect(renovateConfig).toEqual({}); }); it('warns on unsupported options', async () => { apis.initApis.mockResolvedValue({} as never); diff --git a/lib/workers/repository/init/merge.spec.ts b/lib/workers/repository/init/merge.spec.ts index 937ef640628ec3..fed851fe5f3440 100644 --- a/lib/workers/repository/init/merge.spec.ts +++ b/lib/workers/repository/init/merge.spec.ts @@ -41,8 +41,7 @@ describe('workers/repository/init/merge', () => { it('returns config if not found', async () => { git.getFileList.mockResolvedValue(['package.json']); fs.readLocalFile.mockResolvedValue('{}'); - // FIXME: explicit assert condition - expect(await detectRepoFileConfig()).toMatchSnapshot(); + expect(await detectRepoFileConfig()).toEqual({}); }); it('uses package.json config if found', async () => { git.getFileList.mockResolvedValue(['package.json']); @@ -54,9 +53,14 @@ describe('workers/repository/init/merge', () => { }); fs.readLocalFile.mockResolvedValue(pJson); platform.getJsonFile.mockResolvedValueOnce(pJson); - // FIXME: explicit assert condition - expect(await detectRepoFileConfig()).toMatchSnapshot(); - expect(await detectRepoFileConfig()).toMatchSnapshot(); + expect(await detectRepoFileConfig()).toEqual({ + configFileName: 'package.json', + configFileParsed: { prHourlyLimit: 10 }, + }); + expect(await detectRepoFileConfig()).toEqual({ + configFileName: 'package.json', + configFileParsed: undefined, + }); }); it('massages package.json renovate string', async () => { git.getFileList.mockResolvedValue(['package.json']); @@ -66,38 +70,45 @@ describe('workers/repository/init/merge', () => { }); fs.readLocalFile.mockResolvedValue(pJson); platform.getJsonFile.mockResolvedValueOnce(pJson); - expect(await detectRepoFileConfig()).toMatchInlineSnapshot(` - Object { - "configFileName": "package.json", - "configFileParsed": Object { - "extends": Array [ - "github>renovatebot/renovate", - ], - }, - } - `); + expect(await detectRepoFileConfig()).toEqual({ + configFileName: 'package.json', + configFileParsed: { extends: ['github>renovatebot/renovate'] }, + }); }); it('returns error if cannot parse', async () => { git.getFileList.mockResolvedValue(['package.json', 'renovate.json']); fs.readLocalFile.mockResolvedValue('cannot parse'); - // FIXME: explicit assert condition - expect(await detectRepoFileConfig()).toMatchSnapshot(); + expect(await detectRepoFileConfig()).toEqual({ + configFileName: 'renovate.json', + configFileParseError: { + validationError: 'Invalid JSON (parsing failed)', + validationMessage: 'Syntax error near cannot par', + }, + }); }); it('throws error if duplicate keys', async () => { git.getFileList.mockResolvedValue(['package.json', '.renovaterc']); fs.readLocalFile.mockResolvedValue( '{ "enabled": true, "enabled": false }' ); - // FIXME: explicit assert condition - expect(await detectRepoFileConfig()).toMatchSnapshot(); + expect(await detectRepoFileConfig()).toEqual({ + configFileName: '.renovaterc', + configFileParseError: { + validationError: 'Duplicate keys in JSON', + validationMessage: + '"Syntax error: duplicated keys \\"enabled\\" near \\": false }"', + }, + }); }); it('finds and parse renovate.json5', async () => { git.getFileList.mockResolvedValue(['package.json', 'renovate.json5']); fs.readLocalFile.mockResolvedValue(`{ // this is json5 format }`); - // FIXME: explicit assert condition - expect(await detectRepoFileConfig()).toMatchSnapshot(); + expect(await detectRepoFileConfig()).toEqual({ + configFileName: 'renovate.json5', + configFileParsed: {}, + }); }); it('finds .github/renovate.json', async () => { git.getFileList.mockResolvedValue([ @@ -105,8 +116,10 @@ describe('workers/repository/init/merge', () => { '.github/renovate.json', ]); fs.readLocalFile.mockResolvedValue('{}'); - // FIXME: explicit assert condition - expect(await detectRepoFileConfig()).toMatchSnapshot(); + expect(await detectRepoFileConfig()).toEqual({ + configFileName: '.github/renovate.json', + configFileParsed: {}, + }); }); it('finds .gitlab/renovate.json', async () => { git.getFileList.mockResolvedValue([ @@ -114,16 +127,25 @@ describe('workers/repository/init/merge', () => { '.gitlab/renovate.json', ]); fs.readLocalFile.mockResolvedValue('{}'); - // FIXME: explicit assert condition - expect(await detectRepoFileConfig()).toMatchSnapshot(); + expect(await detectRepoFileConfig()).toEqual({ + configFileName: '.gitlab/renovate.json', + configFileParsed: {}, + }); }); it('finds .renovaterc.json', async () => { git.getFileList.mockResolvedValue(['package.json', '.renovaterc.json']); fs.readLocalFile.mockResolvedValue('{}'); platform.getJsonFile.mockResolvedValueOnce('{"something":"new"}'); - // FIXME: explicit assert condition - expect(await detectRepoFileConfig()).toMatchSnapshot(); - expect(await detectRepoFileConfig()).toMatchSnapshot(); + expect(await detectRepoFileConfig()).toEqual({ + configFileName: '.renovaterc.json', + configFileParsed: {}, + }); + expect(await detectRepoFileConfig()).toMatchInlineSnapshot(` + Object { + "configFileName": ".renovaterc.json", + "configFileParsed": "{\\"something\\":\\"new\\"}", + } + `); }); }); describe('checkForRepoConfigError', () => { @@ -158,8 +180,7 @@ describe('workers/repository/init/merge', () => { e = err; } expect(e).toBeDefined(); - // FIXME: explicit assert condition - expect(e).toMatchSnapshot(); + expect(e.toString()).toEqual('Error: config-validation'); }); it('migrates nested config', async () => { git.getFileList.mockResolvedValue(['renovate.json']); diff --git a/lib/workers/repository/init/vulnerability.spec.ts b/lib/workers/repository/init/vulnerability.spec.ts index c894e046eb5d48..2bef7df68734d3 100644 --- a/lib/workers/repository/init/vulnerability.spec.ts +++ b/lib/workers/repository/init/vulnerability.spec.ts @@ -289,8 +289,16 @@ describe('workers/repository/init/vulnerability', () => { const res = await detectVulnerabilityAlerts(config); expect(res.packageRules).toMatchSnapshot(); expect(res.packageRules).toHaveLength(3); - // FIXME: explicit assert condition - expect(res.remediations).toMatchSnapshot(); + expect(res.remediations).toMatchSnapshot({ + 'backend/package-lock.json': [ + { + currentVersion: '1.8.2', + datasource: 'npm', + depName: 'electron', + newVersion: '1.8.3', + }, + ], + }); }); }); }); diff --git a/lib/workers/repository/onboarding/branch/__snapshots__/index.spec.ts.snap b/lib/workers/repository/onboarding/branch/__snapshots__/index.spec.ts.snap deleted file mode 100644 index b94efadcf3a66c..00000000000000 --- a/lib/workers/repository/onboarding/branch/__snapshots__/index.spec.ts.snap +++ /dev/null @@ -1,16 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`workers/repository/onboarding/branch/index checkOnboardingBranch has default onboarding config 1`] = ` -"{ - \\"$schema\\": \\"https://docs.renovatebot.com/renovate-schema.json\\" -} -" -`; - -exports[`workers/repository/onboarding/branch/index checkOnboardingBranch uses discovered onboarding config 1`] = ` -"{ - \\"$schema\\": \\"https://docs.renovatebot.com/renovate-schema.json\\", - \\"extends: [\\"some/renovate-config\\"] -} -" -`; diff --git a/lib/workers/repository/onboarding/branch/index.spec.ts b/lib/workers/repository/onboarding/branch/index.spec.ts index 08e7117d008bcb..233f9f69848662 100644 --- a/lib/workers/repository/onboarding/branch/index.spec.ts +++ b/lib/workers/repository/onboarding/branch/index.spec.ts @@ -71,10 +71,12 @@ describe('workers/repository/onboarding/branch/index', () => { git.getFileList.mockResolvedValue(['package.json']); fs.readLocalFile.mockResolvedValue('{}'); await checkOnboardingBranch(config); - // FIXME: explicit assert condition - expect( - git.commitFiles.mock.calls[0][0].files[0].contents - ).toMatchSnapshot(); + const contents = + git.commitFiles.mock.calls[0][0].files[0].contents?.toString(); + expect(contents).toBeJsonString(); + expect(JSON.parse(contents)).toEqual({ + $schema: 'https://docs.renovatebot.com/renovate-schema.json', + }); }); it('uses discovered onboarding config', async () => { configModule.getOnboardingConfig.mockResolvedValue({ @@ -83,7 +85,7 @@ describe('workers/repository/onboarding/branch/index', () => { configModule.getOnboardingConfigContents.mockResolvedValue( '{\n' + ' "$schema": "https://docs.renovatebot.com/renovate-schema.json",\n' + - ' "extends: ["some/renovate-config"]\n' + + ' "extends": ["some/renovate-config"]\n' + '}\n' ); git.getFileList.mockResolvedValue(['package.json']); @@ -98,10 +100,13 @@ describe('workers/repository/onboarding/branch/index', () => { }, configFileNames[0] ); - // FIXME: explicit assert condition - expect( - git.commitFiles.mock.calls[0][0].files[0].contents - ).toMatchSnapshot(); + const contents = + git.commitFiles.mock.calls[0][0].files[0].contents?.toString(); + expect(contents).toBeJsonString(); + expect(JSON.parse(contents)).toEqual({ + $schema: 'https://docs.renovatebot.com/renovate-schema.json', + extends: ['some/renovate-config'], + }); }); it('handles skipped onboarding combined with requireConfig = false', async () => { config.requireConfig = false; diff --git a/lib/workers/repository/onboarding/pr/__snapshots__/base-branch.spec.ts.snap b/lib/workers/repository/onboarding/pr/__snapshots__/base-branch.spec.ts.snap deleted file mode 100644 index c403cbb8b89076..00000000000000 --- a/lib/workers/repository/onboarding/pr/__snapshots__/base-branch.spec.ts.snap +++ /dev/null @@ -1,9 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`workers/repository/onboarding/pr/base-branch getBaseBranchDesc() describes baseBranch 1`] = ` -"You have configured Renovate to use branch \`some-branch\` as base branch. - -" -`; - -exports[`workers/repository/onboarding/pr/base-branch getBaseBranchDesc() describes baseBranches 1`] = `"You have configured Renovate to use the following baseBranches: \`some-branch\`, \`some-other-branch\`."`; diff --git a/lib/workers/repository/onboarding/pr/__snapshots__/config-description.spec.ts.snap b/lib/workers/repository/onboarding/pr/__snapshots__/config-description.spec.ts.snap index 6580a0b369f5a3..d8eaf6ade3ebbd 100644 --- a/lib/workers/repository/onboarding/pr/__snapshots__/config-description.spec.ts.snap +++ b/lib/workers/repository/onboarding/pr/__snapshots__/config-description.spec.ts.snap @@ -1,20 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`workers/repository/onboarding/pr/config-description getConfigDesc() assignees, labels and schedule 1`] = ` -" -### Configuration Summary - -Based on the default config's presets, Renovate will: - - - Start dependency updates only once this onboarding PR is merged - - Run Renovate on following schedule: before 5am - -🔡 Would you like to change the way Renovate is upgrading your dependencies? Simply edit the \`renovate.json\` in this branch with your custom config and the list of Pull Requests in the \\"What to Expect\\" section below will be updated the next time Renovate runs. - ---- -" -`; - exports[`workers/repository/onboarding/pr/config-description getConfigDesc() contains the onboardingConfigFileName if set 1`] = ` " ### Configuration Summary @@ -77,5 +62,3 @@ Based on the default config's presets, Renovate will: --- " `; - -exports[`workers/repository/onboarding/pr/config-description getConfigDesc() returns empty 1`] = `""`; diff --git a/lib/workers/repository/onboarding/pr/__snapshots__/errors-warnings.spec.ts.snap b/lib/workers/repository/onboarding/pr/__snapshots__/errors-warnings.spec.ts.snap deleted file mode 100644 index 0262a1986aaba4..00000000000000 --- a/lib/workers/repository/onboarding/pr/__snapshots__/errors-warnings.spec.ts.snap +++ /dev/null @@ -1,41 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`workers/repository/onboarding/pr/errors-warnings getDepWarnings() returns warning text 1`] = ` -" ---- - -### ⚠ Dependency Lookup Warnings ⚠ - -Please correct - or verify that you can safely ignore - these lookup failures before you merge this PR. - -- \`Warning 1\` -- \`Warning 2\` - -Files affected: \`package.json\`, \`backend/package.json\`, \`Dockerfile\` - -" -`; - -exports[`workers/repository/onboarding/pr/errors-warnings getErrors() returns error text 1`] = ` -" -# Errors (1) - -Renovate has found errors that you should fix (in this branch) before finishing this PR. - -- \`renovate.json\`: Failed to parse - ---- -" -`; - -exports[`workers/repository/onboarding/pr/errors-warnings getWarnings() returns warning text 1`] = ` -" -# Warnings (1) - -Please correct - or verify that you can safely ignore - these warnings before you merge this PR. - -- \`foo\`: Failed to look up dependency - ---- -" -`; diff --git a/lib/workers/repository/onboarding/pr/__snapshots__/pr-list.spec.ts.snap b/lib/workers/repository/onboarding/pr/__snapshots__/pr-list.spec.ts.snap deleted file mode 100644 index bc5336ad222400..00000000000000 --- a/lib/workers/repository/onboarding/pr/__snapshots__/pr-list.spec.ts.snap +++ /dev/null @@ -1,60 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`workers/repository/onboarding/pr/pr-list getPrList() handles empty 1`] = ` -" -### What to Expect - -It looks like your repository dependencies are already up-to-date and no Pull Requests will be necessary right away. -" -`; - -exports[`workers/repository/onboarding/pr/pr-list getPrList() handles multiple 1`] = ` -" -### What to Expect - -With your current configuration, Renovate will create 2 Pull Requests: - -
-Pin dependencies - - - Branch name: \`renovate/pin-dependencies\` - - Merge into: \`some-other\` - - Pin [a](https://a) to \`1.1.0\` - - Pin b to \`1.5.3\` - - -
- -
-Update a to v2 - - - Branch name: \`renovate/a-2.x\` - - Upgrade [a](https://a) to \`undefined\` - - -
- -
- -🚸 Branch creation will be limited to maximum 1 per hour, so it doesn't swamp any CI resources or spam the project. See docs for \`prhourlylimit\` for details. - -" -`; - -exports[`workers/repository/onboarding/pr/pr-list getPrList() has special lock file maintenance description 1`] = ` -" -### What to Expect - -With your current configuration, Renovate will create 1 Pull Request: - -
-Lock file maintenance - - - Schedule: [\\"before 5am\\"] - - Branch name: \`renovate/lock-file-maintenance\` - - Regenerate lock files to use latest dependency versions - -
- -" -`; diff --git a/lib/workers/repository/onboarding/pr/base-branch.spec.ts b/lib/workers/repository/onboarding/pr/base-branch.spec.ts index 220da0b7c7731f..f83123c863d8ba 100644 --- a/lib/workers/repository/onboarding/pr/base-branch.spec.ts +++ b/lib/workers/repository/onboarding/pr/base-branch.spec.ts @@ -16,14 +16,16 @@ describe('workers/repository/onboarding/pr/base-branch', () => { it('describes baseBranch', () => { config.baseBranches = ['some-branch']; const res = getBaseBranchDesc(config); - // FIXME: explicit assert condition - expect(res).toMatchSnapshot(); + expect(res.trim()).toEqual( + 'You have configured Renovate to use branch `some-branch` as base branch.' + ); }); it('describes baseBranches', () => { config.baseBranches = ['some-branch', 'some-other-branch']; const res = getBaseBranchDesc(config); - // FIXME: explicit assert condition - expect(res).toMatchSnapshot(); + expect(res.trim()).toEqual( + 'You have configured Renovate to use the following baseBranches: `some-branch`, `some-other-branch`.' + ); }); }); }); diff --git a/lib/workers/repository/onboarding/pr/config-description.spec.ts b/lib/workers/repository/onboarding/pr/config-description.spec.ts index 2229c6c4cc2ff8..76f8f5c1730d82 100644 --- a/lib/workers/repository/onboarding/pr/config-description.spec.ts +++ b/lib/workers/repository/onboarding/pr/config-description.spec.ts @@ -12,8 +12,7 @@ describe('workers/repository/onboarding/pr/config-description', () => { it('returns empty', () => { delete config.description; const res = getConfigDesc(config); - // FIXME: explicit assert condition - expect(res).toMatchSnapshot(); + expect(res).toEqual(''); }); it('returns a full list', () => { const packageFiles: Record = { @@ -37,8 +36,20 @@ describe('workers/repository/onboarding/pr/config-description', () => { config.labels = ['renovate', 'deps']; config.schedule = ['before 5am']; const res = getConfigDesc(config); - // FIXME: explicit assert condition - expect(res).toMatchSnapshot(); + expect(res).toMatchInlineSnapshot(` + " + ### Configuration Summary + + Based on the default config's presets, Renovate will: + + - Start dependency updates only once this onboarding PR is merged + - Run Renovate on following schedule: before 5am + + 🔡 Would you like to change the way Renovate is upgrading your dependencies? Simply edit the \`renovate.json\` in this branch with your custom config and the list of Pull Requests in the \\"What to Expect\\" section below will be updated the next time Renovate runs. + + --- + " + `); }); it('contains the onboardingConfigFileName if set', () => { delete config.description; diff --git a/lib/workers/repository/onboarding/pr/errors-warnings.spec.ts b/lib/workers/repository/onboarding/pr/errors-warnings.spec.ts index 7790cbd30704dd..4d04bfc461cdee 100644 --- a/lib/workers/repository/onboarding/pr/errors-warnings.spec.ts +++ b/lib/workers/repository/onboarding/pr/errors-warnings.spec.ts @@ -17,8 +17,17 @@ describe('workers/repository/onboarding/pr/errors-warnings', () => { }, ]; const res = getWarnings(config); - // FIXME: explicit assert condition - expect(res).toMatchSnapshot(); + expect(res).toMatchInlineSnapshot(` + " + # Warnings (1) + + Please correct - or verify that you can safely ignore - these warnings before you merge this PR. + + - \`foo\`: Failed to look up dependency + + --- + " + `); }); }); describe('getDepWarnings()', () => { @@ -58,8 +67,21 @@ describe('workers/repository/onboarding/pr/errors-warnings', () => { ], }; const res = getDepWarnings(packageFiles); - // FIXME: explicit assert condition - expect(res).toMatchSnapshot(); + expect(res).toMatchInlineSnapshot(` + " + --- + + ### ⚠ Dependency Lookup Warnings ⚠ + + Please correct - or verify that you can safely ignore - these lookup failures before you merge this PR. + + - \`Warning 1\` + - \`Warning 2\` + + Files affected: \`package.json\`, \`backend/package.json\`, \`Dockerfile\` + + " + `); }); }); describe('getErrors()', () => { @@ -76,8 +98,17 @@ describe('workers/repository/onboarding/pr/errors-warnings', () => { }, ]; const res = getErrors(config); - // FIXME: explicit assert condition - expect(res).toMatchSnapshot(); + expect(res).toMatchInlineSnapshot(` + " + # Errors (1) + + Renovate has found errors that you should fix (in this branch) before finishing this PR. + + - \`renovate.json\`: Failed to parse + + --- + " + `); }); }); }); diff --git a/lib/workers/repository/onboarding/pr/pr-list.spec.ts b/lib/workers/repository/onboarding/pr/pr-list.spec.ts index 7971514845a2ce..c0bef2c4d82603 100644 --- a/lib/workers/repository/onboarding/pr/pr-list.spec.ts +++ b/lib/workers/repository/onboarding/pr/pr-list.spec.ts @@ -12,8 +12,13 @@ describe('workers/repository/onboarding/pr/pr-list', () => { it('handles empty', () => { const branches: BranchConfig[] = []; const res = getPrList(config, branches); - // FIXME: explicit assert condition - expect(res).toMatchSnapshot(); + expect(res).toMatchInlineSnapshot(` + " + ### What to Expect + + It looks like your repository dependencies are already up-to-date and no Pull Requests will be necessary right away. + " + `); }); it('has special lock file maintenance description', () => { const branches = [ @@ -29,8 +34,23 @@ describe('workers/repository/onboarding/pr/pr-list', () => { }, ]; const res = getPrList(config, branches); - // FIXME: explicit assert condition - expect(res).toMatchSnapshot(); + expect(res).toMatchInlineSnapshot(` + " + ### What to Expect + + With your current configuration, Renovate will create 1 Pull Request: + +
+ Lock file maintenance + + - Schedule: [\\"before 5am\\"] + - Branch name: \`renovate/lock-file-maintenance\` + - Regenerate lock files to use latest dependency versions + +
+ + " + `); }); it('handles multiple', () => { const branches = [ @@ -70,8 +90,38 @@ describe('workers/repository/onboarding/pr/pr-list', () => { ]; config.prHourlyLimit = 1; const res = getPrList(config, branches); - // FIXME: explicit assert condition - expect(res).toMatchSnapshot(); + expect(res).toMatchInlineSnapshot(` + " + ### What to Expect + + With your current configuration, Renovate will create 2 Pull Requests: + +
+ Pin dependencies + + - Branch name: \`renovate/pin-dependencies\` + - Merge into: \`some-other\` + - Pin [a](https://a) to \`1.1.0\` + - Pin b to \`1.5.3\` + + +
+ +
+ Update a to v2 + + - Branch name: \`renovate/a-2.x\` + - Upgrade [a](https://a) to \`undefined\` + + +
+ +
+ + 🚸 Branch creation will be limited to maximum 1 per hour, so it doesn't swamp any CI resources or spam the project. See docs for \`prhourlylimit\` for details. + + " + `); }); }); }); diff --git a/lib/workers/repository/process/__snapshots__/deprecated.spec.ts.snap b/lib/workers/repository/process/__snapshots__/deprecated.spec.ts.snap deleted file mode 100644 index e30d27e02a7f8f..00000000000000 --- a/lib/workers/repository/process/__snapshots__/deprecated.spec.ts.snap +++ /dev/null @@ -1,23 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`workers/repository/process/deprecated raiseDeprecationWarnings() raises deprecation warnings 1`] = ` -Array [ - Array [ - Object { - "body": "foo is deprecated - -Affected package file(s): \`package.json\`, \`frontend/package.json\` - -If you don't care about this, you can close this issue and not be warned about \`foo\`'s deprecation again. If you would like to completely disable all future deprecation warnings then add the following to your config: - -\`\`\` -\\"suppressNotifications\\": [\\"deprecationWarningIssues\\"] -\`\`\` - -", - "once": true, - "title": "Dependency deprecation warning: foo (npm)", - }, - ], -] -`; diff --git a/lib/workers/repository/process/__snapshots__/extract-update.spec.ts.snap b/lib/workers/repository/process/__snapshots__/extract-update.spec.ts.snap deleted file mode 100644 index 2b515357e01873..00000000000000 --- a/lib/workers/repository/process/__snapshots__/extract-update.spec.ts.snap +++ /dev/null @@ -1,18 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`workers/repository/process/extract-update extract() runs with baseBranches 1`] = `undefined`; - -exports[`workers/repository/process/extract-update extract() runs with no baseBranches 1`] = ` -Object { - "branchList": Array [ - "branchName", - ], - "branches": Array [ - Object { - "branchName": "some-branch", - "upgrades": Array [], - }, - ], - "packageFiles": undefined, -} -`; diff --git a/lib/workers/repository/process/deprecated.spec.ts b/lib/workers/repository/process/deprecated.spec.ts index dd53179b765795..c9ca70c71537f3 100644 --- a/lib/workers/repository/process/deprecated.spec.ts +++ b/lib/workers/repository/process/deprecated.spec.ts @@ -59,8 +59,9 @@ describe('workers/repository/process/deprecated', () => { ]; platform.getIssueList.mockResolvedValue(mockIssue); await raiseDeprecationWarnings(config, packageFiles); - // FIXME: explicit assert condition - expect(platform.ensureIssue.mock.calls).toMatchSnapshot(); + expect(platform.ensureIssue.mock.calls).toMatchObject([ + [{ once: true, title: 'Dependency deprecation warning: foo (npm)' }], + ]); expect(platform.getIssueList).toHaveBeenCalledTimes(1); expect(platform.ensureIssue).toHaveBeenCalledTimes(1); }); diff --git a/lib/workers/repository/process/extract-update.spec.ts b/lib/workers/repository/process/extract-update.spec.ts index daa9840aadff9a..bd50bd1f76d168 100644 --- a/lib/workers/repository/process/extract-update.spec.ts +++ b/lib/workers/repository/process/extract-update.spec.ts @@ -32,8 +32,16 @@ describe('workers/repository/process/extract-update', () => { git.checkoutBranch.mockResolvedValueOnce('123test'); const packageFiles = await extract(config); const res = await lookup(config, packageFiles); - // FIXME: explicit assert condition - expect(res).toMatchSnapshot(); + expect(res).toEqual({ + branchList: ['branchName'], + branches: [ + { + branchName: 'some-branch', + upgrades: [], + }, + ], + packageFiles: undefined, + }); await expect(update(config, res.branches)).resolves.not.toThrow(); }); it('runs with baseBranches', async () => { @@ -45,8 +53,7 @@ describe('workers/repository/process/extract-update', () => { git.checkoutBranch.mockResolvedValueOnce('123test'); repositoryCache.getCache.mockReturnValueOnce({ scan: {} }); const packageFiles = await extract(config); - // FIXME: explicit assert condition - expect(packageFiles).toMatchSnapshot(); + expect(packageFiles).toBeUndefined(); }); it('uses repository cache', async () => { const packageFiles: Record = {};