When neither the `contains` nor `any` flags are set, the `.keys`
assertion implicitly means `.all.keys` and thus requires the target
and given sets to be the same size. Therefore, `not.keys` implicitly
means `.not.all.keys`, and should thus pass when the target and given
sets aren't the same size, even if the target set is a superset of the
given set. This commit enables this behavior.
- Rename third parameter of Assertion constructor from `stack` to
`ssfi` for consistency's sake.
- Add documentation to Assertion constructor explaining what the `object`,
`message`, and `ssfi` flags are for.
There was some dead code leftover from before `includeStack` was made
into a config value (as opposed to existing as a property on the
Assertion object). This commit removes that dead code, and adds inline
documentation for the remaining stack-related code.
Proxy-related implementation frames were showing up in the stack
traces for failed property assertions. This commit removes them by
setting the proxy getter (instead of the property getter) as the
starting point to remove all implementation frames.
Only a couple of types of assertions were being tested for correct
stack traces. This commit cleans up the existing tests and adds tests
for the missing assertion types.
Many of the utility functions had slightly misleading names or no
names at all. This commit renames the functions with misleading names
and adds names to functions that were missing one.
Currently, only one module needs to detect if Chai's proxy protection
is enabled. However, upcoming changes will involve performing this
detection in other modules as well. This commit moves the detection
logic to its own utility module for easy reuse.
When the `length` assertion is chained directly off of an uninvoked
method, it references `function`'s built-in `length` property instead
of Chai's `length` 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.
- The method part of the `length` assertion was slated for deprecation
due to a compatibility issue in legacy environments. The decision to
deprecate `length` was reversed per #684. This commit replaces the
deprecation notice with a recommendation to favor `lengthOf` over
`length` due to the compatibility issue.
- The `lengthOf` assertion wasn't a true alias of `length` because it
was a method assertion instead of a chainable method assertion. This
commit changes `lengthOf` into a chainable method assertion that's
identical to `length`, and updates tests and docs accordingly.
- Updates docs to classify `length` as an alias of `lengthOf`.
- Updates docs of related assertions to use `lengthOf` instead of
`length`.
* Update chai/{testing-style} to chai/register-{testing-style}
* Update documentation on registering side effects and remove module.exports
* Update README.md usage for minor consistency issues
Three tests on the `should` interface are failing in Safari 10 due to a
bug related to proxies. These tests should be re-enabled once the bug is
fixed. See https://github.com/chaijs/chai/issues/855.