Skip to content

Commit

Permalink
fix: Use process directly instead of importing it. (#1714)
Browse files Browse the repository at this point in the history
* fix: Use process directly instead of importing it.

Fix: #1704
  • Loading branch information
Jason3S committed Sep 17, 2021
1 parent efc01bc commit db18a52
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/cspell-trie-lib/src/lib/timer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ const delay = promisify(setTimeout);
describe('timer', () => {
test('createTimer', async () => {
const t = createTimer();
await delay(11);
await delay(12);
expect(t.elapsed()).toBeGreaterThan(10);
});

test('polyHrTime', async () => {
const a = createTimer();
const b = createTimer(polyHrTime);
await delay(11);
await delay(12);
const a1 = a.elapsed();
const b1 = b.elapsed();
expect(a1).toBeGreaterThanOrEqual(10);
Expand Down
4 changes: 1 addition & 3 deletions packages/cspell-trie-lib/src/lib/timer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { hrtime } from 'process';

const _hrTime: HRTimeFn = hrtime || polyHrTime;
const _hrTime: HRTimeFn = process?.hrtime || polyHrTime;

export interface Timer {
/** Start / restart the timer. */
Expand Down

0 comments on commit db18a52

Please sign in to comment.