Commit graph

1376 commits

Author SHA1 Message Date
Keith Cirkel
4c2c3d8935
chore: release 4.0.0-canary.2 2017-04-11 21:22:32 +01:00
Keith Cirkel
526f88585d Merge pull request #920 from meeber/update-docs
Overhaul bdd documentation
2017-04-11 21:10:23 +01:00
Grant Snodgrass
f80d699a50 docs: overhaul bdd documentation 2017-04-08 21:41:45 -04:00
Grant Snodgrass
dce6415d0a style: rename target argument to subject
Most assertions use the term "target" to refer to the object under
test, but a few assertions also had a `target` argument, resulting in
an overloaded term that was difficult to document. This commit
renames every `target` argument to `subject`.
2017-04-08 09:23:27 -04:00
Keith Cirkel
a515ece48a Merge pull request #947 from meeber/fix-messages
fix: always honor custom message
2017-04-05 12:12:18 +01:00
Grant Snodgrass
7f8a268e52 fix: always honor custom message 2017-04-04 17:28:19 -04:00
Keith Cirkel
e5ac3b0874 Merge pull request #922 from meeber/remove-chai-frames
Remove implementation frames from stack trace
2017-04-04 22:22:13 +01:00
Grant Snodgrass
a253b4c50e docs: remove excessive comments from tests 2017-03-23 18:20:41 -04:00
Grant Snodgrass
8fad9c8000 refactor: rename keep_ssfi to lockSsfi 2017-03-23 18:20:41 -04:00
Grant Snodgrass
b584b94c24 fix: remove frames from assert interface stack
- Make it so that only `AssertionError` is thrown from inside of an
  assert interface wrapper function

- Always set `ssfi` to the current function when creating a new
  `AssertionError` inside of an assert interface wrapper function

- Always set `ssfi` to the current function when creating a new
  `Assertion` inside of an assert interface wrapper function,
  and set the `keep_ssfi` flag

- Improve the `globalErr` test helper function to also validate that the
  thrown error's stack trace doesn't contain frames from the assert
  interface
2017-03-23 18:20:41 -04:00
Grant Snodgrass
4b090100aa fix: remove frames from bdd interface stack
- Make it so that only `AssertionError` is thrown from inside of an
  assertion

- Always pass the current `ssfi` to a `new AssertionError` inside of an
  assertion

- Always pass the current `ssfi` to a new `Assertion` inside of an
  assertion, and set the `keep_ssfi` flag

- Improve the `globalErr` test helper function to also validate that
  the thrown error's stack trace doesn't contain implementation frames
2017-03-23 18:20:38 -04:00
Grant Snodgrass
cf84f95505 feat: improve keep_ssfi flag
- Allows the `keep_ssfi` flag to be set when creating new Assertion
  objects by providing its value as the fourth argument.

- Updates the `transferFlags` util to only transfer `keep_ssfi` when the
  `includeAll` argument is set to `true`.

- Updates assertion creation and proxify utils to only set `ssfi` if
  `keep_ssfi` isn't set.

