Website : rimsha.abasa.com
backdoor
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
canvas
/
packages
/
canvas-media
/
jest
/
Filename :
jest-setup.js
back
Copy
/* * Copyright (C) 2019 - present Instructure, Inc. * * This file is part of Canvas. * * Canvas is free software: you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License as published by the Free * Software Foundation, version 3 of the License. * * Canvas is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License along * with this program. If not, see <http://www.gnu.org/licenses/>. */ import filterUselessConsoleMessages from '@instructure/filter-console-messages' // because InstUI themeable components need an explicit "dir" attribute on the <html> element document.documentElement.setAttribute('dir', 'ltr') require('@instructure/ui-themes') // set up mocks for native APIs if (!('MutationObserver' in window)) { Object.defineProperty(window, 'MutationObserver', { value: require('@sheerun/mutationobserver-shim'), }) } window.scroll = () => {} /** * We want to ensure errors and warnings get appropriate eyes. If * you are seeing an exception from here, it probably means you * have an unintended consequence from your changes. If you expect * the warning/error, add it to the ignore list below. */ /* eslint-disable no-console */ const globalError = global.console.error const ignoredErrors = [/A theme registry has already been initialized/] const globalWarn = global.console.warn const ignoredWarnings = [ /Translation for .* in "en" is missing/, /Exactly one focusable child is required/, ] global.console = { log: console.log, error: error => { if (ignoredErrors.some(regex => regex.test(error))) { return } globalError(error) throw new Error( `Looks like you have an unhandled error. Keep our test logs clean by handling or filtering it. ${error}` ) }, warn: warning => { if (ignoredWarnings.some(regex => regex.test(warning))) { return } globalWarn(warning) throw new Error( `Looks like you have an unhandled warning. Keep our test logs clean by handling or filtering it. ${warning}` ) }, info: console.info, debug: console.debug, } /* eslint-enable no-console */ filterUselessConsoleMessages(global.console) if (typeof window.URL.createObjectURL === 'undefined') { Object.defineProperty(window.URL, 'createObjectURL', {value: () => 'http://example.com/whatever'}) } if (typeof window.URL.revokeObjectURL === 'undefined') { Object.defineProperty(window.URL, 'revokeObjectURL', {value: () => undefined}) } global.DataTransferItem = global.DataTransferItem || class DataTransferItem {}