-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30022 from storybookjs/valentin/fix-accessibility…
…-always-running Addon A11y: Refactor environment variable handling for Vitest integration
- Loading branch information
Showing
2 changed files
with
14 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,17 @@ | ||
export function getIsVitestStandaloneRun() { | ||
try { | ||
return process.env.VITEST_STORYBOOK === 'false'; | ||
} catch { | ||
try { | ||
// @ts-expect-error Suppress TypeScript warning about wrong setting. Doesn't matter, because we don't use tsc for bundling. | ||
return import.meta.env.VITEST_STORYBOOK === 'false'; | ||
} catch (e) { | ||
return false; | ||
} | ||
// @ts-expect-error Suppress TypeScript warning about wrong setting. Doesn't matter, because we don't use tsc for bundling. | ||
return import.meta.env.VITEST_STORYBOOK === 'false'; | ||
} catch (e) { | ||
return false; | ||
} | ||
} | ||
|
||
export function getIsVitestRunning() { | ||
try { | ||
return process?.env.MODE === 'test'; | ||
} catch { | ||
try { | ||
// @ts-expect-error Suppress TypeScript warning about wrong setting. Doesn't matter, because we don't use tsc for bundling. | ||
return import.meta.env.MODE === 'test'; | ||
} catch (e) { | ||
return false; | ||
} | ||
// @ts-expect-error Suppress TypeScript warning about wrong setting. Doesn't matter, because we don't use tsc for bundling. | ||
return import.meta.env.MODE === 'test'; | ||
} catch (e) { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters