Skip to content

Commit dc918ae

Browse files
Check leaks in Mocha
1 parent 7543d8b commit dc918ae

File tree

3 files changed

+3
-38
lines changed

3 files changed

+3
-38
lines changed

.mocharc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"checkLeaks": true
3+
}

ts/test-node/quill/emoji/completion_test.tsx renamed to ts/test-electron/quill/emoji/completion_test.tsx

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ import sinon from 'sinon';
77
import { EmojiCompletion } from '../../../quill/emoji/completion';
88
import { EmojiData } from '../../../components/emoji/lib';
99

10-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
11-
const globalAsAny = global as any;
12-
1310
describe('emojiCompletion', () => {
1411
let emojiCompletion: EmojiCompletion;
1512
const mockOnPickEmoji = sinon.spy();
@@ -18,14 +15,6 @@ describe('emojiCompletion', () => {
1815
let mockQuill: any;
1916

2017
beforeEach(function beforeEach() {
21-
this.oldDocument = globalAsAny.document;
22-
globalAsAny.document = {
23-
body: {
24-
appendChild: () => null,
25-
},
26-
createElement: () => null,
27-
};
28-
2918
mockQuill = {
3019
getLeaf: sinon.stub(),
3120
getSelection: sinon.stub(),
@@ -55,12 +44,6 @@ describe('emojiCompletion', () => {
5544
mockOnPickEmoji.resetHistory();
5645
mockSetEmojiPickerElement.resetHistory();
5746
(emojiCompletion.render as sinon.SinonStub).resetHistory();
58-
59-
if (this.oldDocument === undefined) {
60-
delete globalAsAny.document;
61-
} else {
62-
globalAsAny.document = this.oldDocument;
63-
}
6447
});
6548

6649
describe('getCurrentLeafTextPartitions', () => {

ts/test-node/quill/mentions/completion_test.tsx renamed to ts/test-electron/quill/mentions/completion_test.tsx

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,6 @@ const members: Array<ConversationType> = [
5252
me,
5353
];
5454

55-
declare global {
56-
// eslint-disable-next-line @typescript-eslint/no-namespace
57-
namespace NodeJS {
58-
interface Global {
59-
document: {
60-
body: {
61-
appendChild: unknown;
62-
};
63-
createElement: unknown;
64-
};
65-
}
66-
}
67-
}
68-
6955
describe('MentionCompletion', () => {
7056
const mockSetMentionPickerElement = sinon.spy();
7157

@@ -78,13 +64,6 @@ describe('MentionCompletion', () => {
7864
let mentionCompletion: MentionCompletion;
7965

8066
beforeEach(function beforeEach() {
81-
global.document = {
82-
body: {
83-
appendChild: sinon.spy(),
84-
},
85-
createElement: sinon.spy(),
86-
};
87-
8867
const memberRepositoryRef: MutableRefObject<MemberRepository> = {
8968
current: new MemberRepository(members),
9069
};

0 commit comments

Comments
 (0)