Skip to content

Commit

Permalink
Merge pull request #292 from lo1tuma/no-skipped
Browse files Browse the repository at this point in the history
Improve no-skipped performance
  • Loading branch information
lo1tuma committed May 26, 2021
2 parents 8634d89 + acf31a0 commit d830482
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions benchmarks/runtime.bench.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function lintManyFilesWithAllRecommendedRules({ numberOfFiles }) {
describe('runtime', () => {
it('should not take longer as the defined budget to lint many files with the recommended config', () => {
const nodeVersionMultiplier = getNodeVersionMultiplier();
const budget = 3500000 / cpuSpeed * nodeVersionMultiplier;
const budget = 3750000 / cpuSpeed * nodeVersionMultiplier;

const { medianDuration } = runBenchmark(() => {
lintManyFilesWithAllRecommendedRules({ numberOfFiles: 350 });
Expand All @@ -102,7 +102,7 @@ describe('runtime', () => {
});

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

const { medianMemory } = runBenchmark(() => {
lintManyFilesWithAllRecommendedRules({ numberOfFiles: 350 });
Expand Down
12 changes: 8 additions & 4 deletions lib/rules/no-skipped-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ module.exports = {
},
create(context) {
const astUtils = createAstUtils(context.settings);
const options = { modifiers: [ 'skip' ], modifiersOnly: true };
const isTestCase = astUtils.buildIsTestCaseAnswerer(options);
const isDescribe = astUtils.buildIsDescribeAnswerer(options);

return {
CallExpression(node) {
const options = { modifiers: [ 'skip' ], modifiersOnly: true };

if (astUtils.isDescribe(node, options) || astUtils.isTestCase(node, options)) {
if (isDescribe(node) || isTestCase(node)) {
const callee = node.callee;
const nodeToReport = callee.type === 'MemberExpression' ? callee.property : callee;
const nodeToReport =
callee.type === 'MemberExpression' ?
callee.property :
callee;

context.report({
node: nodeToReport,
Expand Down

0 comments on commit d830482

Please sign in to comment.