[Vuejs]-How to unit test Vue component that uses Axios (or other async update)?

0👍

A generic (non-Vue-specific) workaround:

const test = () => {
    try {
        expect(wrapper.text()).toMatch('Updated text')
        done()
    } catch (e) {
        setTimeout(test, 1)
    }
}
setTimeout(test, 1)

However, any failures from the expect are ignored and the test times out without any message if failing.

Leave a comment