Prevent imported modules of a mocked file to be included in Module Graph #7091
Unanswered
pll-skytech
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Can you provide a reproduction? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am struggling to optimise some of my tests and can't seem to find any solution to my problem. Here is a simplification:
I have fileA.tsx that
imports { x } from 'path/fileB'
and in the test file i usevi.mock('path/fileB', () => ({ x: vi.fn() })
.But i dont understand why in vitest UI Module Graph i see all the nested imports of fileB (it has a few imports that imports other things so i end up with a quite big graph for nothing)... Is there a way i can tell vitest that it should not import any code from fileB since it will be mocked and i do not need any code from it ?
Thanks for any help!
Beta Was this translation helpful? Give feedback.
All reactions