diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 93078ccb..0aafc107 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -160,8 +160,7 @@ jobs: timeout_minutes: 5 max_attempts: 1 command: | - pnpm run clean - pnpm run test.skip_gc_tests + pnpm run test continue-on-error: true - name: Test Electron (Main) @@ -173,7 +172,6 @@ jobs: command: | sudo apt-get install xvfb pnpm install -g electron@latest - pnpm run clean xvfb-run --auto-servernum pnpm run test.electron.main continue-on-error: true @@ -184,6 +182,5 @@ jobs: timeout_minutes: 5 max_attempts: 1 command: | - pnpm run clean pnpm run test continue-on-error: true diff --git a/.mocharc.js b/.mocharc.js index 9b823c30..e1f933cf 100644 --- a/.mocharc.js +++ b/.mocharc.js @@ -4,6 +4,7 @@ module.exports = { require: ["ts-node/register", "rocha"], spec: ["test/unit/*-test.ts", "test/unit/compat/*-test.{ts,js}"], "expose-gc": true, + "v8-expose-gc": true, "experimental-worker": true, recursive: true, } diff --git a/test/package.json b/test/package.json index 701c7a33..755aa163 100644 --- a/test/package.json +++ b/test/package.json @@ -1,6 +1,6 @@ { "devDependencies": { "@types/weak-napi": "^2.0.3", - "weak-napi": "^2.0.2" + "weak-napi": "https://github.com/aminya/weak-napi#ea97678fc4c9304eea7f3fb1ddc88eaf59cccc6f" } } diff --git a/test/pnpm-lock.yaml b/test/pnpm-lock.yaml index cb54e0d3..78ff61a8 100644 --- a/test/pnpm-lock.yaml +++ b/test/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^2.0.3 version: 2.0.3 weak-napi: - specifier: ^2.0.2 - version: 2.0.2 + specifier: https://github.com/aminya/weak-napi#ea97678fc4c9304eea7f3fb1ddc88eaf59cccc6f + version: https://codeload.github.com/aminya/weak-napi/tar.gz/ea97678fc4c9304eea7f3fb1ddc88eaf59cccc6f packages: @@ -29,8 +29,9 @@ packages: get-uv-event-loop-napi-h@1.0.6: resolution: {integrity: sha512-t5c9VNR84nRoF+eLiz6wFrEp1SE2Acg0wS+Ysa2zF0eROes+LzOfuTaVHxGy8AbS8rq7FHEJzjnCZo1BupwdJg==} - node-addon-api@3.2.1: - resolution: {integrity: sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==} + node-addon-api@8.0.0: + resolution: {integrity: sha512-ipO7rsHEBqa9STO5C5T10fj732ml+5kLN1cAG8/jdHd56ldQeGj3Q7+scUS+VHK/qy1zLEwC4wMK5+yM0btPvw==} + engines: {node: ^18 || ^20 || >= 21} node-gyp-build@4.8.1: resolution: {integrity: sha512-OSs33Z9yWr148JZcbZd5WiAXhh/n9z8TxQcdMhIOlpN9AhWpLfvVFO73+m77bBABQMaY9XSvIa+qk0jlI7Gcaw==} @@ -42,8 +43,9 @@ packages: undici-types@5.26.5: resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} - weak-napi@2.0.2: - resolution: {integrity: sha512-LcOSVFrghtVXf4QH+DLIy8iPiCktV7lVbqRDYP+bDPpLzC41RCHQPMyQOnPpWO41Ie4CmnDxS+mbL72r5xFMMQ==} + weak-napi@https://codeload.github.com/aminya/weak-napi/tar.gz/ea97678fc4c9304eea7f3fb1ddc88eaf59cccc6f: + resolution: {tarball: https://codeload.github.com/aminya/weak-napi/tar.gz/ea97678fc4c9304eea7f3fb1ddc88eaf59cccc6f} + version: 2.0.2 snapshots: @@ -61,7 +63,7 @@ snapshots: dependencies: get-symbol-from-current-process-h: 1.0.2 - node-addon-api@3.2.1: {} + node-addon-api@8.0.0: {} node-gyp-build@4.8.1: {} @@ -72,8 +74,8 @@ snapshots: undici-types@5.26.5: {} - weak-napi@2.0.2: + weak-napi@https://codeload.github.com/aminya/weak-napi/tar.gz/ea97678fc4c9304eea7f3fb1ddc88eaf59cccc6f: dependencies: - node-addon-api: 3.2.1 + node-addon-api: 8.0.0 node-gyp-build: 4.8.1 setimmediate-napi: 1.0.6 diff --git a/test/unit/socket-close-test.ts b/test/unit/socket-close-test.ts index 1e7a8e55..dc2cc173 100644 --- a/test/unit/socket-close-test.ts +++ b/test/unit/socket-close-test.ts @@ -107,9 +107,14 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { }) it("should release reference to context", async function () { - if (process.env.SKIP_GC_TESTS) { + if (process.env.SKIP_GC_TESTS === "true") { this.skip() } + if (global.gc === undefined) { + console.warn("gc is not exposed by the runtime") + this.skip() + } + this.slow(200) const weak = require("weak-napi") as typeof import("weak-napi") @@ -124,14 +129,14 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { }) context = undefined - global.gc?.() + global.gc!() socket.connect(uniqAddress(proto)) await socket.send(Buffer.from("foo")) socket.close() } await task() - global.gc?.() + global.gc() await new Promise(resolve => { setTimeout(resolve, 5) }) @@ -141,10 +146,11 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { describe("in gc finalizer", function () { it("should release reference to context", async function () { - if (process.env.SKIP_GC_TESTS) { + if (process.env.SKIP_GC_TESTS === "true") { this.skip() } - if (process.env.SKIP_GC_FINALIZER_TESTS) { + if (global.gc === undefined) { + console.warn("gc is not exposed by the runtime") this.skip() } this.slow(200) @@ -155,17 +161,17 @@ for (const proto of testProtos("tcp", "ipc", "inproc")) { const task = async () => { let context: zmq.Context | undefined = new zmq.Context() - new zmq.Dealer({context, linger: 0}) + const _dealer = new zmq.Dealer({context, linger: 0}) weak(context, () => { released = true }) context = undefined - global.gc?.() + global.gc!() } await task() - global.gc?.() + global.gc() await new Promise(resolve => { setTimeout(resolve, 5) }) diff --git a/test/unit/socket-zap-test.ts b/test/unit/socket-zap-test.ts index 213cef1e..d0aeb58d 100644 --- a/test/unit/socket-zap-test.ts +++ b/test/unit/socket-zap-test.ts @@ -162,6 +162,10 @@ for (const proto of testProtos("tcp", "ipc")) { if (semver.satisfies(zmq.version, "< 4.3.0")) { this.skip() } + if (zmq.capability.curve !== true) { + console.warn("Curve not supported by this zmq build") + this.skip() + } this.slow(250) diff --git a/typedoc.json b/typedoc.json index a3a660ec..16277d4d 100644 --- a/typedoc.json +++ b/typedoc.json @@ -11,7 +11,8 @@ "test/**/*", "examples/**/*", "src/errors.ts", - "src/util.ts" + "src/util.ts", + "build/**/*" ], "cleanOutputDir": true, "pretty": false,