Commit graph

709 commits

Author SHA1 Message Date
lucasfcosta
df1a89241b ownProperty assertions on Assert interface 2016-09-08 09:37:22 -04:00
lucasfcosta
16101af347 Assertion subject (obj) changes when using ownProperty assertion 2016-09-08 09:37:22 -04:00
lucasfcosta
01189490bd Truncate typedArrays according to their string representation 2016-09-08 09:37:22 -04:00
lucasfcosta
0e68e8d488 Use getOwnPropertyDescriptor instead of __lookup methods 2016-09-08 09:37:22 -04:00
lucasfcosta
3ff3cc73c8 Use regex.test method to check for TypedArrays 2016-09-08 09:37:22 -04:00
lucasfcosta
4d314b614b Fix truncateThreshold 2016-09-08 09:37:22 -04:00
lucasfcosta
aae52f2f42 Minor inspect code style fixes 2016-09-08 09:37:22 -04:00
lucasfcosta
b90ba4e5a0 Truncate long typedArray 2016-09-08 09:37:22 -04:00
lucasfcosta
8123bf778c formatTypedArray function 2016-09-08 09:37:22 -04:00
lucasfcosta
f20c7b5b01 isTypedArray verification 2016-09-08 09:37:22 -04:00
lucasfcosta
0a8869643c New showDiff behaviour also depending on expected and actual values 2016-09-08 09:37:22 -04:00
Whitney Young
04aa795b73 No longer silently allowing undefined method calls. Fixes #467. 2016-09-08 09:37:22 -04:00
Tristan Patch
a1190c9256 Deep members comparisons show diff. 2016-09-08 09:37:22 -04:00
Sakthipriyan Vairamani
d2884a6baa handle NaN properly in assertions
Fixes: #498
2016-09-08 09:37:22 -04:00
Dai
128c1126ac Updated code based on discussion 2016-09-08 09:37:22 -04:00
Dai
e0ee3def23 Added handling for undefined and null (fails on negate flag too) 2016-09-08 09:37:22 -04:00
not-an-aardvark
e8085b0ad8
Add fix suggestions when accessing a nonexistent property in proxy mode
fixes #771
2016-09-07 21:34:29 -04:00
Keith Cirkel
d521ed8f18 Merge pull request #779 from TheSavior/is-finite
Adding `.finite`. Fixes #271
2016-09-02 17:30:52 +01:00
Eli White
f26e415be5 Use a property assertion and update tests 2016-09-01 20:55:09 -07:00
Grant Snodgrass
a42586e494 Merge pull request #774 from lucasfcosta/configurable-blacklist
Configurable proxy blacklist
2016-09-02 09:45:32 +08:00
Eli White
10cacc59be More docs updates 2016-09-01 13:00:43 -07:00
Eli White
754bd2415d Adding tests for should. Fixing comment 2016-09-01 12:57:30 -07:00
Eli White
9d914143fc Adding .finite. Fixes #271 2016-09-01 10:34:58 -07:00
lucasfcosta
05c37febfc Fix typo on docs for the inspect utility 2016-08-31 19:42:34 -03:00
lucasfcosta
0c06de5a80 Add proxyExcludedKeys config setting. Closes #765 2016-08-31 19:42:15 -03:00
Grant Snodgrass
93905a7441 Merge pull request #778 from lucasfcosta/improve-exist-assertion
Improve exist assertion (Triple equals and addition to assert interface)
2016-08-30 14:17:12 +08:00
lucasfcosta
374f405527 Exist assertion on the assert interface 2016-08-26 21:16:35 -03:00
lucasfcosta
e731740d5c Exist assertion using triple equals and minor style fixes for it 2016-08-26 21:02:27 -03:00
Gregg Lind
02725b3b13 Fix #775 - linting for redeclared vars 2016-08-25 10:05:39 -05:00
lucasfcosta
481b6306ab Fix backtick which should have been an apostrophe 2016-08-23 18:16:22 -03:00
Keith Cirkel
49ed210e6f Merge pull request #761 from meeber/deep-include
Add `.deep.include` for deep equality comparisons
2016-08-16 21:04:56 +01:00
Lucas Fernandes da Costa
70d8fe2f4b Merge pull request #760 from meeber/fix-include
Breaking: Fix `.include` to always use strict equality
2016-08-15 15:39:51 -03:00
Lucas Fernandes da Costa
dcd5524d8a Merge pull request #758 from meeber/deep-property
Add `.deep.property` for deep equality comparisons
2016-08-15 15:36:58 -03:00
Lucas Fernandes da Costa
0662b7bafa Merge pull request #770 from vieiralucas/optional-proxy
Make proxies optional
2016-08-15 15:35:41 -03:00
Lucas Vieira
0f34cb50a5 Make proxies optional 2016-08-15 13:18:28 -03:00
Grant Snodgrass
7d1dd301c1 Add .deep.include for deep equality comparisons 2016-08-14 16:08:09 -04:00
Grant Snodgrass
38739f45fd Breaking: Fix .include to always use strict equality
- Previously, `.include` was using strict equality for non-negated property
inclusion, but deep equality for negated property inclusion and array
inclusion. This fix causes `.include` to always use strict equality.
2016-08-14 16:07:22 -04:00
Grant Snodgrass
6d6bf60dba Add .deep.property for deep equality comparisons 2016-08-14 16:07:22 -04:00
Lucas Fernandes da Costa
d4e8a4aee5 Merge pull request #757 from meeber/nested-property
Breaking: Rename `.deep.property` to `.nested.property`
2016-08-14 13:41:37 -03:00
Lucas Fernandes da Costa
77ba5eb5a2 Merge pull request #744 from meeber/not-property
Breaking: Change `.not.property(name, val)` behavior
2016-08-14 13:40:43 -03:00
Lucas Vieira
fbc08adf32 Fix indentation of includeStack at config 2016-08-11 23:44:26 -03:00
Grant Snodgrass
a5a90cbd9f Add .deep.property for deep equality comparisons 2016-07-25 20:45:08 -04:00
Grant Snodgrass
92768fd0da Breaking: Rename .deep.property to .nested.property
- Previously, the `deep` flag had unexpected behavior when used with the
`property` assertion: Instead of switching from strict to deep equality,
it unlocked the ability to use dot and bracket notation when referencing
property names. This behavior now belongs to the new `nested` flag.
- assert.deepProperty renamed to assert.nestedProperty
- assert.notDeepProperty renamed to assert.notNestedProperty
- assert.deepPropertyVal renamed to assert.nestedPropertyVal
- assert.notDeepPropertyVal renamed to assert.notNestedPropertyVal
2016-07-25 18:59:01 -04:00
Grant Snodgrass
576489a3be Breaking: Change .not.property(name, val) behavior
- Previously, `expect(obj).not.property(name, val)` would throw an Error
if `obj` didn't have a property named `name`. This change causes the
assertion to pass instead.
- assert.propertyNotVal renamed to assert.notPropertyVal
- assert.deepPropertyNotVal renamed to assert.notDeepPropertyVal
2016-07-24 19:52:01 -04:00
Aleksey Shvayka
3f361c7838 Fix new Promise example 2016-07-10 00:12:33 +03:00
Keith Cirkel
cc7799c416 Merge pull request #739 from meeber/duplicate-members
Fix duplicate handling in members assertion
2016-06-27 09:58:39 +01:00
Keith Cirkel
387dca2320 Merge pull request #742 from lucasfcosta/throws-polishment-assert-interface
Throws polishment assert interface
2016-06-27 09:55:51 +01:00
lucasfcosta
3a8f622de8 Improve docStrings about strict or not comparisons for throws assertion 2016-06-26 20:29:49 -03:00
lucasfcosta
9375d85081 Improve handling for empty Strings on throws assertion 2016-06-26 20:06:11 -03:00
lucasfcosta
db1faba456 Throws assertion polishments for Assert interface 2016-06-25 17:21:05 -03:00
lucasfcosta
bc7c19f006 Fix tests for .throws using getConstructor name instead of .name prop 2016-06-25 14:06:16 -03:00
Grant Snodgrass
3fdb5423e7 Fix duplicate handling in members assertion 2016-06-24 20:50:16 -04:00
Grant Snodgrass
d0972d2999 Throw when non-existent property is read 2016-06-24 09:39:49 -04:00
Keith Cirkel
d08002ed88 Merge pull request #683 from lucasfcosta/throw-using-checkerror
Throw using checkError module
2016-06-24 10:12:13 +01:00
Grant Snodgrass
adf2b6cf78 Add ordered flag for members assertions 2016-06-12 13:32:50 -04:00
Grant Snodgrass
a1c5ff74c7 Fix chai.use as ES6 named export 2016-06-09 17:50:32 -04:00
lucasfcosta
b9436a9e56 Refactor throw to use checkError module 2016-06-08 20:29:45 -03:00
Aleksey Shvayka
3151347f01 Fix typo in hasProperty 2016-06-08 17:35:07 +03:00
Jérémie Astori
27de3a734b Fix minor typo in the docstring of property 2016-05-29 19:00:35 -04:00
Grant Snodgrass
16ef15b4ad Fix failing tests in IE 10 and 11 2016-05-15 09:52:39 -04:00
Aleksey Shvayka
e67f9df7fb Make constructors syntax consistent 2016-05-12 15:30:07 +03:00
pgarrison
e5ac890014 .members should show diff 2016-05-10 13:21:43 -04:00
Lucas Vieira
7429954e9e Add .does as a no-op assertion, Fix #700 2016-05-07 01:12:08 -03:00
Eduard Bardají Puig
63ab713c15 Fix ownProperty on objects with no prototype 2016-04-24 18:20:36 -07:00
Tomáš Polomský
bdd558e43f Fix failure when custom inspect method is used
When custom inspect method is used and this method calls stylize test crashes.
Stylize method is documented for Node.js 4.x and 5.x.
2016-04-17 14:27:06 +02:00
meeber
e22835116c Fix bug when asserting some valid ES6 keys
- Resolution of https://github.com/chaijs/chai/issues/674
- Add compareByInspect utility for use with assertKeys sorts
- Add getOwnEnumerableProperties utility
- Add getOwnEnumerablePropertySymbols utility
- Add Symbol support to the inspect utility
- Add tests to utilities, should, expect, and assert
2016-04-11 13:40:34 -04:00
lucasfcosta
bfcc2d69e1 fail method on Should and Expect interfaces now has BDD as namespace. Closes #487 2016-04-08 16:48:15 -03:00
meeber
e380173aed Fix bug when testing Symbol equality with should syntax (#669) 2016-04-08 06:17:30 -04:00
lucasfcosta
6eef212572 Add but to the list of language chains 2016-04-06 18:09:37 -03:00
brutalcrozt
fe01abd1d4 add compatibility with strict mode 2016-04-06 09:26:18 +07:00
Tobias Bieniek
1d8c3d9856 overwriteMethod: Fix "ssfi" flag overwriting 2016-04-04 13:27:24 +02:00
Tobias Bieniek
cceadf6d82 overwriteProperty: Fix "ssfi" flag overwriting 2016-04-04 13:27:24 +02:00
Tobias Bieniek
be8189c1ad Remove unnecessary config checks
config.includeStack is already checked by the assert() function
2016-04-04 13:27:24 +02:00
Tobias Bieniek
2fd19ca89f addMethod: Prevent unnecessary transferFlags() calls 2016-03-31 18:45:11 +02:00
Tobias Bieniek
218dd94791 addProperty: Prevent unnecessary transferFlags() calls 2016-03-31 18:09:35 +02:00
Tobias Bieniek
49697a6691 addMethod/addProperty: Fix missing require() calls 2016-03-31 18:07:16 +02:00
Jesús Leganés Combarro
85fb7a6583 deepStrictEqual
Added `deepStrictEqual` as an alias for `deepEqual`
2016-03-31 13:21:47 +02:00
Keith Cirkel
bf1e0bff33 Merge pull request #633 from lucasfcosta/keys-for-maps-and-sets
Keys for maps and sets
2016-03-27 23:28:11 +01:00
lucasfcosta
8f8f186058 Simplify adding language chains with a check for the getter argument 2016-03-20 16:14:49 -03:00
lucasfcosta
1028fd2de6 addMethod returns a new assertion with flags copied over instead of this 2016-03-20 16:14:48 -03:00
lucasfcosta
c654360e68 Keys assertions on assert interface (and tests) 2016-03-09 19:48:28 -03:00
lucasfcosta
f286e0e6b3 Keys assertion can operate on Maps and Sets 2016-03-09 19:48:28 -03:00
Chris Clayman
ce45a9ff28 Fixed JsDoc spelling of Object.freeze() in .isNotExtensible() assertion. 2016-02-25 15:48:38 -08:00
lucasfcosta
8e8a728921 by assertion (a.k.a. assertDelta) implementation 2016-02-22 17:17:38 -03:00
lucasfcosta
25359ebf59 Improve property checks for change related assertions 2016-02-22 17:17:38 -03:00
lucasfcosta
877acb52dd Rename change related assertions obj argument to target 2016-02-22 17:17:37 -03:00
Steven Peng
c3f3e94cc5 Convert keys to strings 2016-02-16 21:07:32 -08:00
Dinos Theodorou
e2296e2400 Correct documentation for .throw() 2016-02-14 22:27:40 +01:00
lucasfcosta
e778cee15d Code style fixes related to function for value on inc, dec and changes 2016-02-11 18:56:29 -02:00
lucasfcosta
f158523321 Increases and Decreases assertions accepting function for value 2016-02-11 18:56:29 -02:00
lucasfcosta
0fe471885c Change accepts a function as object 2016-02-11 18:56:29 -02:00
Whitney Young
78f484a3f4 Update include assertion docs for object properties
Originally added in #230, asserting that an object contains a subset of
properties and values was never documented. Questions like #193 have
popped up asking for this feature even though it's been present since
1.9.0.

The discussion in #193 focused mostly around getting something like
this to work via the `property` assertion, but that discussion should
be considered moot by the existing functionality already present in
`include` that was simply overlooked.

Resolves: #193
2016-02-07 22:02:33 -07:00
lucasfcosta
28f7397fd0 Update doc comments to include message argument 2016-02-01 18:42:23 -02:00
lucasfcosta
eb3a979c07 Fix missing msg argument for change related assertions 2016-01-31 13:35:19 -02:00
Keith Cirkel
4ca0218391 chai@3.5.0 2016-01-28 11:54:31 +00:00
qbolec
ae4b5f97c7 Added includeDeepMembers 2016-01-10 13:51:17 +01:00
Benoit Larroque
37e9d25579 Fix non ES5 compliant regexp
ES5 appears to require that { be escaped when not used as part of a quantifier. While this works fine in browsers it appears to choke less lenient runtimes (e.g. Duktape).
2015-12-23 14:32:59 +01:00
Gerard Delmàs
6589917979 clarified assert.isObject & assert.isNotObject documentation 2015-12-17 18:45:45 +01:00
Jurko Gospodnetić
568fc1ae0b fix error message tag substitution
String.prototype.replace() had some extra undesireable substitution behaviour
when it replaces a tag with a string containing some internal tags like `$$`,
or `$'`.

For more detailed information see:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_string_as_a_parameter
2015-12-14 15:13:03 +01:00
lizhengnacl
2286129635 clerical error 2015-12-09 16:54:30 +08:00
David Broder-Rodgers
8877fca8a6 Added JSDocs to should interface 2015-12-07 13:24:35 +00:00
Keith Cirkel
12bfdd1764 chai@3.4.2 2015-11-15 22:48:29 +00:00
Keith Cirkel
9319c234c9 (docs) Add namespace to all public methods 2015-11-15 22:44:44 +00:00
Keith Cirkel
86cc3e893f chai@3.4.1 2015-11-07 23:17:36 +00:00
Keith Cirkel
c977f90266 Merge pull request #547 from keithamus/fix-docs
Fix documentation syntax errors
2015-11-07 22:56:26 +00:00
Keith Cirkel
ab4208cb9d Fix documentation syntax errors
This is just enough to get Dox parsing the codebase to generate documentation
JSON. It does not fix potential inaccuracies or other problems with the docs.
2015-11-07 22:47:19 +00:00
Patrick Kovach-Long
d6d4f7d0ab Update assertions.js
removed 'out of range' reference error
2015-11-02 08:05:59 -05:00
Keith Cirkel
71b2512a99 chai@3.4.0 2015-10-21 11:49:38 +01:00
Bertrand Marron
8c1d8cf932 Revert .empty assertion change from PR #499
The change introduced in #499 breaks compatibility with Array-like
objects (e.g. mongoose arrays).
It should be applied in the next major version.

Fix #537
2015-10-21 12:29:04 +02:00
Droogans
b474ceee54 feat(matchers): Allow for objects in oneOf 2015-10-15 15:02:43 -05:00
Droogans
179d4701b8 feat(matchers): Add value-in-list assertion
Adds a way to test if a value appears in a flat list. Compliments
`include.members` to reverse the order of the input. Now the list
appears in the assertion, as opposed to the `expect`.

Closes #532
2015-10-12 22:18:24 -05:00
Xue Hu
7c14c15dee Fix assert lengthOf example 2015-10-05 16:19:36 -07:00
root
7fe23e9799 Added approximately alias to close to 2015-10-04 01:49:25 -04:00
Keith Cirkel
7f5a108a28 Merge pull request #446 from danielbprice/master
Issue #442 chai can't cope with AssertionErrors raised from node's assert
2015-10-02 10:52:14 +01:00
Austin Pray
936e7575f7 Fixes spelling error "everthing" -> "everything" 2015-09-28 21:29:41 -05:00
Jurko
27b6f7db58 document how the new Error type gets detected by the a/an matcher 2015-09-22 17:28:05 +02:00
Jérémie Astori
1f8c65135d Remove multi-type support for a/an assertion 2015-09-12 13:04:56 +00:00
Jérémie Astori
675b51b3ad Add a utility to enforce allowed types tested by an assertion 2015-09-12 12:59:51 +00:00
Jérémie Astori
0acb2ec8f5 Use new feature of a/an assertion to check type of tested object when using include assertion 2015-09-12 10:14:01 +00:00
Jérémie Astori
d27ceb54a4 Improve message of multi-type a/an assertions 2015-09-12 10:14:01 +00:00
Jérémie Astori
5eb39067ad Add support of multiple types in an/a assertions for the BDD API, with naive message 2015-09-12 10:14:01 +00:00
Jérémie Astori
cf0e3a5677 Check that expected type for include is an array, an object, or a string, in a naive way 2015-09-12 10:14:01 +00:00
Keith Cirkel
13a90097eb chai@3.3.0 2015-09-11 22:36:05 +01:00
Keith Cirkel
cf9f5d99d7 Merge pull request #512 from dereke/master
fixed expect('').to.contain('') so it passes
2015-09-11 22:20:30 +01:00
kpdecker
b6b84e5631 Fix stack trace tracking for property asserts
The ssfi parameter was not being updated for these methods, which ended up causing the trace to be omitted.

Fixes #358
2015-09-08 02:15:47 -05:00
Derek Ekins
eaba0be444 fixed expect('').to.contain('') so it passes 2015-09-01 13:59:39 +01:00
Keith Cirkel
a42ac436bb Merge pull request #496 from astorije/astorije/frozen-errors
Make sure TypeErrors thrown by frozen are caught
2015-08-10 10:13:16 +01:00
Jérémie Astori
1cc56c88eb Remove some trailing whitespaces 2015-07-26 19:43:02 +00:00
Jérémie Astori
ffc59fccd5 Make sure TypeErrors thrown by extensible are treated in a ES6 way and test these 2015-07-26 19:42:46 +00:00
Jérémie Astori
9b71590fe3 Make sure TypeErrors thrown by sealed are treated in a ES6 way and test these 2015-07-26 19:31:48 +00:00
Jérémie Astori
eae67c0d5c Make sure TypeErrors thrown by frozen are treated in a ES6 way and test these 2015-07-26 17:43:48 +00:00
Keith Cirkel
7d36b5aa4e Merge pull request #500 from wraithan/add-assert-gte-lte
isAtLeast, isAtMost assertions added to assert interface
2015-07-24 23:07:21 +01:00
Keith Cirkel
8aea7a55df Merge pull request #499 from Daveloper87/empty_string_check_fix
Shortened check for empty
2015-07-24 22:55:23 +01:00
Wraithan (Chris McDonald)
3c681e2dce isAtLeast, isAtMost assertions added to assert interface 2015-07-24 09:25:56 -07:00
Dai
bba85d0f37 Simplified .empty 2015-07-24 06:55:24 +01:00
Cezary Kluczyński
b9730e070f JSDoc blocks aligned with corresponding functions 2015-07-20 20:32:46 +02:00
Cezary Kluczyński
5bd86c2b38 isNotTrue, isNotFalse assertions added 2015-07-20 19:29:04 +02:00
Keith Cirkel
9fb29cd0d6 chai@3.2.0 2015-07-19 17:59:47 +01:00
Keith Cirkel
40cdaa3400 Merge pull request #489 from astorije/astorije/aliases
Various work on aliases
2015-07-19 17:58:14 +01:00
Jérémie Astori
e5071edd8b Invert assertions and aliases for is* assertions to make the documentation and code consistent with other is* assertions 2015-07-18 23:21:20 +00:00
Jérémie Astori
9e14164b67 Make throws aliases consistent across examples and definitions 2015-07-18 23:14:45 +00:00
Jérémie Astori
11aa743472 Add aliases (and tests) for assert.ok and assert.notOk to match the other isSomething assertions 2015-07-18 23:14:45 +00:00
Jérémie Astori
909616e0ad Fix wrong call to the underlying method when checking if an object is frozen 2015-07-18 01:40:02 +02:00
Jérémie Astori
ee573496d4 Add aliases to extensible, sealed and frozen properties for consistency 2015-07-17 23:30:45 +00:00
Jérémie Astori
3b980e5dd3 Fix docstring regarding assert.notFrozen 2015-07-17 23:30:03 +00:00
Keith Cirkel
36873c6cbf Merge pull request #484 from couchand/patch-1
Add respondsTo and satisfies as aliases
2015-07-17 16:33:18 +01:00
Denis Luchkin-Zhou
65180716d6 Fixing a typo in the getProperties() utility
...where `subject` should apparently be `object`.
2015-07-17 11:23:45 -04:00
Andrew Couch
802fa5e0bb Add respondsTo and satisfies as aliases 2015-07-17 11:14:17 -04:00
Keith Cirkel
6561fc29a4 chai@3.1.0 2015-07-16 22:02:04 +01:00
Brad Cypert
a5687a2648 Added support for NaN. Tests included. 2015-07-16 10:18:54 -07:00