当前位置: 动力学知识库 > 问答 > 编程问答 >

node.js - 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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: