Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] async function return undifined #98

Open
hks2002 opened this issue Jan 5, 2023 · 0 comments
Open

[BUG] async function return undifined #98

hks2002 opened this issue Jan 5, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@hks2002
Copy link

hks2002 commented Jan 5, 2023

问题简述
同步函数 async function 会返回空值undifined

复现步骤
在自带的练习环境中,输入

Mock.mock('http://example.com/path/to', async ()=>{
 return await new Promise ((resolver)=>resolver('TEST'))

})

axios.get('http://example.com/path/to').then(res => {
    console.log(res.data)
})

截图
image

@hks2002 hks2002 added the bug Something isn't working label Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant