Skip to content

Add no-only-tests JS linter rule to detect test.only and suite.only #132

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

Merged
merged 4 commits into from
Aug 11, 2021

Conversation

pablonete
Copy link
Contributor

@pablonete pablonete commented Aug 9, 2021

This warns on leftovers like suite.only or test.only that would prevent all JS tests from running in CI.

Adding a dependency on this plugin: https://www.npmjs.com/package/eslint-plugin-no-only-tests
It meets the "LAWSUIT" external library criteria:

  • Licensing: MIT licensed
  • Actively-developed: Latest commit 1 month ago, on June 17th
  • Widely-used: 107,289 weekly downloads
  • Supply chain safety: only dependency is "eslint"
  • Unique functionality: Yes
  • Install time impact + bundle size impact: Dev-time linter, no production impact.
  • TypeScript support: this doesn't apply to an eslint plugin.

By default, the library doesn't check suite, so I had to change the default value of block by adding it to the default values:

"block": ["describe", "it", "context", "test", "tape", "fixture", "serial", "suite"]

Tested with npm link successfully:
image

Note: I wasn't able to get npm link to work in Codespaces, I had to use my laptop. I got:
npm was not found in PATH outside of this project
I suspect it's due to npm not being installed in the dotcom Codespace, and even using the bin/npm in the $PATH didn't help.

@pablonete pablonete requested a review from a team as a code owner August 9, 2021 10:10
@pablonete pablonete requested a review from koddsson August 10, 2021 07:36
@JoseInTheArena JoseInTheArena requested review from srt32 and removed request for dgreif August 10, 2021 20:41
Copy link
Contributor

@koddsson koddsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Thank you ❤️

@koddsson koddsson merged commit f972b69 into github:main Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants