UNPKG

fabric

Version:

Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.

25 lines (22 loc) 573 B
import './vitest.extend'; import { getEnv, setEnv } from './src/env'; import { beforeAll } from 'vitest'; import { isJSDOM } from './vitest.extend'; // set custom env beforeAll(() => { if (isJSDOM()) { setEnv({ ...getEnv(), window, document }); } // Polyfill for jsdom if (typeof globalThis.Touch === 'undefined') { globalThis.Touch = class Touch { clientX: number; clientY: number; identifier: number; target: EventTarget; constructor(init: Partial<Touch>) { Object.assign(this, init); } } as any; } });