mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Enable jest-fail-on-console to prevent console errors in unit tests (#46835)
* Add jest-fail-on-console * Fix last 2 console warnings * Update package syntax
This commit is contained in:
@@ -506,8 +506,10 @@ describe('DashboardModel', () => {
|
||||
|
||||
describe('Given model with time', () => {
|
||||
let model: DashboardModel;
|
||||
let consoleWarnSpy: jest.SpyInstance;
|
||||
|
||||
beforeEach(() => {
|
||||
consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
|
||||
model = new DashboardModel({
|
||||
time: {
|
||||
from: 'now-6h',
|
||||
@@ -521,6 +523,10 @@ describe('DashboardModel', () => {
|
||||
};
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
consoleWarnSpy.mockRestore();
|
||||
});
|
||||
|
||||
it('hasTimeChanged should be true', () => {
|
||||
expect(model.hasTimeChanged()).toBeTruthy();
|
||||
});
|
||||
|
||||
@@ -37,6 +37,11 @@ jest.mock('../hooks/usePluginConfig.tsx', () => ({
|
||||
})),
|
||||
}));
|
||||
|
||||
jest.mock('../helpers.ts', () => ({
|
||||
...jest.requireActual('../helpers.ts'),
|
||||
updatePanels: jest.fn(),
|
||||
}));
|
||||
|
||||
const renderPluginDetails = (
|
||||
pluginOverride: Partial<CatalogPlugin>,
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user