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

feat: no-hook-expect #34

Open
codejedi365 opened this issue Nov 13, 2021 · 0 comments
Open

feat: no-hook-expect #34

codejedi365 opened this issue Nov 13, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@codejedi365
Copy link
Collaborator

codejedi365 commented Nov 13, 2021

Feature Request

Add a lint rule to help prevent the use of t.expect() in a before or after hook function

Problem

It is too easy to add an expect into a before hook as both a test and a before hook use the TestController as a base object. It is frustrating to teach new members to the project proper testing form and it could be easily prevented.

The goal would be to create a lint error that would notify the developer inside of their IDE or at least flag on lint so it can be identified before pushed into source control.

Expected behavior

// page.test.js - invalid code example
test.before( async (t) => {
  await t.expect(foo).ok()
})("test", async (t) => {
  await t.expect(true).ok()
})
eslint ./tests/page.test.js

Should return an error on line 3, highlighting the expect(foo).

@codejedi365 codejedi365 added the enhancement New feature or request label Nov 13, 2021
@codejedi365 codejedi365 self-assigned this Nov 13, 2021
@codejedi365 codejedi365 changed the title FEAT: no-hook-expect feat: no-hook-expect Nov 13, 2021
@codejedi365 codejedi365 changed the title feat: no-hook-expect feat: no-hook-expect Nov 13, 2021
@codejedi365 codejedi365 added the good first issue Good for newcomers label Nov 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant