mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 22:46:27 +00:00
chore: squash template fields in config log serializer
This commit is contained in:
parent
372b445260
commit
c4dcad7de8
3 changed files with 20 additions and 0 deletions
|
@ -5,6 +5,7 @@ module.exports = configSerializer;
|
||||||
function configSerializer(config) {
|
function configSerializer(config) {
|
||||||
const redactedFields = ['token', 'githubAppKey'];
|
const redactedFields = ['token', 'githubAppKey'];
|
||||||
const functionFields = ['api', 'logger'];
|
const functionFields = ['api', 'logger'];
|
||||||
|
const templateFields = ['commitMessage', 'prTitle', 'prBody'];
|
||||||
// eslint-disable-next-line array-callback-return
|
// eslint-disable-next-line array-callback-return
|
||||||
return traverse(config).map(function scrub(val) {
|
return traverse(config).map(function scrub(val) {
|
||||||
if (val && redactedFields.indexOf(this.key) !== -1) {
|
if (val && redactedFields.indexOf(this.key) !== -1) {
|
||||||
|
@ -13,5 +14,8 @@ function configSerializer(config) {
|
||||||
if (val && functionFields.indexOf(this.key) !== -1) {
|
if (val && functionFields.indexOf(this.key) !== -1) {
|
||||||
this.update('[Function]');
|
this.update('[Function]');
|
||||||
}
|
}
|
||||||
|
if (val && templateFields.indexOf(this.key) !== -1) {
|
||||||
|
this.update('[Template]');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,3 +15,11 @@ Object {
|
||||||
"nottoken": "b",
|
"nottoken": "b",
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`logger/config-serializer squashes templates 1`] = `
|
||||||
|
Object {
|
||||||
|
"api": "[Function]",
|
||||||
|
"nottoken": "b",
|
||||||
|
"prBody": "[Template]",
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
|
@ -17,4 +17,12 @@ describe('logger/config-serializer', () => {
|
||||||
};
|
};
|
||||||
expect(configSerializer(config)).toMatchSnapshot();
|
expect(configSerializer(config)).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
it('squashes templates', () => {
|
||||||
|
const config = {
|
||||||
|
api: 'a',
|
||||||
|
nottoken: 'b',
|
||||||
|
prBody: 'foo',
|
||||||
|
};
|
||||||
|
expect(configSerializer(config)).toMatchSnapshot();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue