Skip to content

Commit 0d6cf7a

Browse files
authored
Merge pull request #1 from gribnoysup/resolve-on-close
fix: Call resolve in the close callback
2 parents 40cdd08 + 1364048 commit 0d6cf7a

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
"devDependencies": {
4949
"@types/mocha": "^8.0.3",
5050
"@types/node": "^16.4.10",
51-
"@typescript-eslint/eslint-plugin": "^4.2.0",
52-
"@typescript-eslint/parser": "^4.2.0",
51+
"@typescript-eslint/eslint-plugin": "^5.30.7",
52+
"@typescript-eslint/parser": "^5.30.7",
5353
"eslint": "^7.9.0",
5454
"eslint-config-semistandard": "^15.0.1",
5555
"eslint-config-standard": "^14.1.1",
@@ -62,7 +62,7 @@
6262
"mongodb": "^4.0.1",
6363
"mongodb-runner": "^4.8.3",
6464
"nyc": "^15.1.0",
65-
"ts-node": "^9.0.0",
66-
"typescript": "^4.3.5"
65+
"ts-node": "^10.9.1",
66+
"typescript": "^4.7.4"
6767
}
6868
}

src/parse-stream.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ export class WireProtocolParser extends Writable {
3232
}
3333
callback();
3434
} catch (err) {
35-
callback(err);
35+
// eslint-disable-next-line standard/no-callback-literal
36+
callback(err as Error);
3637
}
3738
}
3839
}

src/proxy.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ export class Proxy extends EventEmitter {
8686
}
8787

8888
async close(): Promise<void> {
89-
await new Promise<void>((resolve, reject) => this.srv.close((err) => err ? reject(err) : resolve));
89+
await new Promise<void>((resolve, reject) =>
90+
this.srv.close((err) => (err ? reject(err) : resolve()))
91+
);
9092
}
9193
}

test/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe('Proxy', function() {
3030

3131
afterEach(async() => {
3232
await client.close();
33-
proxy.close();
33+
await proxy.close();
3434
});
3535

3636
it('records ismaster events', async() => {

0 commit comments

Comments
 (0)