diff --git a/jest.config.js b/jest.config.js index 732cac6e62f..7b6ca65d4a2 100644 --- a/jest.config.js +++ b/jest.config.js @@ -63,6 +63,14 @@ const alertingConfig = { testRegex: '(.*/app/features/alerting/.*)(\\.|/)(test)\\.(jsx?|tsx?)$', modulePathIgnorePatterns: [], setupFilesAfterEnv: [...coreConfig.setupFilesAfterEnv, './public/app/features/alerting/setupTests.ts'], + coverageThreshold: { + global: { + branches: 100, + functions: 100, + lines: 100, + statements: 100, + }, + }, }; module.exports = { diff --git a/public/app/features/alerting/setupTests.ts b/public/app/features/alerting/setupTests.ts index fef9c6a943c..37a862797bb 100644 --- a/public/app/features/alerting/setupTests.ts +++ b/public/app/features/alerting/setupTests.ts @@ -1,3 +1,3 @@ -beforeEach(() => { - // Do a thing in here, only for alerting -}); +import { setupMswServer } from 'app/features/alerting/unified/mockApi'; + +setupMswServer(); diff --git a/public/app/features/alerting/unified/RuleEditorCloudRules.test.tsx b/public/app/features/alerting/unified/RuleEditorCloudRules.test.tsx index ad3d0d70770..919a7fb568a 100644 --- a/public/app/features/alerting/unified/RuleEditorCloudRules.test.tsx +++ b/public/app/features/alerting/unified/RuleEditorCloudRules.test.tsx @@ -12,7 +12,7 @@ import { searchFolders } from '../../manage-dashboards/state/actions'; import { fetchRulerRules, fetchRulerRulesGroup, fetchRulerRulesNamespace, setRulerRuleGroup } from './api/ruler'; import { ExpressionEditorProps } from './components/rule-editor/ExpressionEditor'; -import { mockApi, mockFeatureDiscoveryApi, setupMswServer } from './mockApi'; +import server, { mockApi, mockFeatureDiscoveryApi } from './mockApi'; import { grantUserPermissions, labelsPluginMetaMock, mockDataSource } from './mocks'; import { emptyExternalAlertmanagersResponse, mockAlertmanagersResponse } from './mocks/alertmanagerApi'; import { fetchRulerRulesIfNotFetchedYet } from './state/actions'; @@ -46,9 +46,6 @@ jest.mock('app/core/components/AppChrome/AppChromeUpdate', () => ({ })); setupDataSources(dataSources.default); - -const server = setupMswServer(); - mockFeatureDiscoveryApi(server).discoverDsFeatures(dataSources.default, buildInfoResponse.mimir); mockAlertmanagersResponse(server, emptyExternalAlertmanagersResponse); mockApi(server).plugins.getPluginSettings({ ...labelsPluginMetaMock, enabled: false });