-
Notifications
You must be signed in to change notification settings - Fork 638
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
Testing module compatibility #122
Comments
also, regarding #124: Node deprecated all non-strict methods a while ago so, given we don't have the same constraints, I think it would make sense to have ours strict by default (i.e. we have The recent changes did move more toward what the node API is but still have completely different behaviour.
Any value equality checks should then be done by |
Personally I would rather take queues from Chai assert personally. The behaviour of I don't think we should be pedantic about following anyone else's behaviour. We can take queues and patterns from others. The benefit of TypeScript and JSDoc is that the APIs can be self documenting if there is any confusion. |
I don't think it is about being pedantic and following other behaviours for that reason, but rather that these implementations are well established and known. Any difference in behaviour will lead to confusion as nobody is starting 'new' with deno, they will have used one of the widely used assertion libraries beforehand.
Even if we take chai as an example to work from, it too has different behaviour and is closer to what node implements. The lack of an assertion exception is a huge one, too, as you can already see repetition in the recent PR (error logging is repeated). There should be one source of assertion messages which we can keep very clean. I think all i listed still applies even if you follow chai, other than the naming convention and strictness. |
I don't think all of your ideas apply personally, but even at that, this would be a meta issue for a lot of other issues that we could/should tackle. Having an We can/should deprecate The behaviour though, while I wasn't a fan of it, is embedded in the conventions of Deno now. It has a wider view of what equal is than a lot of other assertion libraries, but that doesn't make it "wrong". So again, I think each point could be tackled as a seperate issue. |
For example, I would say |
The reason for I agree with your Anyhow, i'm happy to open a few issues separately about these things but the idea of this issue in particular was to identify what those are. Also, there's now |
At the minute we don't really seem to follow node's assertion interfaces or anyone else's.
Is there any reference as to what convention was followed or was it thought up just for deno?
It may be worth rewriting the testing module to adhere to node's assertion module and be entirely compatible.
Basically current implementation:
Node implementation:
So:
assertEqual
doesn't seem to be needed, only for setting a nice message (deepEqual and equal would do this themselves)equal
does a deep equality check for us but in node does anObject.is
alone (asdeepEqual
exists for the former)AssertionError
is thrown rather than anError
in nodenotEqual
The text was updated successfully, but these errors were encountered: