-
Notifications
You must be signed in to change notification settings - Fork 50
/
global-declarations.ts
50 lines (42 loc) · 1.31 KB
/
global-declarations.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* @license
* Copyright 2022-2024 Matter.js Authors
* SPDX-License-Identifier: Apache-2.0
*/
import type Chai from "chai";
import "chai-as-promised";
import type { MockLogger } from "./mocks/logging.js";
import type { MockTime } from "./mocks/time.js";
declare global {
// Expose Chai globally
const expect: typeof Chai.expect;
// Expose API for controlling time
let MockTime: MockTime;
// Expose API for controlling logging
let MockLogger: MockLogger;
/**
* If present, the following hooks are engaged by matter.js packages to
* enable mocking. We use globals rather than imports so we can hook the
* modules regardless of whether they're loaded as CommonJS or ESM.
*/
let MatterHooks:
| undefined
| {
/**
* Configure time.
*/
timeSetup?: (Time: any) => void;
/**
* Configure logging.
*/
loggerSetup?: (Logger: any) => void;
/**
* Configure crypto.
*/
cryptoSetup?: (Crypto: any) => void;
/**
* Receive intercepted log messages. The logging mocks
*/
loggerSink?: (level: number, message: string) => void;
};
}