Wildcard Mock Not Working

This issue has been tracked since 2019-02-21.


I have some tests that require wildcards (see example below) but it doesn't look to be working as expected (the requests is not mocked).

moxios.stubRequest('/comments/.*/vote', { status: 200, response: { success: true } })

Any idea why this could be happening?

Thanks in advance

guilhermemj wrote this answer on 2019-08-14

Hi mate!

I may be wrong, but I think wildcards should be RegExp, not strings, as in the example from README:

 // Alternatively URL can be a RegExp
 moxios.stubRequest(/say.*/, {/* ... */})

Try using /comments\/.*\/vote/ (without quotes).

More Details About Repo
Owner Name axios
Repo Name moxios
Full Name axios/moxios
Language JavaScript
Created Date 2016-05-25
Updated Date 2022-12-05
Star Count 1386
Watcher Count 20
Fork Count 85
Issue Count 19


Issue Title Created Date Updated Date