Skip to content
This repository has been archived by the owner on Feb 22, 2019. It is now read-only.

Mocha support? #3

Open
jme783 opened this issue Apr 8, 2015 · 2 comments
Open

Mocha support? #3

jme783 opened this issue Apr 8, 2015 · 2 comments

Comments

@jme783
Copy link

jme783 commented Apr 8, 2015

Does this work with Mocha instead of Qunit?

@andremalan
Copy link
Contributor

Not at the moment, but I'm sure it wouldn't be too hard to switch up insert-cassette to make it happen.

@walter
Copy link

walter commented May 21, 2015

I've gotten it working with the following as a replacement for insert-cassette:

// mocha-insert-cassette.js
import {
  startServer,
  stopServer,
  setupServer
} from './fake-server';
import betamaxRecorder from './betamax-recorder';

export default function(cassette){
  beforeEach(function(){
    startServer();

    // if record is not selected, use recordings
    if (!window.recordCassette){
      setupServer(cassette);
    }

    betamaxRecorder.setup();
  });

  afterEach(function(){
    stopServer();

    // if we are not in testem, download new casettes.
    if (window.recordCassette){
      betamaxRecorder.download();
    }
  });
}
// change import line in test-helper to "import insertCassette from './helpers/mocha-insert-cassette';"

In our web UI for the mocha runner, we have added an option to toggle window.recordCassette.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants