You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using fluture/test/assertions.js with Json is never reference-equal when Json is imported from a commonjs module and esm module and compared with equivalence.
When using Json from 'fluture-express', if you test subject is a commonjs module, then the value in the Json object is not reference-equal and tests with equivalence from 'fluture/test/assertions.js' will fail even though the tests should pass.
Error:
resolve ({"body": {"data": {"foo": "bar"}}, "head": []}) :: Future({ <resolved> {"body": {"data": {"foo": "bar"}}, "head": []} })
is not equivalent to:
resolve ({"body": {"data": {"foo": "bar"}}, "head": []}) :: Future({ <resolved> {"body": {"data": {"foo": "bar"}}, "head": []} })
The inner values are not equal: Values have same structure but are not reference-equal
Example of error message when Json is not imported via esm.
However, note that it does not matter if your test data is from a commonjs module or EcmaScript module (esm).
It boils down to strictEqual and show from 'sanctuary-show' not playing nice together. I guess that the output of show (a) changes depending on module format. But that is a guess.
equivalence checks the inner value of two Futures using assert.deepStrictEqual.
That in turn test the prototypes of the inner value.
Because Json has a CommonJS version and a ESM version, those two prototypes
will be different and equivalence will fail for two seemingly identical values.
Using fluture/test/assertions.js with
Json
is never reference-equal whenJson
is imported from a commonjs module and esm module and compared withequivalence
.When using
Json
from'fluture-express'
, if you test subject is a commonjs module, then the value in theJson
object is not reference-equal and tests withequivalence
from'fluture/test/assertions.js'
will fail even though the tests should pass.Example of error message when
Json
is not imported via esm.However, note that it does not matter if your test data is from a commonjs module or EcmaScript module (esm).
A thorough run down is in the https://github.com/dotnetCarpenter/fluture-test-gotcha repository.
It boils down to
strictEqual
andshow
from 'sanctuary-show' not playing nice together. I guess that the output ofshow (a)
changes depending on module format. But that is a guess.strictEqual.mjs and strictEqual.js
The text was updated successfully, but these errors were encountered: