Skip to content

Commit 3d54dba

Browse files
committed
test: fix the termination timeout during in terminate tests
1 parent 4459339 commit 3d54dba

File tree

7 files changed

+24
-19
lines changed

7 files changed

+24
-19
lines changed

.github/workflows/CI.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ jobs:
6565
docker: node:18-alpine
6666
docker_cmd:
6767
apk add --no-cache pkgconfig curl tar python3 make gcc g++ cmake
68-
musl-dev && npm i -g pnpm && pnpm install && pnpm run build.prebuild
68+
musl-dev && npm i -g pnpm && pnpm install && pnpm run
69+
build.prebuild
6970
node_version: 18
7071
node_arch: x64
7172
ARCH: x64

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@
9494
"build": "run-s build.js build.native",
9595
"build.debug": "run-s build.js build.native.debug",
9696
"test.deps": "cd test && pnpm install && cd ..",
97-
"test": "run-s clean.temp test.deps build && mocha --exit",
98-
"test.skip_gc_tests": "run-s clean.temp test.deps build.debug && cross-env SKIP_GC_TESTS=true mocha --exit",
97+
"test": "run-s clean.temp test.deps build && mocha",
98+
"test.skip_gc_tests": "run-s clean.temp test.deps build.debug && cross-env SKIP_GC_TESTS=true mocha",
9999
"test.electron.main": "run-s clean.temp test.deps build && electron-mocha",
100100
"format": "prettier --write .",
101101
"test.electron.renderer": "run-s build && electron-mocha --renderer",

script/tsconfig.esm.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
44
"module": "ESNext",
5-
"moduleResolution": "node",
5+
"moduleResolution": "node"
66
},
77
"include": ["./**/*.mts"],
88
"exclude": []

test/unit/proxy-router-dealer-test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ import {testProtos, uniqAddress} from "./helpers"
66

77
for (const proto of testProtos("tcp", "ipc", "inproc")) {
88
describe(`proxy with ${proto} router/dealer`, function () {
9+
/* ZMQ < 4.0.5 has no steerable proxy support. */
10+
if (semver.satisfies(zmq.version, "< 4.0.5")) {
11+
return
12+
}
13+
914
let proxy: zmq.Proxy
1015

1116
let frontAddress: string
@@ -15,11 +20,6 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) {
1520
let rep: zmq.Reply
1621

1722
beforeEach(async function () {
18-
/* ZMQ < 4.0.5 has no steerable proxy support. */
19-
if (semver.satisfies(zmq.version, "< 4.0.5")) {
20-
this.skip()
21-
}
22-
2323
proxy = new zmq.Proxy(new zmq.Router(), new zmq.Dealer())
2424

2525
frontAddress = uniqAddress(proto)
@@ -89,6 +89,8 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) {
8989
rep.close()
9090
}
9191

92+
console.log("waiting for messages")
93+
9294
await Promise.all([echo(), send()])
9395
assert.deepEqual(received, messages)
9496

test/unit/proxy-terminate-test.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ import {isFullError} from "../../src/errors"
77

88
for (const proto of testProtos("tcp", "ipc", "inproc")) {
99
describe(`proxy with ${proto} terminate`, function () {
10+
/* ZMQ < 4.0.5 has no steerable proxy support. */
11+
if (semver.satisfies(zmq.version, "< 4.0.5")) {
12+
return
13+
}
14+
1015
let proxy: zmq.Proxy
1116

1217
beforeEach(async function () {
13-
/* ZMQ < 4.0.5 has no steerable proxy support. */
14-
if (semver.satisfies(zmq.version, "< 4.0.5")) {
15-
this.skip()
16-
}
17-
1818
proxy = new zmq.Proxy(new zmq.Router(), new zmq.Dealer())
1919
})
2020

@@ -28,12 +28,13 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) {
2828
await proxy.frontEnd.bind(uniqAddress(proto))
2929
await proxy.backEnd.bind(uniqAddress(proto))
3030

31-
try {
32-
const timer = setTimeout(() => proxy.terminate(), 50)
33-
await proxy.run()
31+
const sleep_ms = 50
32+
33+
setTimeout(() => proxy.terminate(), sleep_ms)
34+
await proxy.run()
3435

36+
try {
3537
await proxy.terminate()
36-
timer.unref()
3738
assert.ok(false)
3839
} catch (err) {
3940
if (!isFullError(err)) {

test/unit/typings-compatibility-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
readFile,
99
writeFile,
1010
} from "fs-extra"
11-
import * as which from "which"
11+
import which from "which"
1212

1313
import {assert} from "chai"
1414

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"noUnusedParameters": false,
1717
"incremental": true,
1818
"sourceMap": true,
19+
"esModuleInterop": true,
1920
"lib": ["ES2020", "dom"]
2021
}
2122
}

0 commit comments

Comments
 (0)