diff --git a/packages/binding-mqtt/test/mqtt-client-subscribe-test.integration.ts b/packages/binding-mqtt/test/mqtt-client-subscribe-test.integration.ts index 25633e30c..c9f654fe2 100644 --- a/packages/binding-mqtt/test/mqtt-client-subscribe-test.integration.ts +++ b/packages/binding-mqtt/test/mqtt-client-subscribe-test.integration.ts @@ -22,6 +22,7 @@ import { expect, should } from "chai"; import MqttBrokerServer from "../src/mqtt-broker-server"; import MqttClientFactory from "../src/mqtt-client-factory"; import MqttsClientFactory from "../src/mqtts-client-factory"; +import { platform } from "os"; const info = createInfoLogger("binding-mqtt", "mqtt-client-subscribe-test.integration"); @@ -30,7 +31,7 @@ should(); describe("MQTT client implementation", () => { let servient: Servient; - let brokerServer: MqttBrokerServer; + let brokerServer: MqttBrokerServer | undefined; const brokerAddress = "localhost"; const brokerPort = 1889; @@ -42,18 +43,24 @@ describe("MQTT client implementation", () => { afterEach(async () => { await servient.shutdown(); - await brokerServer.stop(); + await brokerServer?.stop(); }); - it("should expose via broker", (done: Mocha.Done) => { + it("should expose via broker", function (done: Mocha.Done) { + // Skip this test on macOS until the underlying issue is fixed, + // see https://github.com/eclipse-thingweb/node-wot/issues/1159 + if (platform() === "darwin") { + this.skip(); + } + brokerServer = new MqttBrokerServer({ uri: brokerUri, selfHost: true }); servient.addServer(brokerServer); servient.addClientFactory(new MqttClientFactory()); servient.start().then((WoT) => { - expect(brokerServer.getPort()).to.equal(brokerPort); - expect(brokerServer.getAddress()).to.equal(brokerAddress); + expect(brokerServer?.getPort()).to.equal(brokerPort); + expect(brokerServer?.getAddress()).to.equal(brokerAddress); const eventNumber = Math.floor(Math.random() * 1000000); const eventName: string = "event" + eventNumber; @@ -102,7 +109,13 @@ describe("MQTT client implementation", () => { }); }).timeout(20000); - it("should expose via broker using mqtts", (done: Mocha.Done) => { + it("should expose via broker using mqtts", function (done: Mocha.Done) { + // Skip this test on macOS until the underlying issue is fixed, + // see https://github.com/eclipse-thingweb/node-wot/issues/1159 + if (platform() === "darwin") { + this.skip(); + } + brokerServer = new MqttBrokerServer({ uri: brokerUri, selfHost: true, @@ -114,8 +127,8 @@ describe("MQTT client implementation", () => { servient.addClientFactory(new MqttsClientFactory({ rejectUnauthorized: false })); servient.start().then((WoT) => { - expect(brokerServer.getPort()).to.equal(brokerPort); - expect(brokerServer.getAddress()).to.equal(brokerAddress); + expect(brokerServer?.getPort()).to.equal(brokerPort); + expect(brokerServer?.getAddress()).to.equal(brokerAddress); const eventNumber = Math.floor(Math.random() * 1000000); const eventName: string = "event" + eventNumber;