chai 5.1.2 → 5.2.0

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.
package/eslint.config.js CHANGED
@@ -1,12 +1,26 @@
1
1
  import jsdoc from "eslint-plugin-jsdoc";
2
+ import eslintjs from "@eslint/js";
3
+
4
+ const {configs: eslintConfigs} = eslintjs;
2
5
 
3
6
  export default [
4
7
  jsdoc.configs["flat/recommended"],
8
+ eslintConfigs["recommended"],
5
9
  {
10
+ languageOptions: {
11
+ // if we ever use more globals than this, pull in the `globals` package
12
+ globals: {
13
+ console: false
14
+ }
15
+ },
6
16
  rules: {
7
17
  "jsdoc/require-param-description": "off",
8
18
  "jsdoc/require-returns-description": "off",
9
19
  "jsdoc/tag-lines": ["error", "any", { startLines: 1 }],
20
+ "no-unused-vars": ["error", {
21
+ argsIgnorePattern: "^_",
22
+ caughtErrorsIgnorePattern: "^_"
23
+ }]
10
24
  },
11
25
  },
12
26
  ];
@@ -49,7 +49,7 @@ import * as util from './utils/index.js';
49
49
  * @returns {unknown}
50
50
  * @private
51
51
  */
52
- export function Assertion (obj, msg, ssfi, lockSsfi) {
52
+ export function Assertion(obj, msg, ssfi, lockSsfi) {
53
53
  util.flag(this, 'ssfi', ssfi || Assertion);
54
54
  util.flag(this, 'lockSsfi', lockSsfi);
55
55
  util.flag(this, 'object', obj);
@@ -60,23 +60,31 @@ export function Assertion (obj, msg, ssfi, lockSsfi) {
60
60
  }
61
61
 
62
62
  Object.defineProperty(Assertion, 'includeStack', {
63
- get: function() {
64
- console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.');
63
+ get: function () {
64
+ console.warn(
65
+ 'Assertion.includeStack is deprecated, use chai.config.includeStack instead.'
66
+ );
65
67
  return config.includeStack;
66
68
  },
67
- set: function(value) {
68
- console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.');
69
+ set: function (value) {
70
+ console.warn(
71
+ 'Assertion.includeStack is deprecated, use chai.config.includeStack instead.'
72
+ );
69
73
  config.includeStack = value;
70
74
  }
71
75
  });
72
76
 
73
77
  Object.defineProperty(Assertion, 'showDiff', {
74
- get: function() {
75
- console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.');
78
+ get: function () {
79
+ console.warn(
80
+ 'Assertion.showDiff is deprecated, use chai.config.showDiff instead.'
81
+ );
76
82
  return config.showDiff;
77
83
  },
78
- set: function(value) {
79
- console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.');
84
+ set: function (value) {
85
+ console.warn(
86
+ 'Assertion.showDiff is deprecated, use chai.config.showDiff instead.'
87
+ );
80
88
  config.showDiff = value;
81
89
  }
82
90
  });
@@ -120,7 +128,14 @@ Assertion.overwriteChainableMethod = function (name, fn, chainingBehavior) {
120
128
  * @private
121
129
  */
122
130
 
123
- Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, showDiff) {
131
+ Assertion.prototype.assert = function (
132
+ expr,
133
+ msg,
134
+ negateMsg,
135
+ expected,
136
+ _actual,
137
+ showDiff
138
+ ) {
124
139
  var ok = util.test(this, arguments);
125
140
  if (false !== showDiff) showDiff = true;
126
141
  if (undefined === expected && undefined === _actual) showDiff = false;
@@ -130,9 +145,9 @@ Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual,
130
145
  msg = util.getMessage(this, arguments);
131
146
  var actual = util.getActual(this, arguments);
132
147
  var assertionErrorObjectProperties = {
133
- actual: actual
134
- , expected: expected
135
- , showDiff: showDiff
148
+ actual: actual,
149
+ expected: expected,
150
+ showDiff: showDiff
136
151
  };
137
152
 
138
153
  var operator = util.getOperator(this, arguments);
@@ -143,7 +158,8 @@ Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual,
143
158
  throw new AssertionError(
144
159
  msg,
145
160
  assertionErrorObjectProperties,
146
- (config.includeStack) ? this.assert : util.flag(this, 'ssfi'));
161
+ config.includeStack ? this.assert : util.flag(this, 'ssfi')
162
+ );
147
163
  }
148
164
  };
149
165
 
@@ -154,11 +170,11 @@ Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual,
154
170
  *
155
171
  * @private
156
172
  */
157
- Object.defineProperty(Assertion.prototype, '_obj',
158
- { get: function () {
159
- return util.flag(this, 'object');
160
- }
161
- , set: function (val) {
162
- util.flag(this, 'object', val);
163
- }
173
+ Object.defineProperty(Assertion.prototype, '_obj', {
174
+ get: function () {
175
+ return util.flag(this, 'object');
176
+ },
177
+ set: function (val) {
178
+ util.flag(this, 'object', val);
179
+ }
164
180
  });
@@ -1,5 +1,4 @@
1
1
  export const config = {
2
-
3
2
  /**
4
3
  * ### config.includeStack
5
4
  *
@@ -110,5 +109,4 @@ export const config = {
110
109
  * @public
111
110
  */
112
111
  deepEqual: null
113
-
114
112
  };