Commit graph

709 commits

Author SHA1 Message Date
Ankit Singh
3ace4a0bbd property assertion should only accept strings if nested, fixes #1043 (#1044)
* property assertion should only accept strings if nested, fixes #1043

* similar logic seperated out

* test cases for fix #1043

* type check if not isNested with tests

* Tests for assert and should inteface

* Error message change

* changes in should and assert tests as per review

* assert tests modified

* Review comments changes

* review comments fixes
2017-10-02 17:44:05 -03:00
abetomo
1c1b07490b Remove meaningless processing
numLinesEst does not seem to be used anywhere after this.
2017-09-13 15:10:14 +09:00
abetomo
62baf22a44 Fix string enclosed in single quotes in core/assertions.js
In other code in this file, the string was enclosed in single quotes
2017-09-13 15:10:14 +09:00
abetomo
7d1e815f22 Remove unused variable declaration
in utils/getMessage.js

in core/assertions.js
2017-09-13 15:09:36 +09:00
abetomo
d9aa813974 Remove unnecessary line feeds 2017-09-12 18:57:54 +09:00
abetomo
84d1410c48 Remove unused variables 2017-09-12 11:18:20 +09:00
abetomo
2a12f71bf7 Fix to declare before using actual 2017-09-12 11:14:59 +09:00
Aleksey Shvayka
37dc80ddd0 docs: correct .ok description 2017-09-11 02:26:04 +03:00
Aleksey Shvayka
6586e2dcbe add missing vars 2017-09-06 22:18:25 +03:00
Alhadis
b534fca6c0 chai@4.1.2 2017-08-31 21:57:15 +10:00
Alhadis
31c35595d7 Use a hardcoded no-op instead of instancing
The use of `new Function()` causes an EvalError if the environment's CSP
forbids execution of unsafe-eval. As there's no runtime evaluation being
performed, it's better to use a plain anonymous function instead.
2017-08-24 05:35:11 +10:00
Grant Snodgrass
ac48db3a72 chai@4.1.1 2017-08-04 18:29:14 -04:00
Keith Cirkel
92d2cca468 docs: re-indent hasAnyKeys code
Refs #1014
2017-08-02 21:11:36 +01:00
Keith Cirkel
b625497f1e Merge pull request #1012 from meeber/fix-include-types
fix: `.include` to work with all objects
2017-08-02 20:59:47 +01:00
zenheart
113a5b8b6a fix: correct hasAnyKeys comment error 2017-08-02 08:55:45 +08:00
Grant Snodgrass
c01cf30de9 fix: .include to work with all objects
Overly strict type-checking was causing `.include` to reject `Error`
objects and objects with a custom `@@toStringTag`.
2017-07-31 17:22:58 -04:00
Grant Snodgrass
c107abb319 fix: .instanceof to allow DOM interfaces in IE11 2017-07-24 18:57:42 -04:00
v1adko
45cb32710a chai@4.1.0 2017-06-24 09:30:03 +03:00
Aleksey Shvayka
2eddd79002 Add ES6 collection support to include() (#994)
* fix error messages tests

* add tests

* add implementation

* performance tweaks

* add tests for SameValueZero

* drop weakmap support

* update docs
2017-06-23 15:35:07 -07:00
Vlad Kolbaya
3c932e21e6 feat: allow dates for isBelow and isAbove assertions (#990)
* Fixed most tests

* Fix date uniformity (UTC)

* Add comment

* Cleanup

* Change extra functions (WIP)

* Finished tests

* Add master chai.js back

* Uncomment failing tests

* Update master and tests

* Actual seconds, duh

* Refactor 'above'

* Update all methods

* More explicit error

* Documentation - articles consistency

* Custom message test in assert

* No parenthesis in should

* Custom message for isAbove
2017-06-23 12:54:23 +01:00
Keith Cirkel
5daceabe7d Merge pull request #988 from samlanning/missing-var
Add a missing var keyword found by lgtm.com
2017-06-19 10:50:41 +01:00
Keith Cirkel
9116bc8591 Merge pull request #993 from meeber/refactor-expect-types
refactor: `expectTypes` to access `ssfi` flag
2017-06-19 10:48:23 +01:00
Grant Snodgrass
e7b23846b4 refactor: expectTypes to access ssfi flag
The `ssfi` flag doesn't need to be passed to the `expectTypes`
util function because it can access it directly from the assertion
object.
2017-06-11 08:33:48 -04:00
Grant Snodgrass
e6ddf64c8f fix: check target's type in .property assertion
Previously, the `.property` assertion failed ungracefully if the target was `null` or `undefined`. This commit causes an `AssertionError` to be thrown instead so that the ssfi flag and custom error messages are respected.
2017-06-10 17:51:50 -04:00
Sam Lanning
7e466af33b Add a missing var keyword found by lgtm.com 2017-06-05 18:50:33 -07:00
Lucas Fernandes da Costa
616cf8bf88 Revert get version package json (#986)
* Revert getting version from package.json

* chai@4.0.2
2017-06-05 14:12:19 -03:00
Keith Cirkel
0825826059 Merge pull request #964 from zetamorph/assert-nestedInclude-ownInclude
assert: add nestedInclude, deepNestedInclude, ownInclude and deepOwnInclude
2017-05-09 10:08:36 +01:00
Grant Snodgrass
f3adfd911e fix: PhantomJS 1.x incompatibility (#966) 2017-05-08 17:22:54 -03:00
Johannes Loewe
b744130df9 Assert: made documentation more descriptive
Assert: made documentation more descriptive
2017-05-07 14:49:42 +02:00
Johannes Loewe
40bb490060 assert interface: add .deepOwnInclude and notdeepOwnInclude 2017-05-05 00:54:11 +02:00
Johannes Loewe
97b6243431 assert interface: add .ownInclude and .notOwnInclude 2017-05-05 00:54:11 +02:00
Johannes Loewe
24d7fa3849 assert interface: add deepNestedInclude and notDeepNestedInclude 2017-05-05 00:54:11 +02:00
Johannes Loewe
7063b940a8 assert interface: add nestedInclude and notNestedInclude 2017-05-05 00:54:10 +02: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
Grant Snodgrass
7f8a268e52 fix: always honor custom message 2017-04-04 17:28:19 -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
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
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
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