chai 5.0.3 → 5.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +3 -3
  2. package/chai.js +94 -220
  3. package/eslint.config.js +12 -0
  4. package/lib/chai/assertion.js +30 -31
  5. package/lib/chai/config.js +18 -24
  6. package/lib/chai/core/assertions.js +253 -223
  7. package/lib/chai/interface/assert.js +574 -670
  8. package/lib/chai/interface/expect.js +12 -7
  9. package/lib/chai/interface/should.js +43 -40
  10. package/lib/chai/utils/addChainableMethod.js +6 -11
  11. package/lib/chai/utils/addLengthGuard.js +3 -3
  12. package/lib/chai/utils/addMethod.js +5 -6
  13. package/lib/chai/utils/addProperty.js +5 -6
  14. package/lib/chai/utils/compareByInspect.js +4 -9
  15. package/lib/chai/utils/expectTypes.js +7 -8
  16. package/lib/chai/utils/flag.js +5 -5
  17. package/lib/chai/utils/getActual.js +3 -3
  18. package/lib/chai/utils/getEnumerableProperties.js +2 -3
  19. package/lib/chai/utils/getMessage.js +4 -8
  20. package/lib/chai/utils/getOperator.js +8 -4
  21. package/lib/chai/utils/getOwnEnumerableProperties.js +2 -7
  22. package/lib/chai/utils/getOwnEnumerablePropertySymbols.js +2 -3
  23. package/lib/chai/utils/getProperties.js +5 -3
  24. package/lib/chai/utils/index.js +42 -109
  25. package/lib/chai/utils/inspect.js +5 -4
  26. package/lib/chai/utils/isNaN.js +3 -3
  27. package/lib/chai/utils/isProxyEnabled.js +1 -1
  28. package/lib/chai/utils/objDisplay.js +2 -7
  29. package/lib/chai/utils/overwriteChainableMethod.js +7 -8
  30. package/lib/chai/utils/overwriteMethod.js +10 -11
  31. package/lib/chai/utils/overwriteProperty.js +10 -12
  32. package/lib/chai/utils/proxify.js +9 -9
  33. package/lib/chai/utils/test.js +3 -7
  34. package/lib/chai/utils/transferFlags.js +4 -6
  35. package/lib/chai/utils/type-detect.js +4 -0
  36. package/lib/chai.js +9 -31
  37. package/package.json +6 -3
  38. package/web-test-runner.config.js +4 -1
@@ -9,10 +9,9 @@ export const config = {
9
9
  *
10
10
  * chai.config.includeStack = true; // enable stack on error
11
11
  *
12
- * @param {Boolean}
13
- * @api public
12
+ * @param {boolean}
13
+ * @public
14
14
  */
15
-
16
15
  includeStack: false,
17
16
 
18
17
  /**
@@ -24,10 +23,9 @@ export const config = {
24
23
  * will be true when the assertion has requested a diff
25
24
  * be shown.
26
25
  *
27
- * @param {Boolean}
28
- * @api public
26
+ * @param {boolean}
27
+ * @public
29
28
  */
30
-
31
29
  showDiff: true,
32
30
 
33
31
  /**
@@ -46,10 +44,9 @@ export const config = {
46
44
  *
47
45
  * chai.config.truncateThreshold = 0; // disable truncating
48
46
  *
49
- * @param {Number}
50
- * @api public
47
+ * @param {number}
48
+ * @public
51
49
  */
52
-
53
50
  truncateThreshold: 40,
54
51
 
55
52
  /**
@@ -66,10 +63,9 @@ export const config = {
66
63
  * This feature is automatically disabled regardless of this config value
67
64
  * in environments that don't support proxies.
68
65
  *
69
- * @param {Boolean}
70
- * @api public
66
+ * @param {boolean}
67
+ * @public
71
68
  */
72
-
73
69
  useProxy: true,
74
70
 
75
71
  /**
@@ -87,9 +83,8 @@ export const config = {
87
83
  * chai.config.proxyExcludedKeys = ['then', 'inspect'];
88
84
  *
89
85
  * @param {Array}
90
- * @api public
86
+ * @public
91
87
  */
92
-
93
88
  proxyExcludedKeys: ['then', 'catch', 'inspect', 'toJSON'],
94
89
 
95
90
  /**
@@ -101,20 +96,19 @@ export const config = {
101
96
  *
102
97
  * // use a custom comparator
103
98
  * chai.config.deepEqual = (expected, actual) => {
104
- * return chai.util.eql(expected, actual, {
105
- * comparator: (expected, actual) => {
106
- * // for non number comparison, use the default behavior
107
- * if(typeof expected !== 'number') return null;
108
- * // allow a difference of 10 between compared numbers
109
- * return typeof actual === 'number' && Math.abs(actual - expected) < 10
110
- * }
111
- * })
99
+ * return chai.util.eql(expected, actual, {
100
+ * comparator: (expected, actual) => {
101
+ * // for non number comparison, use the default behavior
102
+ * if(typeof expected !== 'number') return null;
103
+ * // allow a difference of 10 between compared numbers
104
+ * return typeof actual === 'number' && Math.abs(actual - expected) < 10
105
+ * }
106
+ * })
112
107
  * };
113
108
  *
114
109
  * @param {Function}
115
- * @api public
110
+ * @public
116
111
  */
117
-
118
112
  deepEqual: null
119
113
 
120
114
  };