Commit graph

458 commits

Author SHA1 Message Date
Jake Luer
b7fdf4919e Release 1.9.1 2014-03-19 12:22:08 -04:00
Jake Luer
1df11d0027 util: [getActual] select actual logic now allows undefined for actual. Closes #183 2014-03-18 09:35:43 -04:00
Jake Luer
a0661120d9 docs: [config] make public, express param type 2014-03-18 08:44:31 -04:00
Roman Masek
9e5f9ffd3b Fix issue #166 - configurable threshold in objDisplay. 2014-03-18 08:20:15 +01:00
Roman Masek
7dd05e3b7a Move configuration options to config.js. 2014-03-18 08:18:11 +01:00
Jake Luer
07b34c7b49 Merge pull request #233 from Empeeric/master
ssfi as it should be
2014-02-25 12:43:59 -05:00
Jake Luer
4e25ff0e1c Merge pull request #244 from leider/fix_for_contains
fixing #239 (without changing chai.js)
2014-02-25 12:43:43 -05:00
Dido Arellano
82ccc5e75b Fix typos 2014-02-23 02:39:30 +08:00
Luís Cardoso
03344cb48d Update exports.version to 1.9.0 2014-02-14 19:10:29 +00:00
leider
2c78b57824 aborting loop on finding 2014-02-09 15:52:58 +01:00
leider
350a802a4e declaring variable only once 2014-02-09 14:42:00 +01:00
leider
cb910afc52 additional test finds incomplete implementation 2014-02-09 14:41:03 +01:00
leider
76b62f006f simplified code 2014-02-09 14:29:18 +01:00
leider
7352fdeec7 fixing #239 (without changing chai.js) 2014-02-09 13:31:45 +01:00
Refael Ackermann
62d9ceb208 ssfi as it should be 2014-01-30 10:23:19 +02:00
Duncan Beevers
ec62443b7c Deep equality check for collection membership 2014-01-29 19:08:16 -06:00
Jake Luer
df55ce919c Merge branch 'master' of github.com:chaijs/chai 2014-01-29 17:23:02 -05:00
Jake Luer
c3c1fccc2d assert: .throws() returns thrown error. Closes #185 2014-01-29 17:22:29 -05:00
Jake Luer
be23285a78 Merge pull request #232 from laconbass/assert-throws
Avoid error instantiation if possible on assert.throws
2014-01-29 13:28:47 -08:00
Jake Luer
b01eba75c9 assert: .fail() parameter mismatch. Closes #206 2014-01-29 16:23:04 -05:00
Veselin
a01e40b2cc Merge pull request #230 from jkroso/include
support `{a:1,b:2}.should.include({a:1})`
2014-01-27 07:11:45 -08:00
Veselin Todorov
3835bed2a6 Merge pull request #226 from duncanbeevers/add_has
Add `has` to language chains
2014-01-24 23:55:48 -08:00
laconbass
3741f0516d Avoid error instantiation if possible on assert.throws
Given an error constructor as function, try to get the error name from
its prototype or itself before relying on the old behaviour.

Closes #220

