You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import*as_from"lodash";exportfunctionfindGrouping(fruits: string[]){const groups =_(fruits).groupBy((fruitName)=>`FRUIT_${fruitName.substring(0,1)}`,);returngroups.value();}
And I have a test (findGroupings.uspec.ts):
import{findGrouping}from"./findGrouping";describe("findGrouping",()=>{it("returns a grouping",()=>{constgroup=findGrouping(["apple","banana","aorange"]);expect(group).toMatchObject({FRUIT_a: ["apple","aorange"],FRUIT_b: ["banana"],});});});
When I run the test with @swc/jest as the transform. I get an error TypeError: _lodash is not a function. But when I run it with ts-jest as the transform I don't get any error and the test passes.
Sandbox: https://codesandbox.io/p/devbox/pt3dqy
Let's say I have a file (findGroupings.ts):
And I have a test (findGroupings.uspec.ts):
When I run the test with
@swc/jest
as the transform. I get an errorTypeError: _lodash is not a function
. But when I run it withts-jest
as the transform I don't get any error and the test passes.Here's my .swcrc
Here's my tsconfig
Am I doing something wrong? Or is this a known issue? I don't know why the tests passes with ts-jest but not @swc/jest
The text was updated successfully, but these errors were encountered: