diff --git a/package.json b/package.json index 96c5cbd717da3b79dd9c3dc688b6f70dd345f93e..581568ae5715c5b3059e2faecc4b13ee2d48dee6 100644 --- a/package.json +++ b/package.json @@ -138,7 +138,8 @@ "setupFiles": [ "./test/globals.js" ], - "setupTestFrameworkScriptFile": "./test/chai.js" + "setupTestFrameworkScriptFile": "./test/chai.js", + "snapshotSerializers": ["./test/newline-snapshot-serializer.js"] }, "prettier": { "singleQuote": true, diff --git a/test/config/__snapshots__/index.spec.js.snap b/test/config/__snapshots__/index.spec.js.snap index 9e6bbef6554cb70fa6dcc565cd1a66b404d6bbb6..44bd2905ca72e719f2429ee000deadea897a2bad 100644 --- a/test/config/__snapshots__/index.spec.js.snap +++ b/test/config/__snapshots__/index.spec.js.snap @@ -6,37 +6,7 @@ Object { "commitMessage": "Update lock file", "enabled": false, "groupName": null, - "prBody": "This Pull Request updates \`package.json\` lock files to use the latest dependency versions. - -{{#if schedule}} -**Note**: This PR was created on a configured schedule (\\"{{{schedule}}}\\"{{#if timezone}} in timezone \`{{{timezone}}}\`{{/if}}) and will not receive updates outside those times. -{{/if}} - -{{#if hasErrors}} - ---- - -# Errors - -Renovate encountered some errors when processing your repository, so you are being notified here even if they do not directly apply to this PR. - -{{#each errors as |error|}} -- \`{{error.depName}}\`: {{error.message}} -{{/each}} -{{/if}} - -{{#if hasWarnings}} - ---- - -# Warnings - -Please make sure the following warnings are safe to ignore: - -{{#each warnings as |warning|}} -- \`{{warning.depName}}\`: {{warning.message}} -{{/each}} -{{/if}}", + "prBody": "This Pull Request updates \`package.json\` lock files to use the latest dependency versions.\\n\\n{{#if schedule}}\\n**Note**: This PR was created on a configured schedule (\\"{{{schedule}}}\\"{{#if timezone}} in timezone \`{{{timezone}}}\`{{/if}}) and will not receive updates outside those times.\\n{{/if}}\\n\\n{{#if hasErrors}}\\n\\n---\\n\\n# Errors\\n\\nRenovate encountered some errors when processing your repository, so you are being notified here even if they do not directly apply to this PR.\\n\\n{{#each errors as |error|}}\\n- \`{{error.depName}}\`: {{error.message}}\\n{{/each}}\\n{{/if}}\\n\\n{{#if hasWarnings}}\\n\\n---\\n\\n# Warnings\\n\\nPlease make sure the following warnings are safe to ignore:\\n\\n{{#each warnings as |warning|}}\\n- \`{{warning.depName}}\`: {{warning.message}}\\n{{/each}}\\n{{/if}}", "prTitle": "Lock file maintenance", "rebaseStalePrs": true, "recreateClosed": true, diff --git a/test/newline-snapshot-serializer.js b/test/newline-snapshot-serializer.js new file mode 100644 index 0000000000000000000000000000000000000000..952af90d3e2e61c4068cf8b98723dcfdea09cacf --- /dev/null +++ b/test/newline-snapshot-serializer.js @@ -0,0 +1,15 @@ +let prev; + +module.exports = { + print(val) { + return JSON.stringify(val); + }, + + test(val) { + if (['prBody', 'prTitle'].some(str => str === prev)) { + return typeof val === 'string' && val.indexOf('\n') > -1; + } + prev = val; + return false; + }, +};