mirror of
https://github.com/grafana/grafana.git
synced 2024-11-24 09:50:29 -06:00
8d339a279b
* Eslint: no-duplicate-imports rule (bump grafana-eslint-config) * Chore: Fix duplicate imports (#31041) * Rebased this branch into eslint-no-duplicate-imports * updated some changes * merged uncaught duplicate imports * fixes frontend test- I hope * fixes e2e test- I hope Co-authored-by: Uchechukwu Obasi <obasiuche62@gmail.com>
53 lines
1.3 KiB
TypeScript
53 lines
1.3 KiB
TypeScript
import { configure } from 'enzyme';
|
|
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
|
|
import $ from 'jquery';
|
|
import 'mutationobserver-shim';
|
|
|
|
const global = window as any;
|
|
global.$ = global.jQuery = $;
|
|
|
|
import '../vendor/flot/jquery.flot';
|
|
import '../vendor/flot/jquery.flot.time';
|
|
import angular from 'angular';
|
|
|
|
angular.module('grafana', ['ngRoute']);
|
|
angular.module('grafana.services', ['ngRoute', '$strap.directives']);
|
|
angular.module('grafana.panels', []);
|
|
angular.module('grafana.controllers', []);
|
|
angular.module('grafana.directives', []);
|
|
angular.module('grafana.filters', []);
|
|
angular.module('grafana.routes', ['ngRoute']);
|
|
|
|
jest.mock('app/core/core', () => ({}));
|
|
jest.mock('app/features/plugins/plugin_loader', () => ({}));
|
|
|
|
configure({ adapter: new Adapter() });
|
|
|
|
const localStorageMock = (() => {
|
|
let store: any = {};
|
|
return {
|
|
getItem: (key: string) => {
|
|
return store[key];
|
|
},
|
|
setItem: (key: string, value: any) => {
|
|
store[key] = value.toString();
|
|
},
|
|
clear: () => {
|
|
store = {};
|
|
},
|
|
removeItem: (key: string) => {
|
|
delete store[key];
|
|
},
|
|
};
|
|
})();
|
|
|
|
global.localStorage = localStorageMock;
|
|
|
|
const throwUnhandledRejections = () => {
|
|
process.on('unhandledRejection', (err) => {
|
|
throw err;
|
|
});
|
|
};
|
|
|
|
throwUnhandledRejections();
|