chai 4.3.10 → 5.0.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/CONTRIBUTING.md +7 -1
- package/README.md +3 -43
- package/chai.js +3802 -11206
- package/index.js +1 -1
- package/{karma.conf.js → karma.conf.cjs} +4 -3
- package/lib/chai/assertion.js +153 -163
- package/lib/chai/config.js +28 -2
- package/lib/chai/core/assertions.js +3631 -3634
- package/lib/chai/interface/assert.js +3036 -3042
- package/lib/chai/interface/expect.js +40 -37
- package/lib/chai/interface/should.js +203 -204
- package/lib/chai/utils/addChainableMethod.js +8 -8
- package/lib/chai/utils/addLengthGuard.js +3 -3
- package/lib/chai/utils/addMethod.js +8 -8
- package/lib/chai/utils/addProperty.js +7 -7
- package/lib/chai/utils/compareByInspect.js +3 -3
- package/lib/chai/utils/expectTypes.js +5 -5
- package/lib/chai/utils/flag.js +2 -2
- package/lib/chai/utils/getActual.js +2 -2
- package/lib/chai/utils/getMessage.js +5 -5
- package/lib/chai/utils/getOperator.js +5 -6
- package/lib/chai/utils/getOwnEnumerableProperties.js +3 -3
- package/lib/chai/utils/getOwnEnumerablePropertySymbols.js +2 -2
- package/lib/chai/utils/getProperties.js +2 -2
- package/lib/chai/utils/index.js +30 -34
- package/lib/chai/utils/inspect.js +4 -7
- package/lib/chai/utils/isNaN.js +2 -2
- package/lib/chai/utils/isProxyEnabled.js +3 -3
- package/lib/chai/utils/objDisplay.js +4 -4
- package/lib/chai/utils/overwriteChainableMethod.js +6 -6
- package/lib/chai/utils/overwriteMethod.js +8 -8
- package/lib/chai/utils/overwriteProperty.js +7 -7
- package/lib/chai/utils/proxify.js +7 -7
- package/lib/chai/utils/test.js +3 -3
- package/lib/chai/utils/transferFlags.js +2 -2
- package/lib/chai/utils/type-detect.js +16 -0
- package/lib/chai.js +27 -32
- package/package.json +24 -28
- package/register-assert.cjs +3 -0
- package/register-assert.js +3 -1
- package/register-expect.cjs +3 -0
- package/register-expect.js +3 -1
- package/register-should.cjs +3 -0
- package/register-should.js +3 -1
- package/web-test-runner.config.js +17 -0
- package/index.mjs +0 -14
package/lib/chai.js
CHANGED
|
@@ -4,25 +4,22 @@
|
|
|
4
4
|
* MIT Licensed
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
import * as util from './chai/utils/index.js';
|
|
8
|
+
import {AssertionError} from 'assertion-error';
|
|
9
|
+
import {config} from './chai/config.js';
|
|
10
|
+
import './chai/core/assertions.js';
|
|
11
|
+
import {expect} from './chai/interface/expect.js';
|
|
12
|
+
import {Assertion} from './chai/assertion.js';
|
|
13
|
+
import * as should from './chai/interface/should.js';
|
|
14
|
+
import {assert} from './chai/interface/assert.js';
|
|
8
15
|
|
|
9
|
-
|
|
10
|
-
* Chai version
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
exports.version = '4.3.8';
|
|
16
|
+
const used = [];
|
|
14
17
|
|
|
15
18
|
/*!
|
|
16
19
|
* Assertion Error
|
|
17
20
|
*/
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/*!
|
|
22
|
-
* Utils for plugins (not exported)
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
var util = require('./chai/utils');
|
|
22
|
+
export {AssertionError};
|
|
26
23
|
|
|
27
24
|
/**
|
|
28
25
|
* # .use(function)
|
|
@@ -34,7 +31,17 @@ var util = require('./chai/utils');
|
|
|
34
31
|
* @api public
|
|
35
32
|
*/
|
|
36
33
|
|
|
37
|
-
|
|
34
|
+
export function use(fn) {
|
|
35
|
+
const exports = {
|
|
36
|
+
AssertionError,
|
|
37
|
+
util,
|
|
38
|
+
config,
|
|
39
|
+
expect,
|
|
40
|
+
assert,
|
|
41
|
+
Assertion,
|
|
42
|
+
...should
|
|
43
|
+
};
|
|
44
|
+
|
|
38
45
|
if (!~used.indexOf(fn)) {
|
|
39
46
|
fn(exports, util);
|
|
40
47
|
used.push(fn);
|
|
@@ -47,46 +54,34 @@ exports.use = function (fn) {
|
|
|
47
54
|
* Utility Functions
|
|
48
55
|
*/
|
|
49
56
|
|
|
50
|
-
|
|
57
|
+
export {util};
|
|
51
58
|
|
|
52
59
|
/*!
|
|
53
60
|
* Configuration
|
|
54
61
|
*/
|
|
55
62
|
|
|
56
|
-
|
|
57
|
-
exports.config = config;
|
|
63
|
+
export {config};
|
|
58
64
|
|
|
59
65
|
/*!
|
|
60
66
|
* Primary `Assertion` prototype
|
|
61
67
|
*/
|
|
62
68
|
|
|
63
|
-
|
|
64
|
-
exports.use(assertion);
|
|
65
|
-
|
|
66
|
-
/*!
|
|
67
|
-
* Core Assertions
|
|
68
|
-
*/
|
|
69
|
-
|
|
70
|
-
var core = require('./chai/core/assertions');
|
|
71
|
-
exports.use(core);
|
|
69
|
+
export * from './chai/assertion.js';
|
|
72
70
|
|
|
73
71
|
/*!
|
|
74
72
|
* Expect interface
|
|
75
73
|
*/
|
|
76
74
|
|
|
77
|
-
|
|
78
|
-
exports.use(expect);
|
|
75
|
+
export * from './chai/interface/expect.js';
|
|
79
76
|
|
|
80
77
|
/*!
|
|
81
78
|
* Should interface
|
|
82
79
|
*/
|
|
83
80
|
|
|
84
|
-
|
|
85
|
-
exports.use(should);
|
|
81
|
+
export * from './chai/interface/should.js';
|
|
86
82
|
|
|
87
83
|
/*!
|
|
88
84
|
* Assert interface
|
|
89
85
|
*/
|
|
90
86
|
|
|
91
|
-
|
|
92
|
-
exports.use(assert);
|
|
87
|
+
export * from './chai/interface/assert.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Jake Luer <jake@alogicalparadox.com>",
|
|
3
3
|
"name": "chai",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"description": "BDD/TDD assertion library for node.js and the browser. Test framework agnostic.",
|
|
5
6
|
"keywords": [
|
|
6
7
|
"test",
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
"Veselin Todorov <hi@vesln.com>",
|
|
18
19
|
"John Firebaugh <john.firebaugh@gmail.com>"
|
|
19
20
|
],
|
|
20
|
-
"version": "
|
|
21
|
+
"version": "5.0.0",
|
|
21
22
|
"repository": {
|
|
22
23
|
"type": "git",
|
|
23
24
|
"url": "https://github.com/chaijs/chai"
|
|
@@ -25,39 +26,34 @@
|
|
|
25
26
|
"bugs": {
|
|
26
27
|
"url": "https://github.com/chaijs/chai/issues"
|
|
27
28
|
},
|
|
28
|
-
"main": "./
|
|
29
|
-
"exports": {
|
|
30
|
-
".": {
|
|
31
|
-
"require": "./index.js",
|
|
32
|
-
"import": "./index.mjs"
|
|
33
|
-
},
|
|
34
|
-
"./*": "./*"
|
|
35
|
-
},
|
|
29
|
+
"main": "./chai.js",
|
|
36
30
|
"scripts": {
|
|
37
|
-
"
|
|
31
|
+
"prebuild": "npm run clean",
|
|
32
|
+
"build": "npm run build:esm",
|
|
33
|
+
"build:esm": "esbuild --bundle --format=esm --keep-names --outfile=chai.js index.js",
|
|
34
|
+
"pretest": "npm run build",
|
|
35
|
+
"test": "npm run test-node && npm run test-chrome",
|
|
36
|
+
"test-node": "mocha --require ./test/bootstrap/index.js --reporter dot test/*.js",
|
|
37
|
+
"test-chrome": "web-test-runner --playwright",
|
|
38
|
+
"clean": "rm -f chai.js coverage"
|
|
38
39
|
},
|
|
39
40
|
"engines": {
|
|
40
|
-
"node": ">=
|
|
41
|
+
"node": ">=12"
|
|
41
42
|
},
|
|
42
43
|
"dependencies": {
|
|
43
|
-
"assertion-error": "^
|
|
44
|
-
"check-error": "^
|
|
45
|
-
"deep-eql": "^
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"pathval": "^1.1.1",
|
|
49
|
-
"type-detect": "^4.0.8"
|
|
44
|
+
"assertion-error": "^2.0.1",
|
|
45
|
+
"check-error": "^2.0.0",
|
|
46
|
+
"deep-eql": "^5.0.1",
|
|
47
|
+
"loupe": "^3.0.0",
|
|
48
|
+
"pathval": "^2.0.0"
|
|
50
49
|
},
|
|
51
50
|
"devDependencies": {
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"karma-mocha": "^2.0.1",
|
|
60
|
-
"karma-sauce-launcher": "^4.1.4",
|
|
61
|
-
"mocha": "^10.2.0"
|
|
51
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
52
|
+
"@web/dev-server-rollup": "^0.5.4",
|
|
53
|
+
"@web/test-runner": "^0.17.2",
|
|
54
|
+
"@web/test-runner-playwright": "^0.10.2",
|
|
55
|
+
"bump-cli": "^1.1.3",
|
|
56
|
+
"esbuild": "^0.17.3",
|
|
57
|
+
"mocha": "^8.3.0"
|
|
62
58
|
}
|
|
63
59
|
}
|
package/register-assert.js
CHANGED
package/register-expect.js
CHANGED
package/register-should.js
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
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: ["test/*.js"],
|
|
9
|
+
plugins: [
|
|
10
|
+
commonjs({
|
|
11
|
+
include: [
|
|
12
|
+
// the commonjs plugin is slow, list the required packages explicitly:
|
|
13
|
+
"**/node_modules/type-detect/**/*",
|
|
14
|
+
],
|
|
15
|
+
}),
|
|
16
|
+
],
|
|
17
|
+
};
|
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;
|