_setup.js 627 B

1234567891011121314151617181920212223242526272829
  1. global.expect = require('unexpected');
  2. global.sinon = require('sinon');
  3. const jsdom = require('jsdom');
  4. const {JSDOM} = jsdom;
  5. const {window} = new JSDOM('<body><div id="test-container"></div></body>', {
  6. pretendToBeVisual: true
  7. });
  8. const document = window.document;
  9. global.JSDOM = JSDOM;
  10. global.window = window;
  11. global.testContainer = document.getElementById('test-container');
  12. const exposeToGlobal = [
  13. 'document',
  14. 'CustomEvent',
  15. 'DocumentFragment',
  16. 'Event',
  17. 'EventTarget',
  18. 'NodeList',
  19. 'Range',
  20. ];
  21. exposeToGlobal.forEach((prop) => {
  22. global[prop] = window[prop];
  23. });
  24. global.simulant = require('simulant');