Skip to main content

· 2 min read
Lucas Magalhães

Today I'm releasing corde version 3, which has a full rework of its UI, providing a whole new experience for users, giving them detailed information about errors on each type of test, as well as a stack trace of each test if it throws an error.

Take a look on how the output were in version 2:

old ui

And how the UI is now:

new ui

As you can see, there are many changes such as:

  • Time track of the execution of the entire cycle of test, of each test file and each test function.
  • Display of each test file being executed.
  • Summary of which files were executed, how many functions were executed, and how much time it takes.
  • A more human-friendly color.

Also, tests are faster because we had a problem with tests verifications

Bellow is a snippet of toRenameRole test function:

await this.sendCommandMessage();
await wait(600);
role = await this.cordeBot.fetchRole(role.id);

The code above is sending the message to Discord and waiting a time to then check if the role was renamed. I don't have to say how terrible this approach was, but, fortunately, it was rewritten and now, Corde works fully with Discord Events.

With that, on each type of test, we wait for the emission of the event. It is MUCH more secure than the older way, and faster also. Take a look at how the same test function is now (toRenameRole):

await this.sendCommandMessage();

let newRole: Role;
try {
newRole = await this.cordeBot.events.onceRoleRenamed(identifier, this.timeOut);
} catch {
...
}

As you can see, now instead of waiting a time, and then checking if the role was renamed (it may not be renamed, in the defined time so, yeah, the test will falsely fail), we wait until Discord emmit the event of the role being renamed. But as the test can fail purposefully (or not), we can not wait forever, that is why we have the timeout parameter, which throws an error if the timeout reaches the informed time (defined in configs)

The full release information can be found here