Replaces [the old pull](https://github.com/chaijs/chai/pull/221) to avoid
useless commits.
2014-01-15 18:49:16 +01:00
Duncan Beevers
ec3ccde264 Update Copyright notices to 2014 2014-01-05 20:03:42 -06:00
Jake Rosoman
acbf04dad2 handle negation correctly 2014-01-05 15:26:33 +13:00
Jake Rosoman
2715e95abc support {a:1,b:2}.should.include({a:1}) 2014-01-05 14:10:14 +13:00
Veselin Todorov
f3ebb09a58 Merge pull request #224 from vbardales/master
Return error on throw method to chain on error properties
2014-01-02 10:50:25 -08:00
Duncan Beevers
4ea26a7c61 Add has to language chains 2013-12-27 11:06:15 -06:00
Virginie BARDALES
2bb0ff2ab7 return error on throw method to chain on error properties, possibly different from message 2013-12-19 10:23:46 +01:00
Max Edmands
270f9d92d9 util: store chainable behavior in a __methods object on ctx 2013-12-01 09:55:01 -08:00
Max Edmands
76ac685d5a util: code style fix 2013-11-30 10:52:10 -08:00
Max Edmands
2127525933 util: add overwriteChainableMethod utility (for #215) 2013-11-30 09:31:06 -08:00
Andrei Neculau
d8529e4bf9 core: improve message for assertion errors (throw assertion) 2013-10-23 23:05:39 +02:00
Jake Luer
4b51ea7548 Release 1.8.1 2013-10-10 06:47:47 -04:00
Jake Luer
984622a4ea Release 1.8.0 2013-09-18 15:04:00 -04:00
Jake Luer
89c390fe36 util: remove embedded deep equal utility 2013-09-18 12:13:11 -04:00
Jake Luer
f1e7c574c6 util: replace embedded deep equal with external module 2013-09-18 12:11:37 -04:00
Ryunosuke SATO
68e71ab2a8 Fix highlight for example code
This fix is the same as #179.
2013-06-29 23:30:53 +09:00
Jake Luer
db4b9d7833 Release 1.7.2 2013-06-27 14:15:43 -04:00
Jake Luer
550c61e358 Merge pull request #180 from tricknotes/modify-method-title
Modify method title to include argument name
2013-06-27 09:59:44 -07:00
Ryunosuke SATO
4b10292274 Modify method title to include argument name 2013-06-27 18:56:24 +09:00
Ryunosuke SATO
ab91b501a5 Fix to highlight code example
The indent count for code example sould be 4 not 3.
2013-06-27 18:54:19 +09:00
Jake Luer
12467a6bfd Release 1.7.1 2013-06-24 14:46:03 -04:00
Jake Luer
c0f8e187a7 Release 1.7.0 2013-06-17 16:06:38 -04:00
Jake Luer
167d1a7193 error: remove internal assertion error constructor 2013-06-17 15:28:47 -04:00
Jake Luer
7bc580910e core: [assertion-error] replace internal assertion error with dep 2013-06-17 15:27:50 -04:00
Jake Luer
cfb6137054 docs: fix typo in source file. #174 2013-06-17 15:11:30 -04:00
Domenic Denicola
7c72e673f4 Fix utils.inspect with custom object-returning inspect()s.
This code is lifted from the latest node utils.js: 896b2aa707/lib/util.js (L205-L209)

Without it, if an object contains another object whose custom `inspect()` method returns a non-string, `utils.inspect` gets confused and tries to do `nonString.indexOf`.

This fixes domenic/chai-as-promised#32, where Chai as Promised was trying to call `utils.inspect` on an `AssertionError` which contained as its "actual" property a Q promise. Since Q promises have custom `inspect` methods that return objects, not strings, this was triggered.
2013-06-13 23:12:58 -04:00
Bartvds
774a723bff replaced tabs with 2 spaces 2013-06-09 01:31:26 +02:00
Bartvds
080702ac87 added assert.notOk() 2013-06-08 18:16:44 +02:00
George Kats
044dcff68d Fix comparison objects.
Regexp and Date objects can to be deep equal to objects with the same type.
2013-06-06 00:53:34 +03:00
Jake Luer
ad35240462 Release 1.6.1 2013-06-05 16:46:37 -04:00
George Kats
9c9ea88766 Fix comparison equality of two regexps. 2013-06-05 00:41:26 +03:00
Brandon Payton
21f0ee5b21 Fix documented name for assert interface's isDefined method 2013-05-03 12:25:36 -07:00
Jake Luer
e18c48329b Release 1.6.0 2013-04-29 20:15:39 -04:00
Jake Luer
bd72555c8a lib: [docs] finish documentation for members assertions 2013-04-29 19:59:41 -04:00
Jake Luer
019bb07637 assert: [(not)include] throw on incompatible haystack. Closes #142 2013-04-29 19:30:51 -04:00
Jake Luer
8f8d7425a5 assert: [notInclude] add assert.notInclude. Closes #158 2013-04-29 19:03:53 -04:00
Jake Luer
6f70c5eb74 core: [assertions] remove extraneous comments 2013-04-29 17:42:00 -04:00
Nick Heiner
244fa51336 giving members a no-flag assertion 2013-04-23 11:12:23 -04:00
Nick Heiner
22e2a78a4e Code review comments - changing syntax 2013-04-14 19:07:12 -04:00
Nick Heiner
4ea9185e9e Code review comments 2013-04-14 18:00:02 -04:00
Nick Heiner
078da00be3 Adding members and memberEquals assertions for checking for subsets and set equality. Implements chaijs/chai#148. 2013-04-14 17:58:07 -04:00
Ruben Verborgh
caf2a151c0 Restore the call and apply methods of Function when adding a chainable method.
This was broken on platforms that have `__proto__` support.
Details at https://github.com/chaijs/chai/commit/514dd6ce4#commitcomment-2593383
2013-02-13 12:41:22 +01:00
Jake Luer
ab4bd0e76f Release 1.5.0 2013-02-03 20:49:13 -05:00
Jake Luer
fc24e98246 lib: update copyright to 2013 2013-02-03 19:01:36 -05:00
Jake Luer
163c3c614b assertions: refactor some assertions to use objDisplay instead of inspect 2013-02-03 18:02:30 -05:00
Jake Luer
2e8e2ce145 util: [objDisplay] normalize output of functions 2013-02-03 18:01:44 -05:00
Jake Luer
475b1f20f0 assertions: [throw] code cleanup 2013-02-03 15:49:52 -05:00
Jake Luer
37098ed9c9 core/assertions: [type] (a/an) refactor to use type detection utility 2013-02-03 15:12:12 -05:00
Jake Luer
8286612c83 util: add cross-browser type detection utility 2013-02-03 15:11:30 -05:00
Jake Luer
ff9005caa8 Merge branch 'feature/showDiff'
* feature/showDiff:
  test: [Assertion] configruable showDiff flag. Closes #132
  lib: [Assertion] add configurable showDiff flag. #132
  showDiff: force true for equal and eql

Conflicts:
	lib/chai/assertion.js
	test/display/message.js
2013-02-03 13:27:38 -05:00
Jake Luer
f5cf2c2f5a lib: [Assertion] add configurable showDiff flag. #132 2013-02-03 13:25:24 -05:00
Jake Luer
e619f98999 Merge pull request #136 from whatthejeff/message_fix
Fixed backwards negation messages.
2013-02-02 16:06:19 -08:00
DD
91d2805393 Fix issue #137, test message existence by using message!=null rather than using message 2013-02-03 00:49:48 +08:00
Jeff Welch
4033c14f01 Fixed backwards negation messages. 2013-02-01 23:12:01 -05:00
Jake Luer
02ed69e1d0 Merge pull request #133 from RubenVerborgh/throw
Fix assertions on functions that throw primitives
2013-01-28 06:25:55 -08:00
Ruben Verborgh
9bcc5e7f08 Functions throwing strings can reliably be tested. 2013-01-27 20:11:50 +01:00
Ruben Verborgh
4b90c17e05 Cache whether __proto__ is supported. 2013-01-19 17:32:34 +01:00
Ruben Verborgh
514dd6ce46 Use __proto__ if available. 2013-01-19 17:30:11 +01:00
Ruben Verborgh
ccb2ac85a4 Determine the property names to exclude beforehand. 2013-01-19 17:28:27 +01:00
Ruben Verborgh
7c319f099f Add alias eqls for eql. 2013-01-07 17:57:03 +01:00
Domenic Denicola
0fe68b021c Use inherited enumerable properties in deep equality comparison.
Fixes #120.
2012-12-30 06:26:26 -05:00
Domenic Denicola
730a12baa6 Show inherited properties when inspecting an object. 2012-12-30 06:25:17 -05:00
Domenic Denicola
fe45a2d667 Add new getProperties and getEnumerableProperties utils. 2012-12-30 06:24:23 -05:00
Jake Luer
d3de8cb4ed Release 1.4.2 2012-12-21 15:16:06 -05:00
Jake Luer
bc71605462 browser: no longer need different AssertionError constructor 2012-12-21 15:00:57 -05:00
Jake Luer
4279bca19b Release 1.4.1 2012-12-21 12:56:20 -05:00
Jake Luer
49a4655173 showDiff: force diff for equal and eql. #106 2012-12-21 12:50:04 -05:00
Jake Luer
972258cdff showDiff: force true for equal and eql 2012-12-21 12:47:29 -05:00
Edwin Shao
cdcca4f5f6 FIX: assert.Throw checks error type/message 2012-11-30 19:39:41 +08:00
Jake Luer
b2642cfb80 Release 1.4.0 2012-11-29 03:26:55 -05:00
Jake Luer
220aa88386 use spaces (not tabs). Clean up #114 2012-11-29 03:17:26 -05:00
Jake Luer
d6d41a5259 Merge pull request #114 from trantorLiu/master
Add most() and least() to the API
2012-11-28 23:05:19 -08:00
Chun-Yi
0422f071a4 Add most() (alias: lte) and least() (alias: gte) to the API with new chainers "at" and "of".
The new chainers can be used with least() and most().
Examples:
	expect(5).to.be.at.least(5);
	(5).should.be.at.most(5);
	expect([1, 2]).to.have.length.of.at.least(2);
2012-11-29 11:55:57 +08:00
Jake Luer
0ce651c776 Merge pull request #104 from connec/deep_equals_circular_references
Added support (and tests) for circular references when checking deep (in)equality.
2012-11-18 10:09:47 -08:00
Niklas Närhinen
24d4991194 Check for 'actual' type
At least on Node.js actual property isn't correctly populated because of strict string comparison.
2012-11-16 09:50:30 +02:00
Chris Connelly
3d05feee32 Added support for circular references when checking deep (in)equality. 2012-10-21 22:15:49 +01:00
Jake Luer
8788025362 Release 1.3.0 2012-10-01 17:32:20 -04:00
Jake Luer
beeeac2da5 improve documentation of custom error messages 2012-10-01 15:13:34 -04:00
Jake Luer
ca18882362 Merge branch 'master' of git://github.com/Liffft/chai into Liffft-master
* 'master' of git://github.com/Liffft/chai:
  Cleaning up the js style…
  expect tests now include message pass-through
  packaging up browser-side changes…
  Increasing Throws error message verbosity
  Should syntax: piping message through

Conflicts:
	test/expect.js
2012-10-01 15:06:24 -04:00
Jake Luer
9dd85eabd3 improved buffer deep equal checking 2012-10-01 14:47:21 -04:00
Scott Nonnenberg
00b2ed3840 Cleaning up the js style…
I've been writing too much coffeescript!
2012-09-05 11:24:27 -07:00
Scott Nonnenberg
941f992a26 Increasing Throws error message verbosity
'cause we actually want to know what was thrown.
2012-09-04 23:13:44 -07:00
Scott Nonnenberg
e383a6ece8 Should syntax: piping message through 2012-09-04 23:10:25 -07:00
Domenic Denicola
1024e2dd14 Add a setter for Object.prototype.should. Closes #86. 2012-08-24 20:28:13 -04:00
Jake Luer
35bec1b896 Release 1.2.0 2012-08-07 01:05:25 -04:00
Jake Luer
a83c7772e0 comment updates for utilities 2012-08-07 00:57:59 -04:00
Jake Luer
7ce5e9347e tweak objDislay to only kick in if object inspection is too long 2012-08-07 00:57:38 -04:00
Jake Luer
dc6c5533eb first draft of error message refactor. #93 2012-08-01 21:05:25 -04:00
Jake Luer
19fe54399b add closeTo assertion to assert interface. Closes #89. 2012-08-01 20:21:52 -04:00
Paul Miller
6b66ce72dd Add check for DOM objects. 2012-07-28 03:27:38 +03:00
Jake Luer
e6d69c36e4 Merge branch 'master' of github.com:chaijs/chai 2012-07-26 14:12:23 -04:00
Jake Luer
4e3c89a14d bug - getActual not defaulting to assertion subject 2012-07-26 14:11:43 -04:00
Victor Costan
f269726e9c Don't inspect() assertion arguments if the assertion passes. 2012-07-19 02:09:14 -07:00
Jake Luer
b7aae4601f Release 1.1.1 2012-07-09 12:49:18 -04:00
Teddy Cross
ddfea9575b Document .equals
Not sure why it decided to move error.js around. Oh well?
2012-07-07 14:47:28 -04:00
Teddy Cross
45e458067a Add .equals as an alias of .equal 2012-07-07 13:49:18 -04:00
Jake Luer
456ee6ad83 Release 1.1.0 2012-06-26 14:32:49 -04:00
Domenic Denicola
79c3654691 Use utils.getName for all function inspections.
This makes the `respondTo` tests pass in IE, where functions don't themselves have a `name` property.
2012-06-26 12:30:25 -04:00
Kilian Ciuffolo
da2bbbf666 fixes #79 2012-06-26 13:41:15 +02:00
Jake Luer
c85882691f expand docs to indicate change of subject for chaining. Closes #78 2012-06-24 09:14:15 -04:00
Jake Luer
94cfe27c4c add that chain noop 2012-06-24 08:57:40 -04:00
Jake Luer
723dbdfe98 comments on how to property use length as chain. Closes #74 2012-06-24 08:54:56 -04:00
Jake Luer
0da5c375ce add support for length as chainable prop/method.
property can chain to above, below, within
`expect('foo').to.have.length.above(2);`
`expect('foo').to.have.length.below(4);`
`expect('foo').to.have.length.within(2,4);`
2012-06-24 08:44:14 -04:00
Jake Luer
cf1bac542e add getPathValue support for nested arrays 2012-06-24 08:19:01 -04:00
Jake Luer
802856849b fix bug for missing browser utils 2012-06-24 07:43:50 -04:00
Jake Luer
cc0367a46a move core assertions to own file and refactor all using utils
* all properties are now defined using `Assertion.addProperty`
* all methods are now defined using `Assertion.addMethod`
2012-06-24 07:06:26 -04:00
Jake Luer
ff8455f303 rearrange folder structure 2012-06-24 06:25:36 -04:00
Jake Luer
40b0eb2268 Release 1.0.4 2012-06-03 19:29:39 -04:00
Benjamin Horsleben
80aa590ec5 Added itself chain. 2012-06-02 19:27:55 +02:00
Jake Luer
a05cba500c simplify error inspections for cross browser compatibility 2012-05-29 13:28:41 -04:00
Jake Luer
d02e94adff fix safari addChainableMethod errors. Closes #69
- also added arguments alias to `Arguments`.
- note: one can also call `expect(arguments).to.be.an('arguments')`
2012-05-29 13:07:00 -04:00
Jake Luer
886e626e57 Release 1.0.3 2012-05-27 18:19:47 -04:00
domenic
8cd580d7f2 Make error message for eql/deep.equal more clear. 2012-05-27 17:34:27 -04:00
domenic
db98bd69e6 Fix .not.deep.equal.
It wasn't passing the negation through.
2012-05-27 17:31:06 -04:00
Jake Luer
1b89af7114 Release 1.0.2 2012-05-26 23:39:29 -04:00
domenic
e1256e9005 Use addChainableMethod to get away from __proto__ manipulation.
Helps with #66.
2012-05-26 22:38:47 -04:00
domenic
3a67f058f0 New addChainableMethod utility.
Uses `transferFlags`, and will be used for Chai's `a`/`an` and `includes`/`contains`.
2012-05-26 22:34:55 -04:00
domenic
5455ce4b5d Replace getAllFlags with transferFlags utility.
This will help more directly with #66 and with domenic/chai-as-promised#5.
2012-05-26 21:38:10 -04:00
Jake Luer
ffab05a192 utility - get all flags 2012-05-22 14:51:39 -04:00
Jake Luer
ca5368cf65 Release 1.0.1 2012-05-18 14:26:45 -04:00
domenic
554944f82f Fixing "an" vs. "a" grammar in type assertions.
Now says stuff like "expected x to be an array" instead of "expected x to be a array."
2012-05-18 14:05:06 -04:00
domenic
46a2f1c406 Uniformize assert interface inline docs.
At the same time, made small tweaks to the should/expect ones.
2012-05-18 14:00:50 -04:00
domenic
ae3be8c684 Don't use instanceof for assert.isArray.
This makes it more compatible with cross-frame checks.
2012-05-18 14:00:46 -04:00
domenic
4a938ef672 Add deep flag for equality and property value.
See #63 for more discussion.

Also adds to the assert interface:
 - deepProperty
 - notDeepProperty
 - deepPropertyVal
 - deepPropertyNotVal
2012-05-17 10:13:19 -04:00
domenic
771895aab8 Uniformize assertion inline docs. 2012-05-16 20:55:36 -04:00
Jake Luer
efc7759633 no reserved words as actuals. #62 2012-05-16 19:01:36 -04:00
Jake Luer
ec07b48ed0 Release 1.0.0 2012-05-15 14:36:29 -04:00
Jake Luer
a8d1404b2f browser build 2012-05-15 13:23:32 -04:00