Skip to content

Conversation

RobinTail
Copy link
Contributor

@RobinTail RobinTail commented Aug 10, 2024

RFC: https://github.com/eslint/rfcs/tree/main/designs/2024-hooks-for-test-cases

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 autofix to a rule
[ ] Add a CLI option
[X] Add something to the core
[ ] Other, please explain:

Closes #18770 — Developers can mock the environment right within the test cases instead of maintaining fixture files on disk.

What changes did you make? (Give an overview)

  • added setup property to the test case (both valid and invalid);
    • the prop is optional and the change is backwards compatible;
  • if the setup is present:
    • when assigned with a function, then it calls that function before testing the case;
    • otherwise throws;
  • added tests for both scenarios;
  • listed the new property in the documentation;

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

@eslint-github-bot eslint-github-bot bot added the feature This change adds a new feature to ESLint label Aug 10, 2024
Copy link

linux-foundation-easycla bot commented Aug 10, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@github-actions github-actions bot added the core Relates to ESLint's core APIs and features label Aug 10, 2024
Copy link

netlify bot commented Aug 10, 2024

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit 7de4296
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/66f3136ad236a5000882a674

@RobinTail RobinTail marked this pull request as ready for review August 10, 2024 23:39
@RobinTail RobinTail requested a review from a team as a code owner August 10, 2024 23:39
@RobinTail
Copy link
Contributor Author

Did my best — it's a small but powerful change, should be a nice improvement.
Please review.

@nzakas nzakas marked this pull request as draft August 12, 2024 14:37
Copy link

Hi everyone, it looks like we lost track of this pull request. Please review and see what the next steps are. This pull request will auto-close in 7 days without an update.

@github-actions github-actions bot added the Stale label Aug 22, 2024
@fasttime fasttime assigned fasttime and RobinTail and unassigned fasttime Aug 23, 2024
@fasttime fasttime removed the Stale label Aug 23, 2024
@fasttime
Copy link
Member

Not stale, pending RFC eslint/rfcs#122.

@RobinTail RobinTail changed the title feat: setup option for a test case (RuleTester) feat: Hooks for test cases (RuleTester) Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accepted There is consensus among the team that this change meets the criteria for inclusion contributor pool core Relates to ESLint's core APIs and features feature This change adds a new feature to ESLint

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

RuleTester feature: setup for test cases

5 participants