Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make spec reporting consistent with matrix-appservice-bridge #1680

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/1680.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make spec reporting consistent with matrix-appservice-bridge
64 changes: 49 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point I want to toss out jasmine and replace with jest to broadly be aligned with the rest of matrix-org, but for now any improvements are good.

"jasmine-spec-reporter": "^7.0.0",
"jest": "^29.1.1",
"node-mocks-http": "^1.12.1",
"nyc": "^15.1.0",
Expand Down
5 changes: 5 additions & 0 deletions spec/helpers/log.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const { SpecReporter } = require('jasmine-spec-reporter');


jasmine.getEnv().clearReporters(); // Clear default console reporter
jasmine.getEnv().addReporter(new SpecReporter());
12 changes: 4 additions & 8 deletions spec/integ/irc-modes.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,60 +40,56 @@ 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");
expect(content).toEqual({
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");
expect(content).toEqual({
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");
expect(content).toEqual({
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");
expect(content).toEqual({
join_rule: configJoinRule
});
expect(key).toEqual("");
done();
});

const client = await env.ircMock._findClientAsync(roomMapping.server, roomMapping.botNick);
Expand Down
8 changes: 0 additions & 8 deletions spec/util/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

god, what a wart.

specStarted: function(result) {
console.log(result.fullName);
console.log("=".repeat(result.fullName.length + 1));
}
});

let pgClient;
let pgClientConnectPromise;

Expand Down