Mocking namespace import function #1993
-
Hello fellow Vitesters! I was hoping you'd be able to help me out with a specific situation. I'm using this namespace import of a function in my code: import * as walkdir from 'walkdir';
walkdir('some-directory'); And I'm trying to mock this
So I'm hoping someone here has some insight in how I can make it work. Am I missing something silly? Doing someting else wrong? Is this perhaps just not supported? Thanks in advance for the help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
In ESM |
Beta Was this translation helpful? Give feedback.
In ESM
import * as walkdir
always returns an object, so it's impossible to call it. Are you sure you don't want to calldefault
export?