Commit graph

382 commits

Author SHA1 Message Date
Jake Luer
8a2e00b486 test: [sauce] use karma@canary to prevent timeouts 2013-09-17 23:12:16 -04:00
Jake Luer
a8f94bdcbb test: [karma] use karma phantomjs runner
- tests refactored as bdd instead of tdd
- removed test/browser bootstraps
- add karma-runner
2013-09-17 17:22:36 -04:00
Jake Luer
7bc580910e core: [assertion-error] replace internal assertion error with dep 2013-06-17 15:27:50 -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
George Kats
2c4da4a91a Add test for different RegExp flags. 2013-06-05 23:26:42 +03:00
George Kats
f62eb19a66 Add test for regexp comparison. 2013-06-05 02:14:53 +03: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
30784962da Merge branch 'master' of github.com:chaijs/chai
* 'master' of github.com:chaijs/chai:
  giving members a no-flag assertion
  Code review comments - changing syntax
  Code review comments
  Adding members and memberEquals assertions for checking for subsets and set equality. Implements chaijs/chai#148.
  Restore the `call` and `apply` methods of Function when adding a chainable method.
2013-04-29 17:18:34 -04:00
Jake Luer
e5e3a4fa42 test: [assert] deep equal ordering 2013-04-29 17:18:22 -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
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
4db0b20c57 test: for ever err() there must be a passing version 2013-02-04 19:28:26 -05:00
Jake Luer
6ccbd03780 tests: refactor some tests to support new objDisplay output 2013-02-03 18:03:40 -05:00
Jake Luer
364939ef15 test: [bootstrap] normalize boostrap across all test scenarios 2013-02-03 18:03:15 -05:00
Jake Luer
8ae89cd72d test: [expect] add arguments type detection test 2013-02-03 15:12:29 -05:00
Jake Luer
398964d75b test: add mochaPhantomJS support and component test file 2013-02-03 14:40:50 -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
3e8e9dea49 test: [Assertion] configruable showDiff flag. Closes #132 2013-02-03 13:25:55 -05:00
Jake Luer
30b48bd4c5 Merge branch 'master' into feature/saucelabs
* master:
  Fix issue #137, test message existence by using message!=null rather than using message
  Fixed backwards negation messages.
2013-02-03 13:00:16 -05:00
Jake Luer
87b0a44ecc support: add mocha cloud runner, client, and html test page 2013-02-03 12:59:15 -05:00
Jake Luer
654bb8f90b test: [saucelabs] add auth placeholder 2013-02-03 12:57:25 -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
Ruben Verborgh
9bcc5e7f08 Functions throwing strings can reliably be tested. 2013-01-27 20:11:50 +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
Jake Luer
4582d700b0 test: [display] array test for mocha object diff 2012-12-21 15:01:15 -05:00
Jake Luer
3aa71e77cf test: [expect] type null. #122 2012-12-15 15:08:30 -05:00
Edwin Shao
f438d37e44 TST: assert.Throw should check error type/message
Currently, assert.Throw will not take into account the expected
error type or message passed in. Write tests to document this.
2012-11-30 19:37:12 +08:00
Jake Luer
86fe576d56 convert tests to use new bootstrap 2012-11-29 03:18:48 -05:00
Jake Luer
5e07b04fdb refactor testing bootstrap 2012-11-29 03:18:25 -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
Chris Connelly
3d05feee32 Added support for circular references when checking deep (in)equality. 2012-10-21 22:15:49 +01:00
Jake Luer
d9758753a2 add back buffer test for deep equal 2012-10-01 16:14:32 -04:00
Jake Luer
ac52bd12b3 do not write flags to assertion.prototype 2012-10-01 16:13:57 -04:00
Jake Luer
a2e8d2ce0f remove buffer test from expect 2012-10-01 15:31:54 -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
d6bbc5fddd expect tests now include message pass-through 2012-09-05 11:13:14 -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
e8cc23ddd9 Make globalShould test work in browser too.
Needed to move `should` from test/should.js out of the global scope.
2012-08-24 22:33:47 -04:00
Domenic Denicola
1024e2dd14 Add a setter for Object.prototype.should. Closes #86. 2012-08-24 20:28:13 -04:00
Jake Luer
429cb6d5a6 add display sample for error message refactor 2012-08-01 21:12:49 -04:00
Jake Luer
19fe54399b add closeTo assertion to assert interface. Closes #89. 2012-08-01 20:21:52 -04:00
Victor Costan
f269726e9c Don't inspect() assertion arguments if the assertion passes. 2012-07-19 02:09:14 -07:00
Domenic Denicola
61db4e05c6 Disable "Assertion.includeStack is false" test in IE.
This only manifested in IE 10; IE 9 was fine since it didn't have the `stack` property.
2012-06-26 12:35:41 -04:00
Kilian Ciuffolo
da2bbbf666 fixes #79 2012-06-26 13:41:15 +02:00
Jake Luer
7629f8c4e5 tests for length as chainable property. #74 2012-06-24 08:46:44 -04:00
Jake Luer
5ed371e655 tests for getPathValue when working with nested arrays. Closes #77 2012-06-24 08:22:12 -04:00
Jake Luer
802856849b fix bug for missing browser utils 2012-06-24 07:43:50 -04:00
Benjamin Horsleben
80aa590ec5 Added itself chain. 2012-06-02 19:27:55 +02: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
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
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
6090d77ea8 test - get all flags 2012-05-22 14:51:39 -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
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
John Firebaugh
ce5fc298ab Use defined return value of Assertion extension functions 2012-05-09 19:22:25 -07:00
Jake Luer
d49436ccc9 assert test conformity for minor refactor api 2012-05-09 19:16:42 -04:00
Jake Luer
1bb600e996 update util tests for new add/overwrite prop/method format 2012-05-09 18:57:14 -04:00
Jake Luer
626d11efb4 doc test suite 2012-05-09 18:43:01 -04:00
domenic
3b927d4994 Using message flag in getMessage util instead of old msg property. 2012-05-07 18:03:50 -04:00
domenic
8625a5ae09 getMessage shouldn't choke on null/omitted messages.
This came up when doing `assert(false, "message")`.
2012-05-07 17:49:38 -04:00
Jake Luer
aa3d84aab6 missing assert tests for ownProperty 2012-05-06 07:22:29 -04:00
Jake Luer
d03d686330 reset AssertionError to include full stack 2012-05-06 07:01:34 -04:00
Jake Luer
4a05659fa0 test for plugin utilities 2012-05-06 06:54:32 -04:00
Jake Luer
943b7569bd assert match/notMatch tests 2012-05-04 17:55:11 -04:00
Jake Luer
1082fc6544 cleaner should interface export.
- also aliased `chai.Should()` as the original would be overwritten after the first call (helps when using watch mode for test runners)
2012-05-04 17:55:11 -04:00
Jake Luer
0a8ddc452f moved almostEqual / almostDeepEqual to stats plugin 2012-05-04 17:55:11 -04:00
Jake Luer
f596097e7b added mocha.opts
(so @domenic can run tests without the makefile)
2012-05-04 17:55:11 -04:00
Veselin Todorov
c268462bf8 Add test for utils.addMethod 2012-04-29 20:51:40 +03:00
Veselin Todorov
f287b09c40 Fix a typo 2012-04-29 17:59:27 +03:00
Veselin Todorov
e3cd113725 Add test for utils.overwriteMethod 2012-04-29 10:21:53 +03:00
Veselin Todorov
f58760c615 Add undefined assertion 2012-04-29 09:59:24 +03:00
Veselin Todorov
234f4ee613 Add null assertion 2012-04-29 09:59:14 +03:00
Veselin Todorov
930dfbdc4f Fix an issue with mocha --watch
When running tests with `mocha --watch` the following exception is thrown:

  TypeError: Cannot redefine property: testing

Here is the fix for it. We should be more careful in the future, since the `watch` param is super useful and a lot of developers are using it.
2012-04-29 09:58:56 +03:00
Jake Luer
ee2050abaa Merge pull request #54 from josher19/master
Added almostEqual to assert test suite.
2012-04-23 21:07:36 -07:00
josher19
19c1fb1b9c Added almostEqual and deepAlmostEqual to assert test suite. 2012-04-23 13:56:44 +08:00
Jake Luer
87870b1b9d clean up redundant tests 2012-04-22 16:54:11 -04:00
Jake Luer
88c121e5ee added utility tests to browser specs 2012-04-22 15:26:54 -04:00
Jake Luer
c8c780aa35 beginning utility testing 2012-04-22 15:26:45 -04:00
Veselin Todorov
4a8b41e268 Include/contain are now both properties and methods 2012-04-20 20:44:23 +03:00
domenic
4227b80d3a Fixing order of error message test.
It was saying "expected <expected> to equal <actual>," which is backwards, and very confusing.
2012-04-15 15:14:43 -04:00
domenic
e7d89e24dd Add doctypes 2012-04-15 14:27:01 -04:00
Jake Luer
d171238026 [refactor] all usage of Assertion.prototype.assert now uses template tags and flags 2012-04-11 13:30:40 -04:00
domenic
41f645dbb8 Added support for throw(errorInstance).
Closes #47.
2012-04-09 00:34:02 -04:00
domenic
f58f1ebb12 Use a foolproof method of grabbing an error's name.
Closes #45.
2012-04-09 00:34:01 -04:00
domenic
48eeb56a75 Removed constructor.name check from throw.
Closes #46 and helps with #45.
2012-04-09 00:34:01 -04:00
Jake Luer
9d302aa435 disabled stackTrack configuration tests until api is stable again 2012-04-06 21:17:43 -04:00
Jake Luer
850509a73a first version of line displayed error for node js (unstable)
must have `chai.Assertion.includeStack = true`
2012-04-06 21:15:54 -04:00
Jake Luer
a7c262523c tests for assert interface negatives. Closed #42 2012-04-06 19:57:45 -04:00
Jake Luer
938c064d5f Added assert.fail. Closes #40 2012-03-21 07:17:51 -04:00
Jake Luer
1abf9cfc8c better error message for assert.operator. Closes #39 2012-03-21 07:17:39 -04:00
Jake Luer
7890dc6aa6 chai.fail no longer exists 2012-03-14 16:52:41 -04:00
Jake Luer
bacfc3d799 Added asset#isDefined. Closes #37. 2012-03-14 16:51:21 -04:00
Jake Luer
9ab32d7757 Merge branch 'bug/33-throws' 2012-03-07 11:42:50 -05:00
Jake Luer
09c970feaa Assertion#throw should tests updated 2012-03-07 11:38:58 -05:00
Jake Luer
7bb24c874e Assertion#throw expect tests 2012-03-07 11:37:23 -05:00
Veselin Todorov
8eaaf273f9 Add more tests for empty in should. 2012-03-07 18:09:52 +02:00
Veselin Todorov
2a34fe8120 Add more tests for empty in expect. 2012-03-07 18:01:18 +02:00
Veselin Todorov
f1e6a9abb3 Merge branch 'master' into empty-object
* master:
  don't switch act/exp
  Update the compiled verison.
  Add `assert.operator`.
  Notes on messages. #22
  browser build
  have been test
  below tests
  browser build
  remove unnecessary fail export
  full support for actual/expected where relevant
  Assertion.assert support expected value
  clean up error
2012-03-07 17:49:20 +02:00
Veselin Todorov
c7cc03f059 Add assert.operator. 2012-03-02 15:49:07 +02:00
Jake Luer
d0befca9b8 have been test 2012-03-01 19:29:55 -05:00
Jake Luer
fe72b36477 below tests 2012-03-01 19:28:30 -05:00
Veselin Todorov
670f128970 Add object & sane arguments support to Assertion#empty. 2012-02-29 21:51:42 +02:00
Veselin Todorov
4c9b513779 Update assert.doesNotThrow test in order to check the use case when type is a string. 2012-02-27 22:34:50 +02:00
Veselin Todorov
e835dc5730 Add test for assert.ifError. 2012-02-27 22:33:44 +02:00
Veselin Todorov
63e1349473 Falsey -> falsy. 2012-02-27 22:33:24 +02:00
Veselin Todorov
e95a29ec5e Full coverage for assert.throws and assert.doesNotThrow. 2012-02-27 22:27:36 +02:00
Veselin Todorov
10c2dc7a76 Add test for assert.doesNotThrow. 2012-02-27 22:22:05 +02:00
Veselin Todorov
4d9bd743a6 Add test for assert.throws. 2012-02-27 22:20:41 +02:00
Veselin Todorov
f28a293e89 Add test for assert.length. 2012-02-27 22:17:44 +02:00
Veselin Todorov
128f6971f8 Add test for assert.include. 2012-02-27 22:14:41 +02:00
Veselin Todorov
04ea811baa Add test for assert.isBoolean. 2012-02-27 22:12:04 +02:00
Veselin Todorov
0ca1a152ff Fix the implementation of assert.isNumber. 2012-02-27 22:10:19 +02:00
Veselin Todorov
de757467b2 Add test for assert.isString. 2012-02-27 22:04:17 +02:00
Veselin Todorov
16a6ab1bd3 Add test for assert.isArray. 2012-02-27 22:03:04 +02:00
Veselin Todorov
c95a364a59 Add test for assert.isUndefined. 2012-02-27 22:00:44 +02:00
Veselin Todorov
074ff270cc Add test for assert.isNotNull. 2012-02-27 21:57:30 +02:00
Veselin Todorov
95172dafaa Fix assert.isNull implementation. 2012-02-27 21:55:13 +02:00
Veselin Todorov
1fd0ca00f7 Add test for assert.isNull. 2012-02-27 21:35:03 +02:00
Veselin Todorov
875870bf9b Add test for assert.notDeepEqual. 2012-02-27 21:22:17 +02:00
Veselin Todorov
5ce1ef1b40 Add test for assert.deepEqual. 2012-02-27 21:20:39 +02:00
Veselin Todorov
a0794e79d7 Add test for assert.notStrictEqual. 2012-02-27 21:19:05 +02:00
Veselin Todorov
99a38a07f5 Add test for assert.strictEqual. 2012-02-27 21:17:03 +02:00
Veselin Todorov
35bf81bf1e Add test for assert.notEqual. 2012-02-27 21:15:14 +02:00
Veselin Todorov
536b6dce20 Add should tests for type checks. 2012-02-25 20:42:49 +02:00
Veselin Todorov
f731ebbc67 Add function type check test. 2012-02-25 20:38:43 +02:00
Veselin Todorov
dadda1bebe Add more type checks tests. 2012-02-25 20:33:05 +02:00
Veselin Todorov
701feaa671 Add test for new Number type check. 2012-02-25 20:28:40 +02:00
Jake Luer
ec4527cf4d putting coverage and tests for docs in docs/out/support 2012-02-25 01:33:59 -05:00
Jake Luer
c8ce24deb1 make docs 2012-02-25 01:33:59 -05:00
Jake Luer
d871b5f7d9 rename configuration test 2012-02-25 01:33:59 -05:00
Veselin Todorov
833a80c4d3 Add .closeTo() should test. 2012-02-25 00:00:15 +02:00
Veselin Todorov
400f67dbf0 Add .closeTo() expect test. 2012-02-25 00:00:03 +02:00
Veselin Todorov
ec0277de5c .. -> () in .satisfy() should test. 2012-02-24 22:46:04 +02:00
Veselin Todorov
06446fd8e0 Add .satisfy() should test. 2012-02-24 22:30:30 +02:00
Veselin Todorov
55814ded6f Add .satisfy() expect test. 2012-02-24 22:30:20 +02:00
Veselin Todorov
f5b1a873d4 Add respondTo should test. 2012-02-24 21:53:33 +02:00
Veselin Todorov
27a36a5f85 Add respondTo expect test. 2012-02-24 21:53:15 +02:00
Jake Luer
fad1e41adc suite name more generic 2012-02-22 23:45:19 -05:00
Jeff Barczewski
d23c5a8d4e Update test to be compatible with browsers that do not support err.stack 2012-02-22 16:45:42 -06:00
Jeff Barczewski
f64cb3ab0e udpated compiled chai.js and added to browser tests 2012-02-22 16:17:08 -06:00
Jeff Barczewski
105fb02e98 Allow inclusion of stack trace for Assert error messages to be configurable
```javascript
Assertion.includeStack = true;  // enable stack trace to be included on error
```

Default value is false, resulting in less cluttered error results.
Allow user to configure this to true, to see stack trace to where error
occurred.
2012-02-22 14:17:49 -06:00
Jake Luer
67024ae9f5 regex error.message testing 2012-02-07 16:39:08 -05:00
Jake Luer
3d964e5479 tests for using plugins 2012-02-07 16:13:17 -05:00
Jake Luer
d047691134 added assert tests to browser test runner 2012-01-25 16:30:41 -05:00
Vinay Pulim
9a644bfcf4 fix isObject() 2012-01-25 15:33:50 -05:00
Jake Luer
78b5bb429b some tests for assert module 2012-01-21 18:38:18 -05:00
Jake Luer
4ae379d76a test for should (not) exist 2012-01-02 00:48:43 -05:00
Jake Luer
950c066af5 browser uses tdd 2012-01-02 00:45:11 -05:00
Jake Luer
a51dece9a5 convert tests to tdd 2012-01-02 00:45:06 -05:00
Jake Luer
c5e98d484f Release 0.1.4 2011-12-26 13:19:22 -05:00
Jake Luer
c60ad633d1 browser lib update for new assert interface compatiblitiy 2011-12-24 13:20:48 -05:00
Jake Luer
5b78bec84f added should tests to browser 2011-12-24 13:11:09 -05:00
Jake Luer
bb6c5e97e8 new expect empty tests 2011-12-24 13:10:55 -05:00
Jake Luer
a4ca608f45 should test browser compat 2011-12-24 13:10:41 -05:00
Jake Luer
6bf25daf17 code clean 2011-12-18 07:30:59 -05:00
Jake Luer
afb45f033c throw tests 2011-12-18 06:41:13 -05:00
Jake Luer
0165fc068a contain is now include … keys modifier is now contain 2011-12-18 05:56:21 -05:00
Jake Luer
bbdb2a49b1 removed #respondTo 2011-12-18 04:56:48 -05:00
Jake Luer
1c9cbc8ecb added exist test 2011-12-15 15:06:17 -05:00
Jake Luer
4d0a23f2e6 var expect outside of browser if check 2011-12-15 13:19:11 -05:00
Jake Luer
6538dcc16a failing on purpose successful .. back to normal 2011-12-15 08:01:06 -05:00
Jake Luer
e099212192 testing travis failure 2011-12-15 07:59:16 -05:00
Jake Luer
e986a44d33 browser tests expect (all working) 2011-12-15 07:07:35 -05:00
Jake Luer
bc15a19616 chai.fail (should ui) 2011-12-15 07:06:51 -05:00
Jake Luer
18d6180213 expect tests browser compatible 2011-12-15 07:03:47 -05:00
Jake Luer
958661003b tests for should and expect (all pass) 2011-12-15 05:54:37 -05:00
Jake Luer
84734b43cc should compatibility testing 2011-12-15 05:35:17 -05:00