Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New: Add only to RuleTester (refs eslint/rfcs#73) #14677

Merged
merged 5 commits into from Jun 18, 2021
Merged

New: Add only to RuleTester (refs eslint/rfcs#73) #14677

merged 5 commits into from Jun 18, 2021

Conversation

@btmills
Copy link
Member

@btmills btmills commented Jun 6, 2021

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[x] Add something to the core
[ ] Other, please explain:

What changes did you make? (Give an overview)

This implements RFC73. RuleTester test cases support a new only property to run an individual case or subset of cases for less noisy debugging. We do not implement test exclusivity inside RuleTester, instead relying on the test framework to provide that functionality when we call only().

Is there anything you'd like reviewers to focus on?

  1. I made one change from the RFC. Under Detailed Design, step 3, I inserted a new sub-step between i and ii: "If RuleTester[IT] is set and has an only function property, return Function.bind.call(this[IT].only, this[IT])." For users who customize RuleTester.it, this could make only work without any additional configuration, but if their overridden it has an only function property with different semanticts than Mocha's, this step wouldn't work. Are we okay with this change?
  2. Because the RuleTester tests override RuleTester.it and RuleTester.only, testing the itOnly getter was complex.
@mdjermanovic
Copy link
Member

@mdjermanovic mdjermanovic commented Jun 14, 2021

  1. I made one change from the RFC. Under Detailed Design, step 3, I inserted a new sub-step between i and ii: "If RuleTester[IT] is set and has an only function property, return Function.bind.call(this[IT].only, this[IT])." For users who customize RuleTester.it, this could make only work without any additional configuration, but if their overridden it has an only function property with different semanticts than Mocha's, this step wouldn't work. Are we okay with this change?

Makes sense to me, some customizations might "just work". If it doesn't work by itself, they can override RuleTester.itOnly.

tests/lib/rule-tester/rule-tester.js Outdated Show resolved Hide resolved
tests/lib/rule-tester/rule-tester.js Outdated Show resolved Hide resolved
Copy link
Member

@mdjermanovic mdjermanovic left a comment

LGTM, great work!

We can revisit the use of this in static accessors later.

btmills and others added 4 commits Jun 18, 2021
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Co-authored-by: 薛定谔的猫 <weiran.zsd@outlook.com>
Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
@btmills btmills merged commit bfbfe5c into master Jun 18, 2021
14 checks passed
14 checks passed
@github-actions
Verify Files
Details
@github-actions
Test (ubuntu-latest, 16.x)
Details
@github-actions
Test (ubuntu-latest, 15.x)
Details
@github-actions
Test (ubuntu-latest, 14.x)
Details
@github-actions
Test (ubuntu-latest, 13.x)
Details
@github-actions
Test (ubuntu-latest, 12.x)
Details
@github-actions
Test (ubuntu-latest, 10.x)
Details
@github-actions
Test (ubuntu-latest, 10.12.0)
Details
@github-actions
Test (windows-latest, 12.x)
Details
@github-actions
Test (macOS-latest, 12.x)
Details
@github-actions
Browser Test
Details
@eslint-github-bot
commit-message PR title follows commit message guidelines
Details
licence/cla Contributor License Agreement is signed.
Details
@eslint-github-bot
release-monitor No patch release is pending
Details
@btmills btmills deleted the rfc73 branch Jun 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants