karma-moxios

0.1.0 • Public • Published

karma-moxios

Moxios for Karma

Intstalling

Install npm module

$ npm install karma-moxios --save-dev

Add moxios to the frameworks key in your Karma config

module.exports = function (config) {
  config.set({
    frameworks: ['mocha', 'moxios']
  })
}

Example

describe('moxios example test', function () {
  beforeEach(function () {
    moxios.install()
  })
 
  afterEach(function () {
    moxios.uninstall()
  })
 
  it('test stuff', function () {
    axios.get('/foo/bar').then(function (res) {
      /* ... */
    })
 
    moxios.wait(function () {
      moxios.requests.mostRecent().respondWith({
        status: 200,
        responseText: 'baz'
      }).then(function () {
        /* ... */
      })
    })
  })
})

Package Sidebar

Install

npm i karma-moxios

Weekly Downloads

22

Version

0.1.0

License

MIT

Last publish

Collaborators

  • mzabriskie