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
I was having problems with some warnings being output to the console after the test had already passed, which was causing a lot of confusion. Sometimes I was also having issues—see vuejs/vue#7140—with my actual tests not reporting the error in the correct way, instead the error being logged to the console and then the test timing out later.
I've ended up rewriting all of my tests, including the synchronous ones, to basically look like this:
it('is something',(done)=>{Vue.config.errorHandler=done;// do testlocalVue.nextTick(done);});
(plus logic to make sure that Vue.config.errorHandler was set back to what it was supposed to be in before and afterEach)
There seem to be a lot of errors that are logged to the console in the next tick—for example, if you're using <router-link> and have VueRouter installed but haven't actually passed in a router—and these were causing a lot of issues in my tests because they were just being logged to the console.
Until I figured out that I had to do this let my test run for another tick and set up Vue.config.errorHandler, writing tests was really tricky! I was getting errors in the console, but they weren't failing the tests, and sometimes they were actually being output several tests later.
The stack trace also looked like this, but this might be a setup issue on my behalf:
I was having problems with some warnings being output to the console after the test had already passed, which was causing a lot of confusion. Sometimes I was also having issues—see vuejs/vue#7140—with my actual tests not reporting the error in the correct way, instead the error being logged to the console and then the test timing out later.
I've ended up rewriting all of my tests, including the synchronous ones, to basically look like this:
(plus logic to make sure that
Vue.config.errorHandler
was set back to what it was supposed to be inbefore
andafterEach
)There seem to be a lot of errors that are logged to the console in the next tick—for example, if you're using
<router-link>
and haveVueRouter
installed but haven't actually passed in a router—and these were causing a lot of issues in my tests because they were just being logged to the console.Until I figured out that I had to do this let my test run for another tick and set up
Vue.config.errorHandler
, writing tests was really tricky! I was getting errors in the console, but they weren't failing the tests, and sometimes they were actually being output several tests later.The stack trace also looked like this, but this might be a setup issue on my behalf:
Passing the errors to mocha resulted in a proper stack trace with line numbers and stuff.
Is this something anyone else has faced? Is there an easier way to deal with it?
The text was updated successfully, but these errors were encountered: