question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider splitting out a generalized testing plugin

See original GitHub issue

Hi! I’m a big fan of this plugin and have been using it for a while. But I recently switched some projects to Vitest and not all the rules in this plugin apply quite the same in Vitest (e.g. no-jasmine-globals).

eslint-plugin-vitest exists, with some duplication of rule logic. It’s much newer, though, and has fewer rules implemented & a much smaller commmunity.

What do you think about us extracting out the rules from these two plugins into a shared plugin, like eslint-plugin-tests, that’s meant to work for the common style of testing libraries in JS/TS today? I’m a maintainer on typescript-eslint and am confident I can help or lead this if you want. 😄

cc @veritem from eslint-plugin-vitest 👋

Issue Analytics

  • State:open
  • Created 10 months ago
  • Reactions:2
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
G-Rathcommented, Nov 18, 2022

So I’ve thought about this in the past (especially when I started being involved in maintaining eslint-plugin-jest-dom, among other things), and overall came the conclusion that while it seems like a really good and useful idea on the face, in practice there’s not a whole lot of gain vs the huge potential complexities because of how different core features can be handled in testing frameworks, and that rules typically stabilize very quickly so I wouldn’t expect you would need to be sinking a lot of effort into keeping a copied rule up to date.

This has also been the reason why I’ve not pulled the utilities out into their own package*, because while they look like they’d be useful across a bunch of plugins, everyone has a slightly different implementations which would mean having to get buy-in from the plugin maintainers to potentially refactor their rules heavily, when their existing implementations work fine and generally have a low footprint so it doesn’t feel like there’s a strong enough gain to be worth the effort it’ll require…

So yeah, for me whenever I’ve thought about this I’ve ended up at “this feels like a lot of work for something that doesn’t really fix anything that’s broken”

*: this will probably happen at some point for parseJestFn and friends because eslint-plugin-jest, eslint-plugin-jest-dom, and eslint-plugin-jest-extended should all be resolving jest functions with that, but I’ve got to review eslint-plugin-jest-dom first as that currently uses selectors very heavily.

0reactions
mrazauskascommented, Nov 18, 2022

Programmatic API would be harder to implement, but it would allow more flexibility. For example, "no-deprecated-functions" rule could be build on top of shared logic using framework specific list of deprecated APIs; or having custom rule name would be useful for "jest/no-restricted-jest-methods" and "vitest/no-restricted-vitest-methods" (can be this one is not yet implemented).

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Split JUnit Tests in a Continuous Integration Environment
A first step in splitting our tests is to examine their execution speed. Plain unit tests, that depend only on Java code, usually...
Read more >
11 Best Tools for A/B Split Testing in WordPress - WPMU Dev
That's plenty reason to use split tests, don't you think? ... Another plugin you should check out is called Marketizator, which is designed ......
Read more >
Split unit and integration tests - The Worldline engineering Blog
Many way exist to separate properly the unit tests an the integration tests. But actually how to do it and what are the...
Read more >
10+ Best A/B Split Testing Tools for WordPress to Improve ...
Use these A/B split testing tools and plugins for WordPress to track and improve your website conversion rates and increase revenue.
Read more >
How to Start Split Testing on Your Landing Pages Using Free ...
If you're using Thrive Architect, here's a simple, free way to start split testing your pages and increase your conversions. Check it out....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found