Files
appium/packages/test-support/lib/time-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

25 lines
453 B
JavaScript

/** @deprecated */
function fakeTime(sandbox) {
let clock = sandbox.useFakeTimers();
return new TimeLord(clock);
}
class TimeLord {
constructor(clock) {
this.clock = clock;
}
speedup(interval, times) {
let tick = (n) => {
if (n === 0) return; // eslint-disable-line curly
process.nextTick(() => {
this.clock.tick(interval);
n--;
tick(n);
});
};
tick(times);
}
}
export {fakeTime};