chai 6.2.0 → 6.2.2

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 (3) hide show
  1. package/README.md +2 -2
  2. package/index.js +26 -273
  3. package/package.json +9 -9
package/README.md CHANGED
@@ -60,10 +60,10 @@ Chai is an _assertion library_, similar to Node's built-in `assert`. It makes te
60
60
 
61
61
  ### Browsers
62
62
 
63
- You can also use it within the browser; install via npm and use the `chai.js` file found within the download. For example:
63
+ You can also use it within the browser; install via npm and use the `index.js` file found within the download. For example:
64
64
 
65
65
  ```html
66
- <script src="./node_modules/chai/chai.js"></script>
66
+ <script src="./node_modules/chai/index.js" type="module"></script>
67
67
  ```
68
68
 
69
69
  ## Usage
package/index.js CHANGED
@@ -1,9 +1,11 @@
1
1
  var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2
3
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
4
  var __export = (target, all) => {
4
5
  for (var name in all)
5
6
  __defProp(target, name, { get: all[name], enumerable: true });
6
7
  };
8
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
9
 
8
10
  // lib/chai/utils/index.js
9
11
  var utils_exports = {};
@@ -143,19 +145,10 @@ __name(type, "type");
143
145
 
144
146
  // node_modules/assertion-error/index.js
145
147
  var canElideFrames = "captureStackTrace" in Error;
