-
Notifications
You must be signed in to change notification settings - Fork 241
Closed
Labels
Description
bun had a 1.0 release recently, and a lot of things from its test runner work like jest. Mostly, it's a drop-in replacement to do:
- import { describe, expect, it } from '@jest/globals'
+ import { describe, expect, it } from 'bun:test'
however, changing the import like that makes the eslint-plugin-jest
no longer work, because the rules only apply to imports from '@jest/globals'
, as we can see here:
eslint-plugin-jest/src/rules/utils/parseJestFnCall.ts
Lines 567 to 569 in 1b96756
// the identifier is imported from @jest/globals, | |
// so return the original import name | |
if (maybeImport.source === '@jest/globals') { |
We are currently patching this plugin to also detect bun imports by extending this if statement:
if (maybeImport.source === '@jest/globals' || maybeImport.source === 'bun:test') {
I'd be happy to hear your thoughts on making this work either out of the box, or making it configurable. I'm also up for contributing a PR.
Thanks 🙏