question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Testing module compatibility

See original GitHub issue

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:

assertEqual(actual, expected, msg);
assert(equal(actual, expected), msg);

Node implementation:

assert.equal(actual, expected, msg);

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 an Object.is alone (as deepEqual exists for the former)
  • An AssertionError is thrown rather than an Error in node
  • Negated functions exist in node such as notEqual

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
kitsonkcommented, Jan 16, 2019

Personally I would rather take queues from Chai assert personally.

The behaviour of assertEqual() and equal() is already established, both in all of std but also the core of Deno. There is a lot of tests that depend upon that deep comparison behaviour.

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.

0reactions
43081jcommented, Jan 20, 2019

The reason for equal being simple (value equality check, usually) is that we can then have a deepEqual for when we want recursive equality checks. Leaving equal to do a deep check seems fine as long as we then have a strictEqual or similar, for when we don’t want deep equality (which would be Object.is pretty much).

I agree with your rejects idea, too, but it could be argued that both should be supported in that case. If dealing with promises directly, it sounds logical to have rejects and resolves, but if dealing with async functions, it sounds logical to have throwsAsync and returnsAsync. Really depends on what context you’re in.

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 equal and assert.equal being exported which can be a little confusing (one doesn’t assert). It probably shouldn’t be exposed anymore but again would need a bunch of updates to other modules.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is Software Compatibility Testing?
Compatibility is non-functional testing to ensure customer satisfaction. It is to determine whether your software application or product is ...
Read more >
What is a compatibility test? Definition from WhatIs.com.
A compatibility test is an assessment used to ensure a software application is properly working across different browsers, databases, operating systems (OS) ...
Read more >
module compatibility test - YouTube
Product testing,module customer module test, every details Purchase directly: https://gzcom.en.alibaba. ... module compatibility test.
Read more >
Compatibility Test Suite | Android Open Source Project
The Compatibility Test Suite (CTS) is a free, commercial-grade test suite, available for download as a binary or as source in the Android ......
Read more >
CTS-D is a new Compatibility Test Suite module with tests ...
CTS-D is a new CTS module that includes compatibility tests written by app developers. It already consists of a few tests contributed by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found