So previously I have a successfully working test with Vue 2.7 + Jest in Options API like this:
{
data: () => ({}),
methods: {
async someFunction() {
const result = await this.hiWorld()
return result
},
async hiWorld() {
return 'hi world'
}
}
}
test('helloWorld', async () => {
console.log(wrapper.vm.someFunction) // [Function: bound someFunction] AsyncFunction
const result = await wrapper.vm.someFunction()
expect(result).toBe('hi world')
})
and after I converted it to using setup function, jest wasn't able to call it and throws a 5000 timeout (even after adjustments, nothing happens)
{
setup() {
async function someFunction() {
const result = await hiWorld() // it wasn't able to call this now?
return result
}
async function hiWorld() {
return 'hi world'
}
return {
someFunction,
hiWorld
}
}
}
thrown: "Exceeded timeout of 5000 ms for a test.
Use jest.setTimeout(newTimeout) to increase the timeout value, if this is a long-running test."
and from [Function: bound someFunction] AsyncFunction it now logs [AsyncFunction: someFunction].
Am I missing something here?