Files
appium/packages/test-support/lib/env-utils.js
Christopher Hiller 70d88cb86f feat(appium,base-driver,base-plugin,test-support,types): move test fixtures into test-support
- `@appium/test-support` now exports the e2e setup for plugins, and e2e/unit suites for drivers from base-driver.  it also generates declarations.
- `appium` exports this as `appium/test`.
- The `capability.spec.js` unit test for basedriver now avoids spying on the "global" logger, due to test flake.  It now spies directly on the function which calls the global logger. (@mykola_mokhnach)
- removed homebrew ansi-stripping code from `test-support` and replaced with `@colors/colors`
- type fixes and refactors for `@appium/test-support`
- type fixes for `appium`
- simplify `lib/index.js` of `@appium/base-driver`
2022-07-18 15:58:21 -07:00

17 lines
377 B
JavaScript

/**
* Creates Mocha "before each" and "after each" hooks to restore `process.env` after every test.
*/
function stubEnv() {
/** @type {NodeJS.ProcessEnv} */
let envBackup;
beforeEach(function beforeEach() {
envBackup = process.env;
process.env = {...process.env};
});
afterEach(function afterEach() {
process.env = envBackup;
});
}
export {stubEnv};