-
Notifications
You must be signed in to change notification settings - Fork 557
Closed
Description
Currently, this repo uses chai
and chai-as-promised
for assertions in tests. This works fine.
However, I'd like to propose moving to node:assert
if others are OK with it. The reasons:
- Fewer dependencies.
node:assert
is a Node core module. We could drop@types/chai
,@types/chai-as-promised
,chai
, andchai-as-promised
. - Some of chai's assertions are footguns. For example,
expect(opts.headers.Authorization).to.be.undefined;
. You can remove theundefined
part of this assertion and nothing will change. The hapi ecosystem actually forked chai, primarily over this issue. - The linter complains about these same assertions.
- We currently configure
chai-as-promised
inconsistently. We don't notice it because mocha runs all of the tests in the same process, but there are places where we usechai-as-promised
without configuring it in the current file. Obviously this alone is not a reason to migrate off of it, but it's worth noting.
The downsides:
node:assert
uses a different syntax. Instead ofexpect(emptyConfig.getCurrentCluster()).to.equal(null);
, it would be written asstrictEqual(emptyConfig.getCurrentCluster(), null);
. I know some people have a strong preference forexpect()
style assertions.- Someone would have to do the work of migrating. I volunteer to do it if no one is opposed.
Metadata
Metadata
Assignees
Labels
No labels