Comments (7)
I have no interest in maintaining a comparison table (or changing default behaviour). But an option to allow people to mix and match seems fine as long as we state no compat promises are made
from eslint-plugin-jest.
I don't wanna hard code in bun
stuff, but happy to take a PR that makes @jest/globals
as import source configurable.
A caveat is that there's no guarantee the semantics this plugin assumes holds when using bun
instead (I've not used it at all, and I didn't know it lifted its test API from Jest). But yeah, making the import name configurable seems reasonable to me regardless 🙂
from eslint-plugin-jest.
what the bun test runner does is trying to be a drop-in replacement for jest & vitest; so even if you have an import from @jest/globals
, if you run the test with bun, it will swap it out internally. Same for vitest.
but happy to take a PR that makes @jest/globals as import source configurable.
thank you, I'll try to take a stab it at. Am I assuming correctly that '@jest/globals'
should be the default for that option, and that it should be an Array of strings? Or is a single string resource enough (I would guess it is ..)
from eslint-plugin-jest.
I'm not too thrilled about this because we're meant to be just for Jest but I guess supporting a setting for it wouldn't hurt though
even if you have an import from @jest/globals, if you run the test with bun, it will swap it out internally
Doesn't that mean you can just import from @jest/globals
and everything will work? in my eyes that's better anyway because you're saying "I want the Jest API" - the fact that Bun provides its own Jest-API-compatible module is an implementation detail.
I'd also be interested in hearing from @JoshuaKGoldberg on if this would help with #1289 - my understanding is vitest is also meant to be a drop-in replacement for Jest so in theory this new setting should help but they're already reported that not all rules are 1:1 compatible
from eslint-plugin-jest.
Doesn't that mean you can just import from @jest/globals and everything will work? in my eyes that's better anyway because you're saying "I want the Jest API" - the fact that Bun provides its own Jest-API-compatible module is an implementation detail.
Yes, you can, but then we'd need an additional dependency on @jest/globals
and add the types as well. I don't really prefer the "interop mode". I also think that some rules are not really jest specific, like no-focused-tests
is something I definitely need no matter the test framework to avoid accidentally committing a test I had focussed on during development.
the suggested eslint-plugin-tests
sounds very interesting in that regard.
I'm not too thrilled about this because we're meant to be just for Jest but I guess supporting a setting for it wouldn't hurt though
I can totally live with the patch we have right now, so let's take the time to settle on the right solution before introducing a new api :)
from eslint-plugin-jest.
I'd also be interested in hearing from @JoshuaKGoldberg on if this would help with #1289
Yeah that'd be great 😄 but for the mentioned caveats that the various testing libraries are all at least a little different from each other. Maybe it'd be useful to have a big comparison table of all the differences & similarities? (not volunteering myself, sorry)
from eslint-plugin-jest.
Related Issues (20)
- Add rule to check placement of jest.setTimeout HOT 3
- Add a rules to help with the `.toMatchNamedSnapshot()` matcher usage HOT 3
- Feature request: add rule that prevents jest methods being used in files that do not end with .spec.js / spec.js HOT 1
- Unknown package installing eslint-plugin-jest HOT 2
- [valid-expect] `minmum` is perhaps `maxmum` HOT 4
- [`require-hook`] Add option to allow class calls HOT 2
- [valid-title] static class string name property not allowed HOT 1
- Plugin is preventing upgrades to `@typescript-eslint` packages HOT 5
- Support ESLint "flat" configs HOT 8
- Feature Request: Extend ESLint Plugin Jest for Custom Test and Describe Function Recognition HOT 3
- New rule to prevent to use `expect(query*(...)).toBeDefined();` HOT 2
- New rule to forbid to use `expect(find*(...)).toBeTruthy();` HOT 2
- eslint-plugin-node is obsolete HOT 1
- `no-focused-tests` should highlight only `fit` and `fdescribe` instead of the whole thing HOT 4
- Feature: Generate typings for rules etc. HOT 4
- [new-rule] Force to use `jest.mocked(fn)` instead of `fn as jest.Mock` HOT 2
- Results of weekly scheduled smoke test HOT 5
- [expect-expect and no-standalone-expect] `additionalTestBlockFunctions` does not recognize `test.each`-like functions HOT 3
- [no-test-return-statement] does not trigger for arrow functions without a body HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eslint-plugin-jest.