question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

moxios.requests.mostRecent() returns undefined

See original GitHub issue

I use karma, jasmine and phantomJS with babel-polyfill. mostRecent always returns undefined even if I call axios in the test directly.

For example:

axios = require 'axios'
moxios = require 'moxios'

describe 'Test moxios', () ->
  beforeEach () ->
    moxios.install()

  afterEach () ->
    moxios.uninstall()

  it 'mostRecent should return a request', () ->
    axios('http://example.com').then (result) -> console.log result
    moxios.wait () ->
      console.log moxios.requests.mostRecent()
      # undefined

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
main-kuncommented, Jun 19, 2016

Also I just realised this was mentioned in #1. So it works if i pass axios to 'moxios.install()`

0reactions
subrato-pattanaikcommented, Oct 21, 2020

Same issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

moxios.requests.mostRecent() returns undefined
The problem is moxios.requests.mostRecent() in my test class always returns undefined . I went through https://github.com/axios/moxios/issues/ ...
Read more >
moxios.requests.mostRecent() is returning undefined
I am using Webpack in React (16.12)and after running test getting below error. I am testing with Jest and enzyme.
Read more >
moxios.requests.mostRecent(). always i am getting undefined
always i am getting undefined. “moxios.requests.mostRecent()” is published by Dileep Kumar.
Read more >
Complete Intro to React
imdbID)(dispatchMock); moxios.wait(() => { const request = moxios.requests.mostRecent(); request .respondWith({ status: 200, response: oitnb }) .then(() ...
Read more >
JavaScript moxios requests.mostRecent Examples
JavaScript requests.mostRecent - 21 examples found. These are the top rated real world JavaScript examples of moxios.requests.mostRecent extracted from open ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found