samedi 23 janvier 2016

How to create Jasmine tests both for jsdom as well as browser

I want to test my JS application with Jasmine both with JSDom from the command line, and in browsers. What's the best practice to have a number of specs, but when they are run in browser, don't use JSDom? At the moment I have

beforeEach(() => {
    const doc = jsdom.jsdom();
    global['window'] = doc.defaultView;
    global['document'] = doc;
});

I could create two separate test files for these scenarios but I would like to keep things organised.

Aucun commentaire:

Enregistrer un commentaire