From c71bd7b97476844fe2d741cd7c02abb81576ee98 Mon Sep 17 00:00:00 2001 From: Jeff Held Date: Thu, 20 Dec 2018 15:43:36 -0600 Subject: [PATCH] [Detox] DetoxJestAdapter overlaps CustomReporter DetoxJestAdapter needs to overlap jasmine.CustomReporter since the latter is a weak interface; otherwise the code that is needed to run Detox with Jest will throw errors when compiled. --- types/detox/runners/jest/adapter/index.d.ts | 3 +++ types/detox/test/detox-jest-setup-tests.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/types/detox/runners/jest/adapter/index.d.ts b/types/detox/runners/jest/adapter/index.d.ts index ca195ae744..f479eda256 100644 --- a/types/detox/runners/jest/adapter/index.d.ts +++ b/types/detox/runners/jest/adapter/index.d.ts @@ -2,6 +2,9 @@ interface DetoxJestAdapter { detox: Detox.Detox; beforeEach: () => Promise; afterAll: () => Promise; + // These are not publicly used, but are defined in order to overlap with the jasmine.CustomReporter interface (which is a weak interface) + specDone: () => void; + specStarted: () => void; } declare const adapter: DetoxJestAdapter; diff --git a/types/detox/test/detox-jest-setup-tests.ts b/types/detox/test/detox-jest-setup-tests.ts index 1132fb895b..7a2a9a3901 100644 --- a/types/detox/test/detox-jest-setup-tests.ts +++ b/types/detox/test/detox-jest-setup-tests.ts @@ -8,6 +8,9 @@ import adapter from "detox/runners/jest/adapter"; // const config = require("./package.json").detox; declare const config: any; +declare const jasmine: any; +jasmine.getEnv().addReporter(adapter); + beforeAll(async () => { await detox.init(config);