Skip to content

Commit 95e1231

Browse files
authored
chore: fix sinon leak in tests (#3200)
1 parent 5b3d01b commit 95e1231

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ pids
1010
*.tmp
1111
*.dat
1212
*.png
13+
*.heapsnapshot
14+
*.cpuprofile
15+
*.heapprofile
1316
test*.*
1417
output
1518
etc/docs/template/.hugo_build.lock

test/integration/node-specific/bson-options/utf8_validation.test.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import { expect } from 'chai';
2-
import { spy } from 'sinon';
2+
import * as sinon from 'sinon';
33

44
import * as BSON from '../../../../src/bson';
55

6-
const deserializeSpy = spy(BSON, 'deserialize');
7-
86
const EXPECTED_VALIDATION_DISABLED_ARGUMENT = {
97
utf8: false
108
};
@@ -16,8 +14,15 @@ const EXPECTED_VALIDATION_ENABLED_ARGUMENT = {
1614
};
1715

1816
describe('class BinMsg', () => {
17+
let deserializeSpy: sinon.SinonSpy;
18+
1919
beforeEach(() => {
20-
deserializeSpy.resetHistory();
20+
deserializeSpy = sinon.spy(BSON, 'deserialize');
21+
});
22+
23+
afterEach(() => {
24+
deserializeSpy.restore();
25+
deserializeSpy = null;
2126
});
2227

2328
describe('enableUtf8Validation option set to false', () => {

0 commit comments

Comments
 (0)