Open victor-yanev opened 1 week ago
18 files 246 suites 30m 53s :stopwatch: 602 tests 595 :heavy_check_mark: 4 :zzz: 3 :x: 660 runs 653 :heavy_check_mark: 4 :zzz: 3 :x:
Results for commit 62cda738.
:recycle: This comment has been updated with latest results.
3 files 369 suites 18s :stopwatch: 1 361 tests 1 360 :heavy_check_mark: 1 :zzz: 0 :x: 1 370 runs 1 369 :heavy_check_mark: 1 :zzz: 0 :x:
Results for commit 62cda738.
:recycle: This comment has been updated with latest results.
Failed conditions
10.7% Duplication on New Code (required ≤ 3%)
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 82.71%. Comparing base (
a3615c5
) to head (62cda73
).
Description:
In the current setup, there is no straightforward way to temporarily override environment variables for the duration of a test suite. This can lead to issues where tests inadvertently affect each other due to shared environment settings, making it difficult to isolate and reproduce test failures.
Additionally, in many tests environment variables are overridden without being reverted, propagating this behavior to other tests and making the tests dependent on their order and leading to chain-failures in cases where only one of the tests actually fails.
Changes:
This PR adds new helper methods
overrideEnvs
andwithOverriddenEnvs
which provide a mechanism to temporarily set environment variables for the duration of a test or a group of tests.ℹ️ These methods ensure that the original environment settings are restored after the tests have run, maintaining the integrity of the global environment.
overrideEnvs
: Temporarily sets environment variables before a test and restores them afterward.withOverriddenEnvs
: A higher-level function that usesoverrideEnvs
to set environment variables for a group of tests defined within a callback function.Related issue(s):
Fixes #3029
Checklist