Stub deprecation warning in kbn unit tests (#45313)

This commit is contained in:
Ashley Harrison 2022-02-11 16:34:06 +00:00 committed by GitHub
parent 8bf2e642aa
commit 820a70f49a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -1,6 +1,13 @@
import kbn from './kbn'; import kbn from './kbn';
import { DecimalCount, TimeZone } from '@grafana/data'; import { DecimalCount, TimeZone } from '@grafana/data';
// Most of the methods in this file are deprecated
// Stub the deprecation warning here to prevent polluting the test output
jest.mock('@grafana/data', () => ({
...jest.requireActual('@grafana/data'),
deprecationWarning: () => {},
}));
interface ValueFormatTest { interface ValueFormatTest {
id: string; id: string;
decimals?: DecimalCount; decimals?: DecimalCount;

View File

@ -50,7 +50,7 @@ const kbn = {
addSlashes: (str: string) => str.replace(/[\'\"\\0]/g, '\\$&'), addSlashes: (str: string) => str.replace(/[\'\"\\0]/g, '\\$&'),
/** @deprecated since 7.2, use grafana/data */ /** @deprecated since 7.2, use grafana/data */
describeInterval: (str: string) => { describeInterval: (str: string) => {
deprecationWarning('kbn.ts', 'kbn.stringToJsRegex()', '@grafana/data'); deprecationWarning('kbn.ts', 'kbn.describeInterval()', '@grafana/data');
return rangeUtil.describeInterval(str); return rangeUtil.describeInterval(str);
}, },
/** @deprecated since 7.2, use grafana/data */ /** @deprecated since 7.2, use grafana/data */