Skip to content

Commit 4cf789d

Browse files
committed
test: convert compat gc tests to typescript
1 parent 18e704a commit 4cf789d

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

src/compat.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ class Socket extends EventEmitter {
301301
return this
302302
}
303303

304-
send(message: zmq.MessageLike[], flags = 0, cb?: Callback) {
304+
send(message: zmq.MessageLike[] | zmq.MessageLike, flags = 0, cb?: Callback) {
305305
flags = flags | 0
306306
this._msg = this._msg.concat(message)
307307
if ((flags & sendOptions.ZMQ_SNDMORE) === 0) {

test/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"include": ["**/*.ts"],
44
"compilerOptions": {
55
"skipLibCheck": true
6-
}
6+
},
7+
"compileOnSave": false
78
}

test/unit/compat/gc-test.js renamed to test/unit/compat/gc-test.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
import * as zmq from "../../../v5-compat"
2+
import {assert} from "chai"
3+
import { testProtos, uniqAddress } from "../helpers"
4+
15
if (process.env.INCLUDE_COMPAT_TESTS) {
2-
const zmq = require("./load")
3-
const {assert} = require("chai")
4-
const {testProtos, uniqAddress} = require("../helpers")
56

67
for (const proto of testProtos("tcp", "inproc")) {
78
describe(`compat socket with ${proto}`, function () {
8-
it("should cooperate with gc", function (done) {
9+
it("should cooperate with gc", async function (done) {
910
const sockA = zmq.socket("dealer")
1011
const sockB = zmq.socket("dealer")
1112

@@ -28,7 +29,7 @@ if (process.env.INCLUDE_COMPAT_TESTS) {
2829

2930
let bound = false
3031

31-
const address = uniqAddress(proto)
32+
const address = await uniqAddress(proto)
3233
sockA.bind(address, err => {
3334
if (err) {
3435
clearInterval(interval)

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@
2424
// only used in tests
2525
"ES2021.WeakRef"
2626
]
27-
}
27+
},
28+
"compileOnSave": true
2829
}

0 commit comments

Comments
 (0)