- Updates inline docs to reflect expanded usage of `keep_ssfi`.
2017-03-23 18:04:15 -04:00
Keith Cirkel
ef2bf66d7c Merge pull request #899 from lucasfcosta/throw-for-non-functions-on-instanceof
Throw error when instanceof is passed something that is not a function as constructor
2017-03-23 09:55:55 +00:00
Keith Cirkel
011612c7b3 Merge pull request #924 from meeber/fix-not-have-keys
fix: make negated `.keys` consider size of sets
2017-03-23 09:54:24 +00:00
lucasfcosta
011815305a Throw error when instanceof is passed something that is not a function as constructor 2017-02-15 21:56:26 -02:00
Grant Snodgrass
a7e1200db4 fix: wrong assertion types (#925)
BREAKING CHANGE: `.change`, `.increase`, and `.decrease` 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.
2017-02-13 22:23:54 -02:00
Lucas Vieira
f937ee5be0 Merge pull request #926 from meeber/missing-include-tests
test: add `.own.include` and `.nested.include`
2017-02-07 10:17:37 -02:00
Grant Snodgrass
a6e172168c test: add .own.include and .nested.include 2017-02-02 18:47:50 -05:00
Grant Snodgrass
f37d2c223b fix: make negated .keys consider size of sets
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.
2017-01-30 18:34:42 -05:00
Grant Snodgrass
576a6f7153 Merge pull request #915 from chaijs/greenkeeper/get-func-name-2.0.0
Update get-func-name to the latest version 🚀
2017-01-24 14:44:05 -05:00
greenkeeper[bot]
8c25fd077f fix(package): update get-func-name to version 2.0.0
https://greenkeeper.io/
2017-01-24 19:34:29 +00:00
Keith Cirkel
4b7b70ce12 Merge pull request #911 from aaronsofaly/fix-plugin-utilities-documentation
Fix plugin utilities documentation
2017-01-23 20:20:45 +00:00
Aaron Sofaly
38d3ccaf0c remove space between method name and opening parenthesis 2017-01-22 15:06:15 -07:00
Aaron Sofaly
251fa57c16 added a period before each method 2017-01-22 14:34:01 -07:00
Aaron Sofaly
0334f17868 updated headlines to use h3's instead of h1's 2017-01-22 14:26:57 -07:00
Aaron Sofaly
1a47ff1a5f added headline for inspect util 2017-01-22 14:22:30 -07:00
Keith Cirkel
a64eb62344 Delete MAINTAINERS (#903) 2017-01-16 18:57:13 -02:00
Aleksey Shvayka
c5ca76c551 Refactor utils.addChainableMethod helper (#900)
* replace __proto__ with Object.setPrototypeOf

* remove hardcoded keys

* cache non-configurable keys
2017-01-12 19:14:29 -02:00
Keith Cirkel
7b62db34c7 Merge pull request #901 from meeber/supported-versions
chore: update supported Node versions
2017-01-12 20:10:58 +00:00
Grant Snodgrass
51eb5f9f40 chore: update supported Node versions
- Dropped support for Node v0.12
- Made Node v4 the minimum required version
- Added Node v7 to travis
2017-01-11 18:30:32 -05:00
Keith Cirkel
877dde8879 Merge pull request #884 from meeber/fix-stack
Remove proxy frames from stack traces and improve docs/tests
2017-01-03 21:50:24 +00:00
Grant Snodgrass
0c0983618e refactor(Assertion): small edit and improve docs
- 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.
2017-01-03 16:23:09 -05:00
Grant Snodgrass
82ca613d0f refactor(ssfi): remove dead code and update docs
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.
2017-01-03 16:23:09 -05:00
Grant Snodgrass
bf71196c7f test(includeStack): add should interface
Only the `expect` interface was being tested for correct stack traces.
This commit adds identical tests for the `should` interface.
2017-01-03 16:23:09 -05:00
Grant Snodgrass
b88e53639e fix: remove proxy frames from stack traces
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.
2017-01-03 16:23:09 -05:00
Grant Snodgrass
8fa4f78574 test(includeStack): improve tests
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.
2017-01-03 16:23:09 -05:00
Grant Snodgrass
96f958c814 refactor(utils): improve function names
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.
2017-01-03 16:23:09 -05:00
Grant Snodgrass
78f1808735 refactor(proxify): use Reflect for property access
The proper way to perform an operation's original behavior from
within a proxy trap is by using `Reflect`.
2017-01-03 16:21:16 -05:00
Grant Snodgrass
5a1e6764d6 refactor(proxify): move feature detection to util
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.
2017-01-03 16:21:16 -05:00
Keith Cirkel
c9bebe4d2f Merge pull request #897 from meeber/proxy-length
Un-deprecate `length` and add guard
2017-01-03 10:05:24 +00:00
Grant Snodgrass
ce9a2c283b feat(utils): add length guard to methods
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.
2017-01-02 21:00:51 -05:00
Grant Snodgrass
ae69f27532 refactor(lengthOf): favor it over length
- 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`.
2017-01-02 12:04:12 -05:00
Jérémie Astori
104a6b7db9 Center repo name on README (#889) 2016-12-18 14:29:32 -02:00
Aleksey Shvayka
b7ff1446a7 Merge pull request #875 from bdadam/patch-1
Provided browser field in package.json
2016-11-24 15:57:55 +02:00
Adam Beres-Deak
8c2bcde42d Provided browser field in package.json
Some tools use the browser field in the package.json to use an alternate main file. This is e.g. the case for rollup-plugin-node-resolve (https://github.com/rollup/rollup-plugin-node-resolve).
Specs: https://github.com/defunctzombie/package-browser-field-spec#alternate-main---basic
2016-11-23 18:11:52 +01:00
Inanc
5a0aa5984e Auto register side effects and Update documentation (#872)
* 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
2016-11-18 15:42:05 -02:00
Keith Cirkel
173f786668 Merge pull request #871 from chaijs/greenkeeper/deep-eql-2.0.1
fix(package): update deep-eql to version 2.0.1
2016-11-18 11:26:26 +00:00
greenkeeper[bot]
5f31db2d02 fix(package): update deep-eql to version 2.0.1
Closes #859

https://greenkeeper.io/
2016-11-17 22:39:44 -02:00
Keith Cirkel
2a30721f67 Merge pull request #868 from deeperx/auto-register-expect-side-effect
Add script that registers expect as a side-effect
2016-11-17 13:16:07 +00:00
deeperx
4a19d5a646 Update README.md for explanatory title of native modules usage 2016-11-17 14:37:15 +03:00