diff --git a/changelog.d/1680.misc b/changelog.d/1680.misc new file mode 100644 index 000000000..f3f1b496b --- /dev/null +++ b/changelog.d/1680.misc @@ -0,0 +1 @@ +Make spec reporting consistent with matrix-appservice-bridge diff --git a/package-lock.json b/package-lock.json index 30eff9d29..c76e2cd44 100644 --- a/package-lock.json +++ b/package-lock.json @@ -62,7 +62,8 @@ "eslint-plugin-react": "^7.32.2", "eslint-plugin-react-hooks": "^4.6.0", "homerunner-client": "^0.0.6", - "jasmine": "^3.99.0", + "jasmine": "^4.2.1", + "jasmine-spec-reporter": "^7.0.0", "jest": "^29.1.1", "node-mocks-http": "^1.12.1", "nyc": "^15.1.0", @@ -3306,6 +3307,15 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" }, + "node_modules/colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", + "dev": true, + "engines": { + "node": ">=0.1.90" + } + }, "node_modules/colorspace": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/colorspace/-/colorspace-1.1.4.tgz", @@ -5862,24 +5872,33 @@ } }, "node_modules/jasmine": { - "version": "3.99.0", - "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.99.0.tgz", - "integrity": "sha512-YIThBuHzaIIcjxeuLmPD40SjxkEcc8i//sGMDKCgkRMVgIwRJf5qyExtlJpQeh7pkeoBSOe6lQEdg+/9uKg9mw==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-4.5.0.tgz", + "integrity": "sha512-9olGRvNZyADIwYL9XBNBst5BTU/YaePzuddK+YRslc7rI9MdTIE4r3xaBKbv2GEmzYYUfMOdTR8/i6JfLZaxSQ==", "dev": true, "dependencies": { "glob": "^7.1.6", - "jasmine-core": "~3.99.0" + "jasmine-core": "^4.5.0" }, "bin": { "jasmine": "bin/jasmine.js" } }, "node_modules/jasmine-core": { - "version": "3.99.1", - "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.99.1.tgz", - "integrity": "sha512-Hu1dmuoGcZ7AfyynN3LsfruwMbxMALMka+YtZeGoLuDEySVmVAPaonkNoBRIw/ectu8b9tVQCJNgp4a4knp+tg==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-4.5.0.tgz", + "integrity": "sha512-9PMzyvhtocxb3aXJVOPqBDswdgyAeSB81QnLop4npOpbqnheaTEwPc9ZloQeVswugPManznQBjD8kWDTjlnHuw==", "dev": true }, + "node_modules/jasmine-spec-reporter": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/jasmine-spec-reporter/-/jasmine-spec-reporter-7.0.0.tgz", + "integrity": "sha512-OtC7JRasiTcjsaCBPtMO0Tl8glCejM4J4/dNuOJdA8lBjz4PmWjYQ6pzb0uzpBNAWJMDudYuj9OdXJWqM2QTJg==", + "dev": true, + "dependencies": { + "colors": "1.4.0" + } + }, "node_modules/jest": { "version": "29.1.2", "resolved": "https://registry.npmjs.org/jest/-/jest-29.1.2.tgz", @@ -12646,6 +12665,12 @@ "simple-swizzle": "^0.2.2" } }, + "colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", + "dev": true + }, "colorspace": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/colorspace/-/colorspace-1.1.4.tgz", @@ -14561,21 +14586,30 @@ } }, "jasmine": { - "version": "3.99.0", - "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.99.0.tgz", - "integrity": "sha512-YIThBuHzaIIcjxeuLmPD40SjxkEcc8i//sGMDKCgkRMVgIwRJf5qyExtlJpQeh7pkeoBSOe6lQEdg+/9uKg9mw==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-4.5.0.tgz", + "integrity": "sha512-9olGRvNZyADIwYL9XBNBst5BTU/YaePzuddK+YRslc7rI9MdTIE4r3xaBKbv2GEmzYYUfMOdTR8/i6JfLZaxSQ==", "dev": true, "requires": { "glob": "^7.1.6", - "jasmine-core": "~3.99.0" + "jasmine-core": "^4.5.0" } }, "jasmine-core": { - "version": "3.99.1", - "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.99.1.tgz", - "integrity": "sha512-Hu1dmuoGcZ7AfyynN3LsfruwMbxMALMka+YtZeGoLuDEySVmVAPaonkNoBRIw/ectu8b9tVQCJNgp4a4knp+tg==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-4.5.0.tgz", + "integrity": "sha512-9PMzyvhtocxb3aXJVOPqBDswdgyAeSB81QnLop4npOpbqnheaTEwPc9ZloQeVswugPManznQBjD8kWDTjlnHuw==", "dev": true }, + "jasmine-spec-reporter": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/jasmine-spec-reporter/-/jasmine-spec-reporter-7.0.0.tgz", + "integrity": "sha512-OtC7JRasiTcjsaCBPtMO0Tl8glCejM4J4/dNuOJdA8lBjz4PmWjYQ6pzb0uzpBNAWJMDudYuj9OdXJWqM2QTJg==", + "dev": true, + "requires": { + "colors": "1.4.0" + } + }, "jest": { "version": "29.1.2", "resolved": "https://registry.npmjs.org/jest/-/jest-29.1.2.tgz", diff --git a/package.json b/package.json index e17db9c08..63faa13d4 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,8 @@ "eslint-plugin-react": "^7.32.2", "eslint-plugin-react-hooks": "^4.6.0", "homerunner-client": "^0.0.6", - "jasmine": "^3.99.0", + "jasmine": "^4.2.1", + "jasmine-spec-reporter": "^7.0.0", "jest": "^29.1.1", "node-mocks-http": "^1.12.1", "nyc": "^15.1.0", diff --git a/spec/helpers/log.js b/spec/helpers/log.js new file mode 100644 index 000000000..68d3464f8 --- /dev/null +++ b/spec/helpers/log.js @@ -0,0 +1,5 @@ +const { SpecReporter } = require('jasmine-spec-reporter'); + + +jasmine.getEnv().clearReporters(); // Clear default console reporter +jasmine.getEnv().addReporter(new SpecReporter()); diff --git a/spec/integ/irc-modes.spec.js b/spec/integ/irc-modes.spec.js index 6f5e0e97c..1b68f5a87 100644 --- a/spec/integ/irc-modes.spec.js +++ b/spec/integ/irc-modes.spec.js @@ -40,7 +40,7 @@ describe("IRC-to-Matrix mode bridging", () => { afterEach(async () => test.afterEach(env)); - it("should set join_rules to 'invite' on +k.", async (done) => { + it("should set join_rules to 'invite' on +k.", async () => { sdk.sendStateEvent.and.callFake((roomId, type, key, content) => { expect(roomId).toEqual(roomMapping.roomId); expect(type).toEqual("m.room.join_rules"); @@ -48,14 +48,13 @@ describe("IRC-to-Matrix mode bridging", () => { join_rule: "invite" }); expect(key).toEqual(""); - done(); }); const client = await env.ircMock._findClientAsync(roomMapping.server, roomMapping.botNick); client.emit("+mode", roomMapping.channel, "anIrcUser", "k"); }); - it("should set join_rules to 'invite' on +i.", async (done) => { + it("should set join_rules to 'invite' on +i.", async () => { sdk.sendStateEvent.and.callFake((roomId, type, key, content) => { expect(roomId).toEqual(roomMapping.roomId); expect(type).toEqual("m.room.join_rules"); @@ -63,14 +62,13 @@ describe("IRC-to-Matrix mode bridging", () => { join_rule: "invite" }); expect(key).toEqual(""); - done(); }); const client = await env.ircMock._findClientAsync(roomMapping.server, roomMapping.botNick); client.emit("+mode", roomMapping.channel, "anIrcUser", "i"); }); - it("should revert join_rules to config value on -i.", async (done) => { + it("should revert join_rules to config value on -i.", async () => { sdk.sendStateEvent.and.callFake((roomId, type, key, content) => { expect(roomId).toEqual(roomMapping.roomId); expect(type).toEqual("m.room.join_rules"); @@ -78,14 +76,13 @@ describe("IRC-to-Matrix mode bridging", () => { join_rule: configJoinRule }); expect(key).toEqual(""); - done(); }); const client = await env.ircMock._findClientAsync(roomMapping.server, roomMapping.botNick); client.emit("-mode", roomMapping.channel, "anIrcUser", "i"); }); - it("should revert join_rules to config value on -k.", async (done) => { + it("should revert join_rules to config value on -k.", async () => { sdk.sendStateEvent.and.callFake((roomId, type, key, content) => { expect(roomId).toEqual(roomMapping.roomId); expect(type).toEqual("m.room.join_rules"); @@ -93,7 +90,6 @@ describe("IRC-to-Matrix mode bridging", () => { join_rule: configJoinRule }); expect(key).toEqual(""); - done(); }); const client = await env.ircMock._findClientAsync(roomMapping.server, roomMapping.botNick); diff --git a/spec/util/test.js b/spec/util/test.js index d3ee3cc76..f6a92af50 100644 --- a/spec/util/test.js +++ b/spec/util/test.js @@ -20,14 +20,6 @@ const main = proxyquire("../../lib/main.js", { "matrix-org-irc": ircMock, }); -// Log the test case. Jasmine is a global var. -jasmine.getEnv().addReporter({ - specStarted: function(result) { - console.log(result.fullName); - console.log("=".repeat(result.fullName.length + 1)); - } -}); - let pgClient; let pgClientConnectPromise;