nock is not intercepting my request
<p>I'm trying to create some basic tests using karma server and nock.
It seems like nock is not intercepting my requests at all, does anyone have idea? I can't figure out what is missing. I still getting real data. </p>

<pre><code>nock('https://api.github.com/users/' + username).log(console.log)
.get('/')
.query(true)
.reply(400, {
  statusMessage: 'Bad Request',
  foo: 'foo'
})

http.get('https://api.github.com/users/' + username, function(res) {
  console.log('res', res)
})
</code></pre>

<p>I also added this middleware</p>

<pre><code>const middlewares = [thunk];
const mockStore = configureStore(middlewares);
</code></pre>

<p>====== UPDATE Jun 6 ======</p>

<p>Whole flow using react-redux
Here is my test:</p>

<pre><code>import configureStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import axios from 'axios';
import expect from 'expect';
import * as actions from 'actions/test-actions'
import * as types from 'types';
import nock from 'nock'
import { username } from 'constansts'

const middlewares = [thunk];
const mockStore = configureStore(middlewares);

describe('Asynchronous actions', () =&gt; {
  it('Basic example', done =&gt; {
    nock('https://api.github.com')
    .get('/users/' + username)
    .reply(400, {
      statusMessage: 'Bad Request',
      foo: 'foo'
    })

    var expectedActions = []
    let store = mockStore([], expectedActions, done)

    store.dispatch(actions.testRequest())
      .then(() =&gt; {
        console.log('store.getActions() =&gt; ', store.getActions())
      })
      .then(done).catch((err) =&gt; {
        console.log('ERROR==&gt;', err)
        done()
      })
  })
})
</code></pre>

<p>And here is the action</p>

<pre><code>export function testRequest () {
  return axios.get('https://api.github.com/users/' + username)
  .then(function (res) {
    console.log('response =&gt;', res.status)
  })
  .catch(function (err) {
    console.log('error =&gt;', err)
  })
}
</code></pre>

<p>res.status is 200, even if I use nock for changing to 400</p>