From 6c63fb26f6255edf2e90b7d090d12ae9852b336a Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Thu, 26 Nov 2020 09:03:14 -0500 Subject: [PATCH] move itif and describeif into utils Signed-off-by: Sebastian Malton --- integration/__tests__/app.tests.ts | 8 ++------ integration/helpers/utils.ts | 8 ++++++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/integration/__tests__/app.tests.ts b/integration/__tests__/app.tests.ts index 128675ba71..e65dbcd445 100644 --- a/integration/__tests__/app.tests.ts +++ b/integration/__tests__/app.tests.ts @@ -8,10 +8,6 @@ import { Application } from "spectron"; import * as util from "../helpers/utils"; import { spawnSync } from "child_process"; -// eslint-disable-next-line unused-imports/no-unused-vars-ts -const itif = (condition: boolean) => condition ? it : it.skip; -const describeif = (condition: boolean) => condition ? describe : describe.skip; - jest.setTimeout(60000); // FIXME (!): improve / simplify all css-selectors + use [data-test-id="some-id"] (already used in some tests below) @@ -107,7 +103,7 @@ describe("Lens integration tests", () => { }); }); - describeif(ready)("workspaces", () => { + util.describeIf(ready)("workspaces", () => { beforeAll(appStart, 20000); afterAll(async () => { @@ -171,7 +167,7 @@ describe("Lens integration tests", () => { await app.client.waitUntilTextExists("span.link-text", "Cluster"); }; - describeif(ready)("cluster tests", () => { + util.describeIf(ready)("cluster tests", () => { let clusterAdded = false; const addCluster = async () => { diff --git a/integration/helpers/utils.ts b/integration/helpers/utils.ts index 9df2d9ed66..263caa50a7 100644 --- a/integration/helpers/utils.ts +++ b/integration/helpers/utils.ts @@ -6,6 +6,14 @@ const AppPaths: Partial> = { "darwin": "./dist/mac/Lens.app/Contents/MacOS/Lens", }; +export function itIf(condition: boolean) { + return condition ? it : it.skip; +} + +export function describeIf(condition: boolean) { + return condition ? describe : describe.skip; +} + export function setup(): Application { return new Application({ path: AppPaths[process.platform], // path to electron app