[Vuejs]-How come the order of these Jest tests affect the test outcome?

0👍

In the case where all tests pass, you have invoked the interceptors yourself in the very first test, so following things happened in the given order:

(1) state.commit --> calledWith --> changeUploadStatusToUploading

(2) Manually invoked interceptor

(3) Interceptor execution finished successfully

(3) Response finished successfully

(4) state.commit --> calledWith --> changeUploadStatusToSucceeded

In the case where tests fail, the first test didn’t invoke interceptors, so following things happened:

(1) state.commit --> calledWith --> changeUploadStatusToUploading

(2) interceptor not invoked

(3) response hasn't ended yet

(4) State.commit wasn't called anymore since interceptor needs to be resolved first

Leave a comment