Commit graph

1463 commits

Author SHA1 Message Date
Grant Snodgrass
d3908a6688
Merge pull request #1117 from s-leroux/assert/fail/only-one-argument
feat: Add the assert.fail([message]) interface
2018-01-12 06:33:46 -05:00
Sylvain Leroux
0d1b5862fe feat: Add the .fail([message]) interface
Fix #1116.
The `assert.fail` interface should accept being called with
only 1 arguments to fail with a custom message.
2018-01-12 08:32:57 +01:00
Sophie Alpert
c02f64b160 perf: Optimize proxify and stringDistance (#1098)
- Fill 2D array with ints upfront to reduce property access cost
- Change from recursive to simpler iterative (DP) solution
- Add cap parameter to stringDistanceCapped to limit computation
- Make candidate generation use a simple loop to avoid allocating unnecessary arrays and to call stringDistance only once on each pair of strings instead of every time in the sort callback

This improves chai perf by about 13% on @bmeurer's https://github.com/v8/web-tooling-benchmark.
2018-01-07 20:55:11 +00:00
Colin Eberhardt
f54f71c234 docs: improve throws examples (#1113)
When throws is invoked with two arguments, where the second is a string or regexp, the second argument is the **errMsgMatcher**. The current examples imply that this string is the **message**  rather than the matcher.
2018-01-04 21:31:39 +00:00
Jérémie Astori
9c1a99f065
Merge pull request #1107 from tbroadley/fix-typos
Fix typos
2017-12-15 21:17:23 -05:00
Thomas Broadley
3d24db01d0 docs: fix typos 2017-12-15 19:28:40 -05:00
Andrew
0af30b79c9 feat(chai/config): add 'catch' to proxyExcludedKeys (#1101)
closes #1050
2017-12-10 18:25:07 +00:00
Benedikt Meurer
eae99d1502 fix: avoid repeated String#slice calls in stringDistance. (#1095)
The `stringDistance` function calls

```js
strA.slice(0, -1)
```

and

```js
strB.slice(0, -1)
```

multiple times, which is a bit of a waste of time here. JavaScript
engines cannot generally eliminate the duplicated calls easily, so
it's better to avoid the redundant calls altogether.

This improves the chai test on the
[web-tooling-benchmark](https://github.com/v8/web-tooling-benchmark) by
around 8% when run with upcoming V8 6.4.
2017-12-02 09:29:39 -02:00
Simone Vittori
9a6610eb1e docs: fix typos and remove trailing whitespaces (#1042) 2017-11-22 22:02:05 +00:00
Grant Snodgrass
6e9bfc1329 chore: update dependencies (#1074) 2017-11-04 00:52:09 -02:00
Grant Snodgrass
2eafe7339b
Merge pull request #1073 from brutalcrozt/codecov
Chore: change coverage service (coverall to codecov)
2017-10-30 07:52:51 -04:00
brutalcrozt
a89620fbaa Chore: change coverage service (coverall to codecov)
The reason of change mentioned on #927
  This patch:
    - add codecov as devDep, as it's not pre-installed by travis.
    - add codecov script on travis.
    - change badge link (coverall to codecov), and point the image to chai account on codecov.
  Fix #927
2017-10-29 22:10:14 +07:00
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
Keith Cirkel
19e2c18cff Merge pull request #1049 from abetomo/clean_code
Remove unnecessary code
2017-09-13 11:56:13 -07: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
Keith Cirkel
0d19b35182 Merge pull request #1048 from abetomo/fix_variable_declaration
Fix variable declaration
2017-09-12 02:15:40 -07: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
Jérémie Astori
9489ecee82 Merge pull request #1047 from chaijs/assert-description
docs: correct `.ok` description
2017-09-10 23:49:59 -04:00
Jérémie Astori
312dc2a5a0 Merge pull request #1013 from meeber/add-package-lock
chore: add package-lock.json
2017-09-10 23:04:36 -04:00
Aleksey Shvayka
37dc80ddd0 docs: correct .ok description 2017-09-11 02:26:04 +03:00
Keith Cirkel
dbeae08fe5 Merge pull request #1040 from shvaikalesh/master
Make tests pass with `--use_strict`
2017-09-06 14:23:29 -07:00
Aleksey Shvayka
300b994ad3 do not attempt to define properties on primitives 2017-09-06 22:19:26 +03:00
Aleksey Shvayka
d4fde80a3c fix instanceof rethrow test 2017-09-06 22:19:10 +03:00
Aleksey Shvayka
6586e2dcbe add missing vars 2017-09-06 22:18:25 +03:00
Grant Snodgrass
529d395fa0 Merge pull request #1037 from Cutlery-Drawer/master
chai@4.1.2
2017-08-31 17:35:42 -04:00
Alhadis
b534fca6c0 chai@4.1.2 2017-08-31 21:57:15 +10:00
Jérémie Astori
c592551795 Merge pull request #1032 from Cutlery-Drawer/csp-fix
Use a hardcoded no-op instead of instancing
2017-08-23 16:00:02 -04: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
Keith Cirkel
1ae9386901 Merge pull request #1025 from yanca018/master
Update license
2017-08-14 09:27:36 +01:00
yanca018
786043bffc Update license 2017-08-14 02:40:04 -05:00
Pauric Holleran
7c1ca16fb3 docs: add missing assert parameters (#1023) 2017-08-09 14:22:25 +03:00
Grant Snodgrass
94eb738a23 chore: add package-lock.json 2017-08-06 09:53:32 -04:00
greenkeeper[bot]
6e72c5ac9a fix(package): update deep-eql to version 3.0.0 (#1020) 2017-08-06 00:42:35 +03:00
Keith Cirkel
02ddebd8f2 Merge pull request #1019 from meeber/release-4.1.1
chai@4.1.1
2017-08-05 08:28:17 +01:00
Grant Snodgrass
ac48db3a72 chai@4.1.1 2017-08-04 18:29:14 -04:00
Grant Snodgrass
d2e9599bec Merge pull request #1016 from chaijs/fix-reindent-code-1014
docs: re-indent hasAnyKeys code
2017-08-02 16:53:41 -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
Keith Cirkel
8fa24f2972 Merge pull request #1014 from zenHeart/fix-hasAnyKeys-comment
fix: correct hasAnyKeys comment error
2017-08-02 20:57:32 +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
Keith Cirkel
1847ef8e7e Merge pull request #1008 from meeber/fix-ie11-instanceof
fix: `.instanceof` to allow DOM interfaces in IE11
2017-07-26 09:45:05 +01:00
Grant Snodgrass
c107abb319 fix: .instanceof to allow DOM interfaces in IE11 2017-07-24 18:57:42 -04:00
Grant Snodgrass
df9073cb8e Merge pull request #998 from v1adko/make-release
chai@4.1.0
2017-07-11 19:57:05 -04:00
Grant Snodgrass
cad9933b5a Merge pull request #1004 from chaijs/code-owners
Create CODEOWNERS
2017-07-11 19:44:20 -04:00
Keith Cirkel
cf70b11f99 Create CODEOWNERS 2017-07-11 19:09:10 -04:00