@augment-vir/core 31.48.0 → 31.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -41,6 +41,7 @@ export declare const currentRuntimeEnv: RuntimeEnv;
|
|
|
41
41
|
* @category Package : @augment-vir/common
|
|
42
42
|
* @returns `true` if the given {@link RuntimeEnv} is the current {@link RuntimeEnv}.
|
|
43
43
|
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
|
|
44
|
+
* @see
|
|
44
45
|
* - {@link RuntimeEnv}
|
|
45
46
|
* - {@link currentRuntimeEnv}
|
|
46
47
|
* - {@link perEnv}
|
|
@@ -64,8 +65,17 @@ export declare class RuntimeEnvError extends Error {
|
|
|
64
65
|
* @category Env
|
|
65
66
|
* @category Package : @augment-vir/common
|
|
66
67
|
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
|
|
68
|
+
* @see
|
|
67
69
|
* - {@link RuntimeEnv}
|
|
68
70
|
* - {@link currentRuntimeEnv}
|
|
69
71
|
* - {@link isRuntimeEnv}
|
|
70
72
|
*/
|
|
71
73
|
export declare function perEnv<T>(perEnv: Record<RuntimeEnv, () => T>): T;
|
|
74
|
+
/**
|
|
75
|
+
* Determines if the current code is being executed within a playwright test.
|
|
76
|
+
*
|
|
77
|
+
* @category Env
|
|
78
|
+
* @category Package : @augment-vir/common
|
|
79
|
+
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
|
|
80
|
+
*/
|
|
81
|
+
export declare function isInsidePlaywrightTest(): boolean;
|
|
@@ -47,6 +47,7 @@ export const currentRuntimeEnv = determineRuntimeEnv();
|
|
|
47
47
|
* @category Package : @augment-vir/common
|
|
48
48
|
* @returns `true` if the given {@link RuntimeEnv} is the current {@link RuntimeEnv}.
|
|
49
49
|
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
|
|
50
|
+
* @see
|
|
50
51
|
* - {@link RuntimeEnv}
|
|
51
52
|
* - {@link currentRuntimeEnv}
|
|
52
53
|
* - {@link perEnv}
|
|
@@ -72,6 +73,7 @@ export class RuntimeEnvError extends Error {
|
|
|
72
73
|
* @category Env
|
|
73
74
|
* @category Package : @augment-vir/common
|
|
74
75
|
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
|
|
76
|
+
* @see
|
|
75
77
|
* - {@link RuntimeEnv}
|
|
76
78
|
* - {@link currentRuntimeEnv}
|
|
77
79
|
* - {@link isRuntimeEnv}
|
|
@@ -79,3 +81,15 @@ export class RuntimeEnvError extends Error {
|
|
|
79
81
|
export function perEnv(perEnv) {
|
|
80
82
|
return perEnv[currentRuntimeEnv]();
|
|
81
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Determines if the current code is being executed within a playwright test.
|
|
86
|
+
*
|
|
87
|
+
* @category Env
|
|
88
|
+
* @category Package : @augment-vir/common
|
|
89
|
+
* @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common)
|
|
90
|
+
*/
|
|
91
|
+
export function isInsidePlaywrightTest() {
|
|
92
|
+
/** `process` is not defined on the web. */
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
94
|
+
return !!globalThis.process?.env.PLAYWRIGHT_TEST;
|
|
95
|
+
}
|