Skip to content

Commit acf31a0

Browse files
committed
Improve no-skipped performance
1 parent 8634d89 commit acf31a0

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

benchmarks/runtime.bench.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ function lintManyFilesWithAllRecommendedRules({ numberOfFiles }) {
9292
describe('runtime', () => {
9393
it('should not take longer as the defined budget to lint many files with the recommended config', () => {
9494
const nodeVersionMultiplier = getNodeVersionMultiplier();
95-
const budget = 3500000 / cpuSpeed * nodeVersionMultiplier;
95+
const budget = 3750000 / cpuSpeed * nodeVersionMultiplier;
9696

9797
const { medianDuration } = runBenchmark(() => {
9898
lintManyFilesWithAllRecommendedRules({ numberOfFiles: 350 });
@@ -102,7 +102,7 @@ describe('runtime', () => {
102102
});
103103

104104
it('should not consume more memory as the defined budget to lint many files with the recommended config', () => {
105-
const budget = 2500000;
105+
const budget = 2750000;
106106

107107
const { medianMemory } = runBenchmark(() => {
108108
lintManyFilesWithAllRecommendedRules({ numberOfFiles: 350 });

lib/rules/no-skipped-tests.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,18 @@ module.exports = {
1111
},
1212
create(context) {
1313
const astUtils = createAstUtils(context.settings);
14+
const options = { modifiers: [ 'skip' ], modifiersOnly: true };
15+
const isTestCase = astUtils.buildIsTestCaseAnswerer(options);
16+
const isDescribe = astUtils.buildIsDescribeAnswerer(options);
1417

1518
return {
1619
CallExpression(node) {
17-
const options = { modifiers: [ 'skip' ], modifiersOnly: true };
18-
19-
if (astUtils.isDescribe(node, options) || astUtils.isTestCase(node, options)) {
20+
if (isDescribe(node) || isTestCase(node)) {
2021
const callee = node.callee;
21-
const nodeToReport = callee.type === 'MemberExpression' ? callee.property : callee;
22+
const nodeToReport =
23+
callee.type === 'MemberExpression' ?
24+
callee.property :
25+
callee;
2226

2327
context.report({
2428
node: nodeToReport,

0 commit comments

Comments
 (0)