mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Deprecate another var with injectable
Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
d93080b4e5
commit
579dfd2d0b
@ -26,6 +26,10 @@ export const isLinux = process.platform === "linux";
|
|||||||
|
|
||||||
export const isDebugging = ["true", "1", "yes", "y", "on"].includes((process.env.DEBUG ?? "").toLowerCase());
|
export const isDebugging = ["true", "1", "yes", "y", "on"].includes((process.env.DEBUG ?? "").toLowerCase());
|
||||||
export const isSnap = !!process.env.SNAP;
|
export const isSnap = !!process.env.SNAP;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Switch to using isTestEnvInjectable
|
||||||
|
*/
|
||||||
export const isTestEnv = !!process.env.JEST_WORKER_ID;
|
export const isTestEnv = !!process.env.JEST_WORKER_ID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -3,19 +3,18 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { isTestEnv } from "../vars";
|
|
||||||
import isProductionInjectable from "./is-production.injectable";
|
import isProductionInjectable from "./is-production.injectable";
|
||||||
|
import isTestEnvInjectable from "./is-test-env.injectable";
|
||||||
|
|
||||||
const isDevelopmentInjectable = getInjectable({
|
const isDevelopmentInjectable = getInjectable({
|
||||||
id: "is-development",
|
id: "is-development",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const isProduction = di.inject(isProductionInjectable);
|
const isProduction = di.inject(isProductionInjectable);
|
||||||
|
const isTestEnv = di.inject(isTestEnvInjectable);
|
||||||
|
|
||||||
return !isTestEnv && !isProduction;
|
return !isTestEnv && !isProduction;
|
||||||
},
|
},
|
||||||
|
|
||||||
causesSideEffects: true,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default isDevelopmentInjectable;
|
export default isDevelopmentInjectable;
|
||||||
|
|||||||
18
src/common/vars/is-test-env.injectable.ts
Normal file
18
src/common/vars/is-test-env.injectable.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
|
*/
|
||||||
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
|
import environmentVariablesInjectable from "../utils/environment-variables.injectable";
|
||||||
|
|
||||||
|
const isTestEnvInjectable = getInjectable({
|
||||||
|
id: "is-test-env",
|
||||||
|
|
||||||
|
instantiate: (di) => {
|
||||||
|
const { JEST_WORKER_ID: jestWorkerId } = di.inject(environmentVariablesInjectable);
|
||||||
|
|
||||||
|
return !!jestWorkerId;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default isTestEnvInjectable;
|
||||||
Loading…
Reference in New Issue
Block a user