-
Notifications
You must be signed in to change notification settings - Fork 3
Test
Hill Liu edited this page Jun 15, 2021
·
29 revisions
Table of Contents
-
before(() => { }); after(() => { }); beforeEach(() => { }); afterEach(() => { });
import jsdom from "jsdom-global";
describe("Some Test", () => {
let resetGlobal;
before(() => {
resetGlobal = jsdom(null, { url: "http://localhost" });
});
after(() => {
resetGlobal();
});
});
import jsdom from 'jsdom-global'
describe('Some Test', ()=>{
let reset;
after(() => {
jsdom();
});
beforeEach(
() =>
(reset = jsdom(null, {runScripts: 'dangerously', resources: 'usable'})),
);
afterEach(done => {
reset();
});
});
-
Need use mount attachTo
const el = document.createElement('div');
document.body.appendChild(el);
const uDom = mount(<Comp />, {attachTo: el});