-
Notifications
You must be signed in to change notification settings - Fork 1
[Doppins] Upgrade dependency chai to ^4.2.0 #12
base: master
Are you sure you want to change the base?
Conversation
An additional new version was just released of Hope that's alright! |
An additional new version was just released of Hope that's alright! |
An additional new version was just released of Hope that's alright! |
An additional new version was just released of Hope that's alright! |
An additional new version was just released of Hope that's alright! |
An additional new version was just released of Hope that's alright! |
Hi!
A new version was just released of
chai
, so Doppinshas upgraded your project's dependency ranges.
Make sure that it doesn't break anything, and happy merging!
Upgraded chai from
^3.3.0
to^4.0.0
Changelog:
Version 4.0.0
4.0.0-canary.2 / 2017-04-17
The second release in the 4.0.0 canary release cycle. Around the end of April, barring any showstopper bugs, this will be released as
4.0.0
Breaking Changes
We've dropped support for Node 0.10 (See
#816
](https://github.com/chaijs/chai/pull/816
)) and Node 0.12 ([#901
(https://github.com/chaijs/chai/pull/901
)). The minimum supported version is now Node 4.0. If you wish to continue using older versions of Node with Chai, please continue to use the3.5.0
release. Officially, version 4.0.0 of chai supports Nodes 4, 6, 7, as well as the moving LTS version (currently 6.10.2). We plan to support Node 4 until at-least April 2018 (inline with Node Foundation support)..not.keys
on its own is now the equivalent of.not.all.keys
(#924
(https://github.com/chaijs/chai/pull/924
)). The docs mention this, and suggest to always pair.keys
with something.New Features
Added side-effectful "register" style scripts for each interface, (See
#868
](https://github.com/chaijs/chai/pull/868/files
)). This allows one torequire('chai/should')
which will automatically callglobal.should = chai.should()
. This is useful for users who wish to automatically get a global for their codebase. [Read the docs for more info (https://github.com/chaijs/chai/blob/4.0.0-canary.2/README.md#native-modules-usage-registers-the-chai-testing-style-globally
)!Added the
browser
field to the package json (#875
(https://github.com/chaijs/chai/pull/875
)). This will help with browser bundling tools.Added
.own.include
and.nested.include
(#926
(https://github.com/chaijs/chai/pull/926
)).If you attempt to call
.throws
with something that isn't a constructor (likeTypeError
) you will now get a more helpful error message about this. (before it would sayRight-hand side of 'instanceof' is not an object
, now it saysThe instanceof assertion needs a constructor but <type> was given
). (#899
(https://github.com/chaijs/chai/pull/899/files
)).Bug Fixes
Minor update deep-eql to 2.0.1 (
#871
(https://github.com/chaijs/chai/pull/871
)) which fixes bugs around Memoization, and lets comparators override evaluation of primitives.We've updated documentation and error handling around using
.length
(#897
(https://github.com/chaijs/chai/pull/897
)) - which can, in some cases, be problematic. Typically, you'll want to use.lengthOf
instead - but the documentation now makes this clear, and errors are more helpful when bad things happen.We've improved stack traces to strip out chai's internals, especially in newer environments which use Proxies (
#884
](https://github.com/chaijs/chai/pull/884
) and [#922
(https://github.com/chaijs/chai/pull/922
)).We've gone through and made sure every assertion honors the custom error message you pass it - some didn't! (
#947
(https://github.com/chaijs/chai/pull/947
)).getFuncName
has had an update since we pulled out the behaviour in4.0.0-canary.1
(#915
(https://github.com/chaijs/chai/pull/915
)). Practically this doesn't change anything in Chai.Documentation
#854
(https://github.com/chaijs/chai/pull/854
))#911
](https://github.com/chaijs/chai/pull/911
)),.throw
docs (#866
), and, well, just about all other docs ([#920
(https://github.com/chaijs/chai/pull/920
)). These docs are far more detailed now, explaining caveats, algorithms and best practices.Version 4.0.0
4.0.0-canary.1
Breaking Changes
Instead of allowing the user to write the path of a property, now the deep flag performs a deep equality comparison when used with the
.property
assertion.If you want the old behavior of using the dot or bracket notation to denote the property you want to assert against you can use the new
.nested
flag. (Related Issues:#745
,#743
, PRs:#758
,#757
)Please notice that the old methods which used the old behavior of the
deep
flag on theassert
interface have been renamed. They all have had thedeep
word changed by thenested
word. If you want to know more about this please take a look at#757
.Previously,
expect(obj).not.property(name, val)
would throw an Error ifobj
didn't have a property namedname
. This change causes the assertion to pass instead.The
assert.propertyNotVal
andassert.deepPropertyNotVal
assertions were renamed toassert.notPropertyVal
andassert.notDeepPropertyVal
, respectively. (Related Issues:#16
,#743
,#758
)You can now use the
deep
flag for the.include
assertion in order to perform adeep
equality check to see if something is included on thetarget
.Previously,
.include
was using strict equality (===
) for non-negated property inclusion, butdeep
equality for negated property inclusion and array inclusion.This change causes the .include assertion to always use strict equality unless the deep flag is set.
Please take a look at this comment (
https://github.com/chaijs/chai/issues/743#issuecomment-235763477
) if you want to know more about it. (Related Issues:#743
, PRs:#760
,#761
)Fix unstable behavior of the
NaN
assertion. Now we use the suggested ES6 implementation.The new implementation is now more correct, strict and simple. While the old one threw false positives, the new implementation only checks if something is
NaN
(or not if the.not
flag is used) and nothing else. (Related Issues:#498
,#682
,#681
, PRs:#508
)Throw when calling
_super
onoverwriteMethod
if the method being overwritten isundefined
.Currently if the method you are trying to overwrite is not defined and your new method calls
_super
it will throw anError
.(Related Issues:#467
, PRs:#528
)Before this change, calling
_super
would simply returnthis
.Now
showDiff
is turned on by default whenever theshowDiff
flag is anything other thanfalse
.This issue will mostly affect plugin creators or anyone that made extensions to the core, since this affects the
Assertion.assert
method. (Related Issues:#574
, PRs:#515
)The Typed Array types are now truncated if they're too long (in this case, if they exceed the
truncateThreshold
value on theconfig
). (Related Issues:#441
, PRs:#576
)The assertions:
within
,above
,least
,below
,most
,increase
,decrease
will throw an error if the assertion's target or arguments are not numbers. (Related Issues:#691
, PRs:#692
,#796
)Previously, expect(obj).not.ownProperty(name, val) would throw an Error if obj didn't have an own property (non-inherited) named name. This change causes the assertion to pass instead. (Related Issues:
#795
, #, PRs:#744
,#810
)*The
.empty
assertion will now throw when it is passed non-string primitives and functions (PRs:#763
,#812
)Assertion subject (
obj
) changes when usingownProperty
orown.property
and thus enables chaining. (Related Issues:#281
, PRs:#641
)The
utils
(second argument passed to thechai.use
callback function) no longer exports thegetPathValue
function. If you want to use that please use thepathval
module, which is what chai uses internally now. (Related Issues:#457
,#737
, PRs:#830
)New Features
Throw when non-existent property is read. (Related Issues:
#407
,#766
PRs:#721
,#770
)This is a potentially breaking change. Your build will fail if you have typos in your property assertions
Before
4.x.x
when using property assertions they would not throw an error if you wrote it incorrectly.The example below, for example, would pass:
Since this implementation depends on ES6
Proxies
it will only work on platforms that support it.This property can be enabled (default) or disabled through the
config.useProxy
property, for example:Add fix suggestions when accessing a nonexistent property in proxy mode. (Related Issues:
#771
, PRs:#782
)When a nonexistent property is accessed in proxy mode, Chai will compute the levenshtein distance to all possible properties in order to suggest the best fix to the user.
When non-chainable methods (including overwritten non-chainable methods) are used incorrectly an error will be thrown with a helpful error message. (PRs:
#789
)Add a new configuration setting that describes which keys will be ignored when checking for non-existing properties on an assertion before throwing an error.
Since this implementation depends on ES6
Proxies
it will only work on platforms that support it. Also, if you disableconfig.useProxy
, this setting will have no effect. *(Related Issues:#765
, PRs:#774
)Add script that registers should as a side-effect. (Related Issues:
#594
,#693
PRs:#604
)You can also register should via a
mocha
option:mocha --require chai/should
.The
change
assertion accepts a function as object. (Related Issues:#544
, PRs:#607
)You can also assert for a delta using the
by
assertion alongside thechange
,increase
anddecrease
assertions. (Related Issues:#339
, PRs:#621
).keys
assertion can now operate onmap
s andset
s. (Related Issues:#632
, PRs:#633
,#668
)Add compatibility with strict mode. (Related Issues:
#578
, PRs:#665
)Add
does
andbut
as new no-op assertion. (Related Issues:#700
,#339
PRs:#621
,#701
)Allow
use
to be imported using new ES6 module syntax. (Related Issues:#718
, PRs:#724
)You can also use
require
alongside the new ES6 destructuring feature:Add ordered flag for members assertion. (Related Issues:
#717
, PRs:#728
)Add
.own
flag to.property
assertion. It does the same thing as.ownProperty
and cannot be used alongisde the new.nested
flag. (Related Issues:#795
, PRs:#810
)Add
.deep
support to.property
assertion. (Related Issues:#795
, PRs:#810
)The
.empty
assertion will now work with ES6 collections (PRs:#763
,#812
,#814
)Please notice that this assertion will throw an error when it is passed a
WeakMap
orWeakSet
.Bug Fixes
#606
)this
. (Related Issues:#562
,#684
,#723
, PRs:#642
,#660
)#659
,#661
)#669
, PRs:#672
)#674
, PRs:#676
)#680
)#688
, PRs:#689
).members
assertion. (Related Issues:#511
, PRs:#702
)same.members
to properly handle duplicates by treating each one as a unique member. (Related Issues:#590
, PRs:#739
)#509
)#790
, PRs:#794
)overwriteMethod
,overwriteProperty
,addChainableMethod
,overwriteChainableMethod
functions will return new assertion with flags copied over instead of this. (Related Issues:#562
,#642
,#791
, PRs:#799
)Version 4.0.0
4.0.0
4.0 has been a huge undertaking by the chai community! A lot has changed to ensure Chai 4 is a stable, reliable, well documented codebase. Here are just some of the major improvements:
almost all documentation has been rewritten, with detailed instructions on how assertions work, which flags they can be combined with and the best practices for how to use them.
deep equality has been rewritten from the ground up to support ES6 types like
Map
andSet
, and better support existing types. It is now also much, much faster than before and allows us to bring some great improvements in upcoming releases.we have made sure the
deep
flag now only ever does deep equality. Beforehand, it would sometimes also be used to test nested properties (for exampleexpect(foo).to.have.deep.property('bar.baz')
. For nested assertions, please now use the.nested
flag.many assertions have become more strict, which means you get better error messages explaining where things have gone wrong. For the most part, this wont mean error messages where there weren't error messages before, but it will mean better error messages to replace the, sometimes cryptic, default
TypeError
messages.we've added detections and helpful error messages for common mistakes and typos. The error messages will, in some cases, point you to documentation or in other cases suggest alternatives. These messages will continue to be improved in future releases, so let us know if you have any suggestions!
Breaking Changes
We no longer support Node v0.10 and v0.12 (since their LTS has ended) (PRs:
#816
,#901
)Instead of allowing the user to write the path of a property, now the deep flag performs a deep equality comparison when used with the
.property
assertion.If you want the old behavior of using the dot or bracket notation to denote the property you want to assert against you can use the new
.nested
flag. (Related Issues:#745
,#743
, PRs:#758
,#757
)Please notice that the old methods which used the old behavior of the
deep
flag on theassert
interface have been renamed. They all have had thedeep
word changed by thenested
word. If you want to know more about this please take a look at#757
.Previously,
expect(obj).not.property(name, val)
would throw an Error ifobj
didn't have a property namedname
. This change causes the assertion to pass instead.The
assert.propertyNotVal
andassert.deepPropertyNotVal
assertions were renamed toassert.notPropertyVal
andassert.notDeepPropertyVal
, respectively. (Related Issues:#16
,#743
,#758
)You can now use the
deep
flag for the.include
assertion in order to perform adeep
equality check to see if something is included on thetarget
.Previously,
.include
was using strict equality (===
) for non-negated property inclusion, butdeep
equality for negated property inclusion and array inclusion.This change causes the .include assertion to always use strict equality unless the deep flag is set.
Please take a look at this comment (
https://github.com/chaijs/chai/issues/743#issuecomment-235763477
) if you want to know more about it. (Related Issues:#743
, PRs:#760
,#761
)Fix unstable behavior of the
NaN
assertion. Now we use the suggested ES6 implementation.The new implementation is now more correct, strict and simple. While the old one threw false positives, the new implementation only checks if something is
NaN
(or not if the.not
flag is used) and nothing else. (Related Issues:#498
,#682
,#681
, PRs:#508
)The Typed Array types are now truncated if they're too long (in this case, if they exceed the
truncateThreshold
value on theconfig
). (Related Issues:#441
, PRs:#576
)The assertions:
within
,above
,least
,below
,most
,increase
,decrease
will throw an error if the assertion's target or arguments are not numbers. (Related Issues:#691
, PRs:#692
,#796
)Previously,
expect(obj).not.ownProperty(name, val)
would throw an Error if obj didn't have an own property (non-inherited) named name. This change causes the assertion to pass instead. (Related Issues:#795
, #, PRs:#744
,#810
)*The
.empty
assertion will now throw when it is passed non-string primitives and functions (PRs:#763
,#812
)Assertion subject (
obj
) changes when usingownProperty
orown.property
and thus enables chaining. (Related Issues:#281
, PRs:#641
)The
.change
,.increase
, and.decrease
assertions changed from chainable method assertions to method assertions. They don't have any chaining behavior, and there's no generic semantic benefit to chaining them. (Related Issues:#917
, PRs:#925
)The
utils
(second argument passed to thechai.use
callback function) no longer exports thegetPathValue
function. If you want to use that please use thepathval
module, which is what chai uses internally now. (Related Issues:#457
,#737
, PRs:#830
)(For plugin authors) Throw when calling
_super
onoverwriteMethod
if the method being overwritten isundefined
.Currently if the method you are trying to overwrite is not defined and your new method calls
_super
it will throw anError
.(Related Issues:#467
, PRs:#528
)Before this change, calling
_super
would simply returnthis
.(For plugin authors) Now
showDiff
is turned on by default whenever theshowDiff
flag is anything other thanfalse
.This issue will mostly affect plugin creators or anyone that made extensions to the core, since this affects the
Assertion.assert
method. (Related Issues:#574
, PRs:#515
)New Features
Throw when non-existent property is read. (Related Issues:
#407
,#766
PRs:#721
,#770
)This is a potentially breaking change. Your build will fail if you have typos in your property assertions
Before
4.x.x
when using property assertions they would not throw an error if you wrote it incorrectly.The example below, for example, would pass:
Since this implementation depends on ES6
Proxies
it will only work on platforms that support it.This property can be enabled (default) or disabled through the
config.useProxy
property, for example:Add fix suggestions when accessing a nonexistent property in proxy mode. (Related Issues:
#771
, PRs:#782
)When a nonexistent property is accessed in proxy mode, Chai will compute the levenshtein distance to all possible properties in order to suggest the best fix to the user.
When non-chainable methods (including overwritten non-chainable methods) are used incorrectly an error will be thrown with a helpful error message. (PRs:
#789
)Add a new configuration setting that describes which keys will be ignored when checking for non-existing properties on an assertion before throwing an error.
Since this implementation depends on ES6
Proxies
it will only work on platforms that support it. Also, if you disableconfig.useProxy
, this setting will have no effect. (Related Issues:#765
, PRs:#774
)Add script that registers should as a side-effect. (Related Issues:
#594
,#693
PRs:#604
)You can also register should via a
mocha
option:mocha --require chai/should
.The
change
assertion accepts a function as object. (Related Issues:#544
, PRs:#607
)You can also assert for a delta using the
by
assertion alongside thechange
,increase
anddecrease
assertions. (Related Issues:#339
, PRs:#621
).keys
assertion can now operate onmap
s andset
s. (Related Issues:#632
, PRs:#633
,#668
)Add compatibility with strict mode. (Related Issues:
#578
, PRs:#665
)Add
does
andbut
as new no-op assertion. (Related Issues:#700
,#339
PRs:#621
,#701
)Allow
use
to be imported using new ES6 module syntax. (Related Issues:#718
, PRs:#724
)You can also use
require
alongside the new ES6 destructuring feature:Add ordered flag for members assertion. (Related Issues:
#717
, PRs:#728
)Add
.own
flag to.property
assertion. It does the same thing as.ownProperty
and cannot be used alongisde the new.nested
flag. (Related Issues:#795
, PRs:#810
)Add
.deep
support to.property
assertion. (Related Issues:#795
, PRs:#810
)The
.empty
assertion will now work with ES6 collections (PRs:#763
,#812
,#814
)Please notice that this assertion will throw an error when it is passed a
WeakMap
orWeakSet
.Add script that registers
should
as a side-effect. This change allows you to registershould
via a mocha option by using:mocha spec.js -r chai/register-should
and also allows you to register the testing style globally. (Issues:#693
, PRs:#868
)Add script that registers
assert
as a side-effect. This change allows you to registerassert
via a mocha option by using:mocha spec.js -r chai/register-assert
(Issues:#693
, PRs:#868
,#872
)Add script that registers
expect
as a side-effect. This change allows you to registerexpect
via a mocha option by using:mocha spec.js -r chai/register-expect
(Issues:#693
, PRs:#868
,#872
)When the
length
assertion is chained directly off of an uninvoked method, it referencesfunction
's built-inlength
property instead of Chai'slength
assertion. This commit adds a guard to Chai methods to detect this problem and throw a helpful error message that advises the user on how to correct it. (Issues:#684
,#841
, PRs:#897
)Allows the
lockSsfi
flag to be set when creating new Assertion. This flag controls whether or not the givenssfi
flag should retain its current value, even as assertions are chained off of this object. This is usually set totrue
when creating a new assertion from within another assertion. It's also temporarily set totrue
before an overwritten assertion gets called by the overwriting assertion. (Issues:#878
,#904
, PRs:#922
)The
nestedInclude
,deepNestedInclude
,ownInclude
anddeepOwnInclude
assertions and there negated pairs were added to theassert
interface. (Issues:#905
, PRs:#964
)Bug Fixes
#606
)this
. (Related Issues:#562
,#684
,#723
, PRs:#642
,#660
)#659
,#661
)#669
, PRs:#672
)#674
, PRs:#676
)#680
)#688
, PRs:#689
).members
assertion. (Related Issues:#511
, PRs:#702
)same.members
to properly handle duplicates by treating each one as a unique member. (Related Issues:#590
, PRs:#739
)#509
)#790
, PRs:#794
)overwriteMethod
,overwriteProperty
,addChainableMethod
,overwriteChainableMethod
functions will return new assertion with flags copied over instead of this. (Related Issues:#562
,#642
,#791
, PRs:#799
)#884
)keys
assertions will now consider size of sets. (Related Issues:#919
, PRs:#924
)#893
, PRs:#924
)#878
,#904
, PRs:#922
)#922
,#947
,#904
, PRs:#916
,#923
)#966
, PRs:#890
)