-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathglobal.ts
More file actions
30 lines (27 loc) · 829 Bytes
/
global.ts
File metadata and controls
30 lines (27 loc) · 829 Bytes
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
import * as sinon from "sinon";
import Redis from "../../lib/redis";
afterEach(function (done) {
sinon.restore();
new Redis()
.pipeline()
.flushall()
.script("flush")
.client("kill", "normal")
.exec(done);
});
process.on("unhandledRejection", (reason) => {
console.log("mocha test saw unexpected unhandledRejection", reason);
throw new Error("mocha test saw unexpected unhandledRejection: " + reason);
});
// Suppress "Unhandled error event" logs from edge cases that are deliberately being tested.
// Don't suppress other error types, such as errors in typescript files.
const error = console.error;
console.error = function (...args) {
if (
typeof args[0] === "string" &&
args[0].indexOf("[ioredis] Unhandled error event") === 0
) {
return;
}
error.call(console, ...args);
};