From bc90af32f83f414d56c7a3df84fc0fa9c243b4c9 Mon Sep 17 00:00:00 2001 From: Luke Elmers Date: Thu, 12 Dec 2019 14:51:18 -0700 Subject: [PATCH] Add clarifying comment to Lens test mock. --- .../operations/definitions/date_histogram.test.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_plugin/operations/definitions/date_histogram.test.tsx b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/operations/definitions/date_histogram.test.tsx index ecba6ff20de41..0f7379458c677 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_plugin/operations/definitions/date_histogram.test.tsx +++ b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/operations/definitions/date_histogram.test.tsx @@ -15,6 +15,15 @@ import { createMockedIndexPattern } from '../../mocks'; import { IndexPatternPrivateState } from '../../types'; jest.mock('ui/new_platform', () => { + // Due to the way we are handling shims in the NP migration, we need + // to mock core here so that upstream services don't cause these + // tests to fail. Ordinarly `jest.mock('ui/new_platform')` would be + // sufficient, however we need to mock one of the `uiSettings` return + // values for this suite, so we must manually assemble the mock. + // Because babel hoists `jest` we must use an inline `require` + // to ensure the core mocks are available (`jest.doMock` doesn't + // work in this case). This mock should be able to be replaced + // altogether once Lens has migrated to the new platform. const { coreMock } = require('src/core/public/mocks'); // eslint-disable-line @typescript-eslint/no-var-requires return { npSetup: {