mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* chore(monaco): bump monaco-editor to latest version * feat(codeeditor): use esm to load monaco editor * revert(monaco): put back previous version * feat(monaco): setup MonacoEnvironment when bootstrapping app * feat(monaco): load monaco languages from registry as workers * feat(webpack): clean up warnings, remove need to copy monaco into lib * fix(plugins): wip - remove amd loader workaround in systemjs hooks * chore(azure): clean up so QueryField passes typecheck * test(jest): update config to fix failing tests due to missing monaco-editor * test(jest): update config to work with monaco-editor and kusto * test(jest): prevent message eventlistener in nodeGraph/layout.worker tripping up monaco tests * test(plugins): wip - remove amd related tests from systemjs hooks * test(alerting): prefer clearAllMocks to prevent monaco editor failing due to missing matchMedia * test(parca): fix failing test due to undefined backendSrv * chore: move monacoEnv to app/core * test: increase testing-lib timeout to 2secs, fix parca test to assert dom element * feat(plugins): share kusto via systemjs * test(e2e): increase timeout for checking monaco editor in exemplars spec * test(e2e): assert monaco has loaded by checking the spinner is gone and window.monaco exists * test(e2e): check for monaco editor textarea * test(e2e): check monaco editor is loaded before assertions * test(e2e): add waitForMonacoToLoad util to reduce duplication * test(e2e): fix failing mysql spec * chore(jest): add comment to setupTests explaining need to incresae default timeout * chore(nodegraph): improve comment in layout.worker.utils to better explain the need for file
57 lines
1.3 KiB
TypeScript
57 lines
1.3 KiB
TypeScript
import 'whatwg-fetch';
|
|
import { http, HttpResponse } from 'msw';
|
|
import { setupServer } from 'msw/node';
|
|
|
|
export const mockSystemModule = `System.register(['./dependencyA'], function (_export, _context) {
|
|
"use strict";
|
|
|
|
var DependencyACtrl;
|
|
return {
|
|
setters: [function (_dependencyA) {
|
|
DependencyACtrl = _dependencyA.DependencyACtrl;
|
|
}],
|
|
execute: function () {
|
|
_export('PanelCtrl', DependencyACtrl);
|
|
}
|
|
};
|
|
});`;
|
|
|
|
export const mockAmdModule = `define([], function() {
|
|
return function() {
|
|
console.log('AMD module loaded');
|
|
var pluginPath = "/public/plugins/";
|
|
}
|
|
});`;
|
|
|
|
const server = setupServer(
|
|
http.get(
|
|
'/public/plugins/mockAmdModule/module.js',
|
|
() =>
|
|
new HttpResponse(mockAmdModule, {
|
|
headers: {
|
|
'Content-Type': 'text/javascript',
|
|
},
|
|
})
|
|
),
|
|
http.get(
|
|
'/public/plugins/mockSystemModule/module.js',
|
|
() =>
|
|
new HttpResponse(mockSystemModule, {
|
|
headers: {
|
|
'Content-Type': 'text/javascript',
|
|
},
|
|
})
|
|
),
|
|
http.get(
|
|
'http://my-cdn.com/plugins/my-plugin/v1.0.0/public/plugins/my-plugin/module.js',
|
|
() =>
|
|
new HttpResponse(mockAmdModule, {
|
|
headers: {
|
|
'Content-Type': 'text/javascript',
|
|
},
|
|
})
|
|
)
|
|
);
|
|
|
|
export { server };
|