chai 4.3.10 → 5.1.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 (51) hide show
  1. package/CONTRIBUTING.md +7 -1
  2. package/README.md +13 -71
  3. package/chai.js +3616 -11088
  4. package/eslint.config.js +12 -0
  5. package/index.js +1 -1
  6. package/lib/chai/assertion.js +152 -163
  7. package/lib/chai/config.js +35 -15
  8. package/lib/chai/core/assertions.js +3737 -3656
  9. package/lib/chai/interface/assert.js +2984 -3046
  10. package/lib/chai/interface/expect.js +45 -37
  11. package/lib/chai/interface/should.js +203 -201
  12. package/lib/chai/utils/addChainableMethod.js +14 -19
  13. package/lib/chai/utils/addLengthGuard.js +6 -6
  14. package/lib/chai/utils/addMethod.js +13 -14
  15. package/lib/chai/utils/addProperty.js +12 -13
  16. package/lib/chai/utils/compareByInspect.js +7 -12
  17. package/lib/chai/utils/expectTypes.js +9 -10
  18. package/lib/chai/utils/flag.js +7 -7
  19. package/lib/chai/utils/getActual.js +5 -5
  20. package/lib/chai/utils/getEnumerableProperties.js +2 -3
  21. package/lib/chai/utils/getMessage.js +9 -13
  22. package/lib/chai/utils/getOperator.js +13 -10
  23. package/lib/chai/utils/getOwnEnumerableProperties.js +5 -10
  24. package/lib/chai/utils/getOwnEnumerablePropertySymbols.js +4 -5
  25. package/lib/chai/utils/getProperties.js +7 -5
  26. package/lib/chai/utils/index.js +74 -140
  27. package/lib/chai/utils/inspect.js +9 -11
  28. package/lib/chai/utils/isNaN.js +5 -5
  29. package/lib/chai/utils/isProxyEnabled.js +4 -4
  30. package/lib/chai/utils/objDisplay.js +6 -11
  31. package/lib/chai/utils/overwriteChainableMethod.js +13 -14
  32. package/lib/chai/utils/overwriteMethod.js +18 -19
  33. package/lib/chai/utils/overwriteProperty.js +17 -19
  34. package/lib/chai/utils/proxify.js +15 -15
  35. package/lib/chai/utils/test.js +6 -10
  36. package/lib/chai/utils/transferFlags.js +6 -8
  37. package/lib/chai/utils/type-detect.js +20 -0
  38. package/lib/chai.js +35 -62
  39. package/package.json +25 -27
  40. package/register-assert.cjs +3 -0
  41. package/register-assert.js +3 -1
  42. package/register-expect.cjs +3 -0
  43. package/register-expect.js +3 -1
  44. package/register-should.cjs +3 -0
  45. package/register-should.js +3 -1
  46. package/web-test-runner.config.js +20 -0
  47. package/bower.json +0 -26
  48. package/index.mjs +0 -14
  49. package/karma.conf.js +0 -34
  50. package/karma.sauce.js +0 -41
  51. package/sauce.browsers.js +0 -106
