Code execution order isn't clear to me #6388
-
Hello everyone, I am doing some simple tests with javascript vanilla, vite and vitest. I create the project with I changed the
After that I created a
Even though I have a
The error happens because the render function runs before the beforeEach function and I don't understand why this behavior happen. Does anyone knows what is happening and can explain? To workaround this error I added an if statement, but I really don't understand this behavior My vitest and vite versions:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
If you're wondering why // main.js
export const render = () => { ... };
render(); then that's just how javascript works. |
Beta Was this translation helpful? Give feedback.
If you're wondering why
render
is executed when importingmain.js
:then that's just how javascript works.