146
- var AssertionError = class _AssertionError extends Error {
147
- static {
148
- __name(this, "AssertionError");
149
- }
150
- message;
151
- get name() {
152
- return "AssertionError";
153
- }
154
- get ok() {
155
- return false;
156
- }
148
+ var _AssertionError = class _AssertionError extends Error {
157
149
  constructor(message = "Unspecified AssertionError", props, ssf) {
158
150
  super(message);
151
+ __publicField(this, "message");
159
152
  this.message = message;
160
153
  if (canElideFrames) {
161
154
  Error.captureStackTrace(this, ssf || _AssertionError);
@@ -166,6 +159,12 @@ var AssertionError = class _AssertionError extends Error {
166
159
  }
167
160
  }
168
161
  }
162
+ get name() {
163
+ return "AssertionError";
164
+ }
165
+ get ok() {
166
+ return false;
167
+ }
169
168
  toJSON(stack) {
170
169
  return {
171
170
  ...this,
@@ -176,6 +175,8 @@ var AssertionError = class _AssertionError extends Error {
176
175
  };
177
176
  }
178
177
  };
178
+ __name(_AssertionError, "AssertionError");
179
+ var AssertionError = _AssertionError;
179
180
 
180
181
  // lib/chai/utils/expectTypes.js
181
182
  function expectTypes(obj, types) {
@@ -696,8 +697,8 @@ __name(inspectHTML, "inspectHTML");
696
697
 
697
698
  // node_modules/loupe/lib/index.js
698
699
  var symbolsSupported = typeof Symbol === "function" && typeof Symbol.for === "function";
699
- var chaiInspect = symbolsSupported ? Symbol.for("chai/inspect") : "@@chai/inspect";
700
- var nodeInspect = Symbol.for("nodejs.util.inspect.custom");
700
+ var chaiInspect = symbolsSupported ? /* @__PURE__ */ Symbol.for("chai/inspect") : "@@chai/inspect";
701
+ var nodeInspect = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
701
702
  var constructorMap = /* @__PURE__ */ new WeakMap();
702
703
  var stringTagMap = {};
703
704
  var baseTypesMap = {
@@ -1362,12 +1363,7 @@ function getPathInfo(obj, path) {
1362
1363
  __name(getPathInfo, "getPathInfo");
1363
1364
 
1364
1365
  // lib/chai/assertion.js
1365
- var Assertion = class _Assertion {
1366
- static {
1367
- __name(this, "Assertion");
1368
- }
1369
- /** @type {{}} */
1370
- __flags = {};
1366
+ var _Assertion = class _Assertion {
1371
1367
  /**
1372
1368
  * Creates object for chaining.
1373
1369
  * `Assertion` objects contain metadata in the form of flags. Three flags can
@@ -1404,6 +1400,8 @@ var Assertion = class _Assertion {
1404
1400
  * @param {boolean} [lockSsfi] (optional) whether or not the ssfi flag is locked
1405
1401
  */
1406
1402
  constructor(obj, msg, ssfi, lockSsfi) {
1403
+ /** @type {{}} */
1404
+ __publicField(this, "__flags", {});
1407
1405
  flag(this, "ssfi", ssfi || _Assertion);
1408
1406
  flag(this, "lockSsfi", lockSsfi);
1409
1407
  flag(this, "object", obj);
@@ -1539,19 +1537,20 @@ var Assertion = class _Assertion {
1539
1537
  flag(this, "object", val);
1540
1538
  }
1541
1539
  };
1540
+ __name(_Assertion, "Assertion");
1541
+ var Assertion = _Assertion;
1542
1542
 
1543
1543
  // lib/chai/utils/events.js
1544
1544
  var events = new EventTarget();
1545
- var PluginEvent = class extends Event {
1546
- static {
1547
- __name(this, "PluginEvent");
1548
- }
1545
+ var _PluginEvent = class _PluginEvent extends Event {
1549
1546
  constructor(type3, name, fn) {
1550
1547
  super(type3);
1551
1548
  this.name = String(name);
1552
1549
  this.fn = fn;
1553
1550
  }
1554
1551
  };
1552
+ __name(_PluginEvent, "PluginEvent");
1553
+ var PluginEvent = _PluginEvent;
1555
1554
 
1556
1555
  // lib/chai/utils/isProxyEnabled.js
1557
1556
  function isProxyEnabled() {
@@ -1773,15 +1772,14 @@ var excludeNames = Object.getOwnPropertyNames(testFn).filter(function(name) {
1773
1772
  });
1774
1773
  var call = Function.prototype.call;
1775
1774
  var apply = Function.prototype.apply;
1776
- var PluginAddChainableMethodEvent = class extends PluginEvent {
1777
- static {
1778
- __name(this, "PluginAddChainableMethodEvent");
1779
- }
1775
+ var _PluginAddChainableMethodEvent = class _PluginAddChainableMethodEvent extends PluginEvent {
1780
1776
  constructor(type3, name, fn, chainingBehavior) {
1781
1777
  super(type3, name, fn);
1782
1778
  this.chainingBehavior = chainingBehavior;
1783
1779
  }
1784
1780
  };
1781
+ __name(_PluginAddChainableMethodEvent, "PluginAddChainableMethodEvent");
1782
+ var PluginAddChainableMethodEvent = _PluginAddChainableMethodEvent;
1785
1783
  function addChainableMethod(ctx, name, method, chainingBehavior) {
1786
1784
  if (typeof chainingBehavior !== "function") {
1787
1785
  chainingBehavior = /* @__PURE__ */ __name(function() {
@@ -2960,7 +2958,7 @@ function closeTo(expected, delta, msg) {
2960
2958
  );
2961
2959
  }
2962
2960
  new Assertion(expected, flagMsg, ssfi, true).is.numeric;
2963
- const abs = /* @__PURE__ */ __name((x) => x < 0n ? -x : x, "abs");
2961
+ const abs = /* @__PURE__ */ __name((x) => x < 0 ? -x : x, "abs");
2964
2962
  const strip = /* @__PURE__ */ __name((number) => parseFloat(parseFloat(number).toPrecision(12)), "strip");
2965
2963
  this.assert(
2966
2964
  strip(abs(obj - expected)) <= delta,
@@ -4172,248 +4170,3 @@ export {
4172
4170
  use,
4173
4171
  utils_exports as util
4174
4172
  };
4175
- /*!
4176
- * Chai - flag utility
4177
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4178
- * MIT Licensed
4179
- */
4180
- /*!
4181
- * Chai - test utility
4182
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4183
- * MIT Licensed
4184
- */
4185
- /*!
4186
- * Chai - expectTypes utility
4187
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4188
- * MIT Licensed
4189
- */
4190
- /*!
4191
- * Chai - getActual utility
4192
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4193
- * MIT Licensed
4194
- */
4195
- /*!
4196
- * Chai - message composition utility
4197
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4198
- * MIT Licensed
4199
- */
4200
- /*!
4201
- * Chai - transferFlags utility
4202
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4203
- * MIT Licensed
4204
- */
4205
- /*!
4206
- * chai
4207
- * http://chaijs.com
4208
- * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
4209
- * MIT Licensed
4210
- */
4211
- /*!
4212
- * Chai - events utility
4213
- * Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
4214
- * MIT Licensed
4215
- */
4216
- /*!
4217
- * Chai - isProxyEnabled helper
4218
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4219
- * MIT Licensed
4220
- */
4221
- /*!
4222
- * Chai - addProperty utility
4223
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4224
- * MIT Licensed
4225
- */
4226
- /*!
4227
- * Chai - addLengthGuard utility
4228
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4229
- * MIT Licensed
4230
- */
4231
- /*!
4232
- * Chai - getProperties utility
4233
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4234
- * MIT Licensed
4235
- */
4236
- /*!
4237
- * Chai - proxify utility
4238
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4239
- * MIT Licensed
4240
- */
4241
- /*!
4242
- * Chai - addMethod utility
4243
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4244
- * MIT Licensed
4245
- */
4246
- /*!
4247
- * Chai - overwriteProperty utility
4248
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4249
- * MIT Licensed
4250
- */
4251
- /*!
4252
- * Chai - overwriteMethod utility
4253
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4254
- * MIT Licensed
4255
- */
4256
- /*!
4257
- * Chai - addChainingMethod utility
4258
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4259
- * MIT Licensed
4260
- */
4261
- /*!
4262
- * Chai - overwriteChainableMethod utility
4263
- * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
4264
- * MIT Licensed
4265
- */
4266
- /*!
4267
- * Chai - compareByInspect utility
4268
- * Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
4269
- * MIT Licensed
4270
- */
4271
- /*!
4272
- * Chai - getOwnEnumerablePropertySymbols utility
4273
- * Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
4274
- * MIT Licensed
4275
- */
4276
- /*!
4277
- * Chai - getOwnEnumerableProperties utility
4278
- * Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
4279
- * MIT Licensed
4280
- */
4281
- /*!
4282
- * Chai - isNaN utility
4283
- * Copyright(c) 2012-2015 Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
4284
- * MIT Licensed
4285
- */
4286
- /*!
4287
- * chai
4288
- * Copyright(c) 2011 Jake Luer <jake@alogicalparadox.com>
4289
- * MIT Licensed
4290
- */
4291
- /*!
4292
- * chai
4293
- * Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
4294
- * MIT Licensed
4295
- */
4296
- /*! Bundled license information:
4297
-
4298
- deep-eql/index.js:
4299
- (*!
4300
- * deep-eql
4301
- * Copyright(c) 2013 Jake Luer <jake@alogicalparadox.com>
4302
- * MIT Licensed
4303
- *)
4304
- (*!
4305
- * Check to see if the MemoizeMap has recorded a result of the two operands
4306
- *
4307
- * @param {Mixed} leftHandOperand
4308
- * @param {Mixed} rightHandOperand
4309
- * @param {MemoizeMap} memoizeMap
4310
- * @returns {Boolean|null} result
4311
- *)
4312
- (*!
4313
- * Set the result of the equality into the MemoizeMap
4314
- *
4315
- * @param {Mixed} leftHandOperand
4316
- * @param {Mixed} rightHandOperand
4317
- * @param {MemoizeMap} memoizeMap
4318
- * @param {Boolean} result
4319
- *)
4320
- (*!
4321
- * Primary Export
4322
- *)
4323
- (*!
4324
- * The main logic of the `deepEqual` function.
4325
- *
4326
- * @param {Mixed} leftHandOperand
4327
- * @param {Mixed} rightHandOperand
4328
- * @param {Object} [options] (optional) Additional options
4329
- * @param {Array} [options.comparator] (optional) Override default algorithm, determining custom equality.
4330
- * @param {Array} [options.memoize] (optional) Provide a custom memoization object which will cache the results of
4331
- complex objects for a speed boost. By passing `false` you can disable memoization, but this will cause circular
4332
- references to blow the stack.
4333
- * @return {Boolean} equal match
4334
- *)
4335
- (*!
4336
- * Compare two Regular Expressions for equality.
4337
- *
4338
- * @param {RegExp} leftHandOperand
4339
- * @param {RegExp} rightHandOperand
4340
- * @return {Boolean} result
4341
- *)
4342
- (*!
4343
- * Compare two Sets/Maps for equality. Faster than other equality functions.
4344
- *
4345
- * @param {Set} leftHandOperand
4346
- * @param {Set} rightHandOperand
4347
- * @param {Object} [options] (Optional)
4348
- * @return {Boolean} result
4349
- *)
4350
- (*!
4351
- * Simple equality for flat iterable objects such as Arrays, TypedArrays or Node.js buffers.
4352
- *
4353
- * @param {Iterable} leftHandOperand
4354
- * @param {Iterable} rightHandOperand
4355
- * @param {Object} [options] (Optional)
4356
- * @return {Boolean} result
4357
- *)
4358
- (*!
4359
- * Simple equality for generator objects such as those returned by generator functions.
4360
- *
4361
- * @param {Iterable} leftHandOperand
4362
- * @param {Iterable} rightHandOperand
4363
- * @param {Object} [options] (Optional)
4364
- * @return {Boolean} result
4365
- *)
4366
- (*!
4367
- * Determine if the given object has an @@iterator function.
4368
- *
4369
- * @param {Object} target
4370
- * @return {Boolean} `true` if the object has an @@iterator function.
4371
- *)
4372
- (*!
4373
- * Gets all iterator entries from the given Object. If the Object has no @@iterator function, returns an empty array.
4374
- * This will consume the iterator - which could have side effects depending on the @@iterator implementation.
4375
- *
4376
- * @param {Object} target
4377
- * @returns {Array} an array of entries from the @@iterator function
4378
- *)
4379
- (*!
4380
- * Gets all entries from a Generator. This will consume the generator - which could have side effects.
4381
- *
4382
- * @param {Generator} target
4383
- * @returns {Array} an array of entries from the Generator.
4384
- *)
4385
- (*!
4386
- * Gets all own and inherited enumerable keys from a target.
4387
- *
4388
- * @param {Object} target
4389
- * @returns {Array} an array of own and inherited enumerable keys from the target.
4390
- *)
4391
- (*!
4392
- * Determines if two objects have matching values, given a set of keys. Defers to deepEqual for the equality check of
4393
- * each key. If any value of the given key is not equal, the function will return false (early).
4394
- *
4395
- * @param {Mixed} leftHandOperand
4396
- * @param {Mixed} rightHandOperand
4397
- * @param {Array} keys An array of keys to compare the values of leftHandOperand and rightHandOperand against
4398
- * @param {Object} [options] (Optional)
4399
- * @return {Boolean} result
4400
- *)
4401
- (*!
4402
- * Recursively check the equality of two Objects. Once basic sameness has been established it will defer to `deepEqual`
4403
- * for each enumerable key in the object.
4404
- *
4405
- * @param {Mixed} leftHandOperand
4406
- * @param {Mixed} rightHandOperand
4407
- * @param {Object} [options] (Optional)
4408
- * @return {Boolean} result
4409
- *)
4410
- (*!
4411
- * Returns true if the argument is a primitive.
4412
- *
4413
- * This intentionally returns true for all objects that can be compared by reference,
4414
- * including functions and symbols.
4415
- *
4416
- * @param {Mixed} value
4417
- * @return {Boolean} result
4418
- *)
4419
- */
package/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "Veselin Todorov <hi@vesln.com>",
23
23
  "John Firebaugh <john.firebaugh@gmail.com>"
24
24
  ],
25
- "version": "6.2.0",
25
+ "version": "6.2.2",
26
26
  "repository": {
27
27
  "type": "git",
28
28
  "url": "https://github.com/chaijs/chai"
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "main": "./index.js",
34
34
  "scripts": {
35
- "build": "esbuild --bundle --format=esm --keep-names --outfile=index.js lib/chai.js",
35
+ "build": "esbuild --bundle --format=esm --target=es2021 --keep-names --legal-comments=none --outfile=index.js lib/chai.js",
36
36
  "prebuild": "npm run clean",
37
37
  "format": "prettier --write lib",
38
38
  "pretest": "npm run lint",
@@ -50,22 +50,22 @@
50
50
  },
51
51
  "devDependencies": {
52
52
  "@eslint/js": "^9.17.0",
53
- "@rollup/plugin-commonjs": "^25.0.7",
53
+ "@rollup/plugin-commonjs": "^29.0.0",
54
54
  "@web/dev-server-rollup": "^0.6.1",
55
- "@web/test-runner": "^0.18.0",
55
+ "@web/test-runner": "^0.20.0",
56
56
  "@web/test-runner-playwright": "^0.11.0",
57
57
  "assertion-error": "^2.0.1",
58
58
  "c8": "^10.1.3",
59
59
  "check-error": "^2.1.1",
60
60
  "deep-eql": "^5.0.1",
61
- "esbuild": "^0.25.9",
62
- "eslint": "^8.56.0",
63
- "eslint-plugin-jsdoc": "^48.0.4",
61
+ "esbuild": "^0.27.0",
62
+ "eslint": "^9.0.0",
63
+ "eslint-plugin-jsdoc": "^61.0.0",
64
64
  "globals": "^16.3.0",
65
65
  "loupe": "^3.1.0",
66
- "mocha": "^10.2.0",
66
+ "mocha": "^11.0.0",
67
67
  "pathval": "^2.0.0",
68
68
  "prettier": "^3.4.2",
69
- "typescript": "~5.7.3"
69
+ "typescript": "~5.9.0"
70
70
  }
71
71
  }