@@ -0,0 +1,3 @@
1
+ const {should} = require('./chai.cjs');
2
+
3
+ globalThis.should = should();
@@ -1 +1,3 @@
1
- global.should = require('./').should();
1
+ import {should} from './index.js';
2
+
3
+ globalThis.should = should();
@@ -0,0 +1,20 @@
1
+ import { fromRollup } from "@web/dev-server-rollup";
2
+ import rollupCommonjs from "@rollup/plugin-commonjs";
3
+
4
+ const commonjs = fromRollup(rollupCommonjs);
5
+
6
+ export default {
7
+ nodeResolve: true,
8
+ files: [
9
+ "test/*.js",
10
+ "!test/virtual-machines.js"
11
+ ],
12
+ plugins: [
13
+ commonjs({
14
+ include: [
15
+ // the commonjs plugin is slow, list the required packages explicitly:
16
+ "**/node_modules/type-detect/**/*",
17
+ ],
18
+ }),
19
+ ],
20
+ };
package/bower.json DELETED
@@ -1,26 +0,0 @@
1
- {
2
- "name": "chai",
3
- "description": "BDD/TDD assertion library for node.js and the browser. Test framework agnostic.",
4
- "license": "MIT",
5
- "keywords": [
6
- "test",
7
- "assertion",
8
- "assert",
9
- "testing",
10
- "chai"
11
- ],
12
- "main": "chai.js",
13
- "ignore": [
14
- "build",
15
- "components",
16
- "lib",
17
- "node_modules",
18
- "support",
19
- "test",
20
- "index.js",
21
- "Makefile",
22
- ".*"
23
- ],
24
- "dependencies": {},
25
- "devDependencies": {}
26
- }
package/index.mjs DELETED
@@ -1,14 +0,0 @@
1
- import chai from './index.js';
2
-
3
- export const expect = chai.expect;
4
- export const version = chai.version;
5
- export const Assertion = chai.Assertion;
6
- export const AssertionError = chai.AssertionError;
7
- export const util = chai.util;
8
- export const config = chai.config;
9
- export const use = chai.use;
10
- export const should = chai.should;
11
- export const assert = chai.assert;
12
- export const core = chai.core;
13
-
14
- export default chai;
package/karma.conf.js DELETED
@@ -1,34 +0,0 @@
1
- module.exports = function(config) {
2
- config.set({
3
- frameworks: [ 'mocha' ]
4
- , files: [
5
- 'chai.js'
6
- , 'test/bootstrap/index.js'
7
- , 'test/*.js'
8
- ]
9
- , reporters: [ 'progress' ]
10
- , colors: true
11
- , logLevel: config.LOG_INFO
12
- , autoWatch: false
13
- , browsers: [ 'HeadlessChrome' ]
14
- , customLaunchers: {
15
- HeadlessChrome: {
16
- base: 'ChromeHeadless'
17
- , flags: [ '--no-sandbox',]
18
- , }
19
- , }
20
- , browserDisconnectTimeout: 10000
21
- , browserDisconnectTolerance: 2
22
- , browserNoActivityTimeout: 20000
23
- , singleRun: true
24
- });
25
-
26
- switch (process.env.CHAI_TEST_ENV) {
27
- case 'sauce':
28
- require('./karma.sauce')(config);
29
- break;
30
- default:
31
- // ...
32
- break;
33
- };
34
- };
package/karma.sauce.js DELETED
@@ -1,41 +0,0 @@
1
- var version = require('./package.json').version;
2
- var ts = new Date().getTime();
3
-
4
- module.exports = function(config) {
5
- var auth;
6
-
7
- try {
8
- auth = require('./test/auth/index');
9
- } catch(ex) {
10
- auth = {};
11
- auth.SAUCE_USERNAME = process.env.SAUCE_USERNAME || null;
12
- auth.SAUCE_ACCESS_KEY = process.env.SAUCE_ACCESS_KEY || null;
13
- }
14
-
15
- if (!auth.SAUCE_USERNAME || !auth.SAUCE_ACCESS_KEY) return;
16
- if (process.env.SKIP_SAUCE) return;
17
-
18
- var branch = process.env.TRAVIS_BRANCH || 'local'
19
- var browserConfig = require('./sauce.browsers');
20
- var browsers = Object.keys(browserConfig);
21
- var tags = [ 'chaijs_' + version, auth.SAUCE_USERNAME + '@' + branch ];
22
- var tunnel = process.env.TRAVIS_JOB_NUMBER || ts;
23
-
24
- if (process.env.TRAVIS_JOB_NUMBER) {
25
- tags.push('travis@' + process.env.TRAVIS_JOB_NUMBER);
26
- }
27
-
28
- config.browsers = config.browsers.concat(browsers);
29
- Object.assign(config.customLaunchers, browserConfig);
30
- config.reporters.push('saucelabs');
31
- config.captureTimeout = 300000;
32
-
33
- config.sauceLabs = {
34
- username: auth.SAUCE_USERNAME
35
- , accessKey: auth.SAUCE_ACCESS_KEY
36
- , startConnect: ('TRAVIS' in process.env) === false
37
- , tags: tags
38
- , testName: 'ChaiJS'
39
- , tunnelIdentifier: tunnel
40
- };
41
- };
package/sauce.browsers.js DELETED
@@ -1,106 +0,0 @@
1
-
2
- /*!
3
- * Chrome
4
- */
5
-
6
- exports['SL_Chrome'] = {
7
- base: 'SauceLabs'
8
- , browserName: 'chrome'
9
- };
10
-
11
- /*!
12
- * Firefox
13
- */
14
-
15
- exports['SL_Firefox'] = {
16
- base: 'SauceLabs'
17
- , browserName: 'firefox'
18
- };
19
-
20
- exports['SL_Firefox_ESR'] = {
21
- base: 'SauceLabs'
22
- , browserName: 'firefox'
23
- , version: 38
24
- };
25
-
26
- /*!
27
- * Internet Explorer
28
- */
29
-
30
- exports['SL_IE'] = {
31
- base: 'SauceLabs'
32
- , browserName: 'internet explorer'
33
- };
34
-
35
- /*!
36
- * TODO: fails because of Uint8Array support
37
- *
38
- exports['SL_IE_Old'] = {
39
- base: 'SauceLabs'
40
- , browserName: 'internet explorer'
41
- , version: 10
42
- };
43
- */
44
-
45
- exports['SL_Edge'] = {
46
- base: 'SauceLabs'
47
- , browserName: 'microsoftedge'
48
- };
49
-
50
- /*!
51
- * Safari
52
- */
53
-
54
- exports['SL_Safari'] = {
55
- base: 'SauceLabs'
56
- , browserName: 'safari'
57
- , platform: 'Mac 10.11'
58
- };
59
-
60
- /*!
61
- * iPhone
62
- */
63
-
64
- /*!
65
- * TODO: These take forever to boot or shut down. Causes timeout.
66
- *
67
-
68
- exports['SL_iPhone_6'] = {
69
- base: 'SauceLabs'
70
- , browserName: 'iphone'
71
- , platform: 'Mac 10.8'
72
- , version: '6'
73
- };
74
-
75
- exports['SL_iPhone_5-1'] = {
76
- base: 'SauceLabs'
77
- , browserName: 'iphone'
78
- , platform: 'Mac 10.8'
79
- , version: '5.1'
80
- };
81
-
82
- exports['SL_iPhone_5'] = {
83
- base: 'SauceLabs'
84
- , browserName: 'iphone'
85
- , platform: 'Mac 10.6'
86
- , version: '5'
87
- };
88
-
89
- */
90
-
91
- /*!
92
- * Android
93
- */
94
-
95
- /*!
96
- * TODO: fails because of error serialization
97
- *
98
-
99
- exports['SL_Android_4'] = {
100
- base: 'SauceLabs'
101
- , browserName: 'android'
102
- , platform: 'Linux'
103
- , version: '4'
104
- };
105
-
106
- */