refactor(core): Remove skipped telemetry tests (no-changelog) (#10319)

This commit is contained in:
Iván Ovejero
2024-08-07 15:11:22 +02:00
committed by GitHub
parent 171173c7e8
commit b232831f18
3 changed files with 14 additions and 163 deletions

View File

@@ -182,12 +182,14 @@ module.exports = {
messages: {
removeSkip: 'Remove `.skip()` call',
removeOnly: 'Remove `.only()` call',
removeXPrefix: 'Remove `x` prefix',
},
fixable: 'code',
},
create(context) {
const TESTING_FUNCTIONS = new Set(['test', 'it', 'describe']);
const SKIPPING_METHODS = new Set(['skip', 'only']);
const PREFIXED_TESTING_FUNCTIONS = new Set(['xtest', 'xit', 'xdescribe']);
const toMessageId = (s) => 'remove' + s.charAt(0).toUpperCase() + s.slice(1);
return {
@@ -208,6 +210,18 @@ module.exports = {
});
}
},
CallExpression(node) {
if (
node.callee.type === 'Identifier' &&
PREFIXED_TESTING_FUNCTIONS.has(node.callee.name)
) {
context.report({
messageId: 'removeXPrefix',
node,
fix: (fixer) => fixer.replaceText(node.callee, 'test'),
});
}
},
};
},
},