-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: i is not a function #2092
Comments
|
Two things:
|
cannot reproduce
Agree
Stacktrace leads to internal implementations - we hide those, because otherwise throwing in a test will be bloated. |
Maybe it's not reproducible with TS, but it is reproducible with JS.
can you clarify? From a debugging perspective, if something went wrong while invoking |
If something on your side is going wrong, you will see a stack trace to your code. Here the problem is with Vitest internals, so you don't see an error. |
This is definitely reproducible with TS. I hit the issue in converting a JS-based test to TS. What tripped me up was the Migration guide's recommendation for a |
Same problem here I think this is hinted at in the docs: Awaitable.
To be more clear works
doesn't
probably because of the cleanup function
So I guess Awaitable is either a promise wrapping a function or nothing? Probably should check if the returned value is a function before it says incoherent things like "TypeError: i is not a function" |
Thanks @sheremet-va! |
Describe the bug
Test fails with error message
TypeError: i is not a function
, and there is no stack trace displayed.It appears the error is caused when a callback to a hook function (like
beforeEach
,beforeAll
) returns certain data types, like an array:Reproduction
https://github.com/joshnuss/vitest-type-error-repro
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: