@plugjs/expect5 0.4.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/README.md +7 -0
- package/dist/cli.d.mts +2 -0
- package/dist/cli.mjs +96 -0
- package/dist/cli.mjs.map +6 -0
- package/dist/execution/executable.cjs +299 -0
- package/dist/execution/executable.cjs.map +6 -0
- package/dist/execution/executable.d.ts +87 -0
- package/dist/execution/executable.mjs +260 -0
- package/dist/execution/executable.mjs.map +6 -0
- package/dist/execution/executor.cjs +125 -0
- package/dist/execution/executor.cjs.map +6 -0
- package/dist/execution/executor.d.ts +35 -0
- package/dist/execution/executor.mjs +90 -0
- package/dist/execution/executor.mjs.map +6 -0
- package/dist/execution/setup.cjs +127 -0
- package/dist/execution/setup.cjs.map +6 -0
- package/dist/execution/setup.d.ts +31 -0
- package/dist/execution/setup.mjs +87 -0
- package/dist/execution/setup.mjs.map +6 -0
- package/dist/expectation/basic.cjs +216 -0
- package/dist/expectation/basic.cjs.map +6 -0
- package/dist/expectation/basic.d.ts +47 -0
- package/dist/expectation/basic.mjs +177 -0
- package/dist/expectation/basic.mjs.map +6 -0
- package/dist/expectation/diff.cjs +253 -0
- package/dist/expectation/diff.cjs.map +6 -0
- package/dist/expectation/diff.d.ts +27 -0
- package/dist/expectation/diff.mjs +228 -0
- package/dist/expectation/diff.mjs.map +6 -0
- package/dist/expectation/expect.cjs +211 -0
- package/dist/expectation/expect.cjs.map +6 -0
- package/dist/expectation/expect.d.ts +140 -0
- package/dist/expectation/expect.mjs +219 -0
- package/dist/expectation/expect.mjs.map +6 -0
- package/dist/expectation/include.cjs +187 -0
- package/dist/expectation/include.cjs.map +6 -0
- package/dist/expectation/include.d.ts +10 -0
- package/dist/expectation/include.mjs +158 -0
- package/dist/expectation/include.mjs.map +6 -0
- package/dist/expectation/print.cjs +281 -0
- package/dist/expectation/print.cjs.map +6 -0
- package/dist/expectation/print.d.ts +4 -0
- package/dist/expectation/print.mjs +256 -0
- package/dist/expectation/print.mjs.map +6 -0
- package/dist/expectation/throwing.cjs +58 -0
- package/dist/expectation/throwing.cjs.map +6 -0
- package/dist/expectation/throwing.d.ts +8 -0
- package/dist/expectation/throwing.mjs +32 -0
- package/dist/expectation/throwing.mjs.map +6 -0
- package/dist/expectation/types.cjs +212 -0
- package/dist/expectation/types.cjs.map +6 -0
- package/dist/expectation/types.d.ts +57 -0
- package/dist/expectation/types.mjs +178 -0
- package/dist/expectation/types.mjs.map +6 -0
- package/dist/expectation/void.cjs +111 -0
- package/dist/expectation/void.cjs.map +6 -0
- package/dist/expectation/void.d.ts +39 -0
- package/dist/expectation/void.mjs +77 -0
- package/dist/expectation/void.mjs.map +6 -0
- package/dist/globals.cjs +2 -0
- package/dist/globals.cjs.map +6 -0
- package/dist/globals.d.ts +23 -0
- package/dist/globals.mjs +1 -0
- package/dist/globals.mjs.map +6 -0
- package/dist/index.cjs +66 -0
- package/dist/index.cjs.map +6 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.mjs +41 -0
- package/dist/index.mjs.map +6 -0
- package/dist/test.cjs +229 -0
- package/dist/test.cjs.map +6 -0
- package/dist/test.d.ts +9 -0
- package/dist/test.mjs +194 -0
- package/dist/test.mjs.map +6 -0
- package/package.json +57 -0
- package/src/cli.mts +122 -0
- package/src/execution/executable.ts +364 -0
- package/src/execution/executor.ts +146 -0
- package/src/execution/setup.ts +108 -0
- package/src/expectation/basic.ts +209 -0
- package/src/expectation/diff.ts +445 -0
- package/src/expectation/expect.ts +401 -0
- package/src/expectation/include.ts +184 -0
- package/src/expectation/print.ts +386 -0
- package/src/expectation/throwing.ts +45 -0
- package/src/expectation/types.ts +263 -0
- package/src/expectation/void.ts +80 -0
- package/src/globals.ts +30 -0
- package/src/index.ts +54 -0
- package/src/test.ts +239 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// expectation/types.ts
|
|
2
|
+
function typeOf(value) {
|
|
3
|
+
if (value === null)
|
|
4
|
+
return "null";
|
|
5
|
+
const type = typeof value;
|
|
6
|
+
switch (type) {
|
|
7
|
+
case "bigint":
|
|
8
|
+
case "boolean":
|
|
9
|
+
case "function":
|
|
10
|
+
case "number":
|
|
11
|
+
case "string":
|
|
12
|
+
case "symbol":
|
|
13
|
+
case "undefined":
|
|
14
|
+
return type;
|
|
15
|
+
}
|
|
16
|
+
if (Array.isArray(value))
|
|
17
|
+
return "array";
|
|
18
|
+
if (value instanceof Promise)
|
|
19
|
+
return "promise";
|
|
20
|
+
if (typeof value["then"] === "function")
|
|
21
|
+
return "promise";
|
|
22
|
+
if (value instanceof Buffer)
|
|
23
|
+
return "buffer";
|
|
24
|
+
if (value instanceof RegExp)
|
|
25
|
+
return "regexp";
|
|
26
|
+
if (value instanceof Map)
|
|
27
|
+
return "map";
|
|
28
|
+
if (value instanceof Set)
|
|
29
|
+
return "set";
|
|
30
|
+
return "object";
|
|
31
|
+
}
|
|
32
|
+
function isType(context, type) {
|
|
33
|
+
return typeOf(context.value) === type;
|
|
34
|
+
}
|
|
35
|
+
function assertType(context, type) {
|
|
36
|
+
const { value } = context;
|
|
37
|
+
if (typeOf(value) === type)
|
|
38
|
+
return;
|
|
39
|
+
throw new ExpectationError(context, false, `to be ${prefixType(type)}`);
|
|
40
|
+
}
|
|
41
|
+
function constructorName(value) {
|
|
42
|
+
return Object.getPrototypeOf(value)?.constructor?.name;
|
|
43
|
+
}
|
|
44
|
+
function formatBinaryData(value, buffer) {
|
|
45
|
+
const binary = buffer.length > 20 ? `${buffer.toString("hex", 0, 20)}\u2026, length=${value.length}` : buffer.toString("hex");
|
|
46
|
+
return binary ? `[${constructorName(value)}: ${binary}]` : `[${constructorName(value)}: empty]`;
|
|
47
|
+
}
|
|
48
|
+
function stringifyObjectType(value) {
|
|
49
|
+
const proto = Object.getPrototypeOf(value);
|
|
50
|
+
if (!proto)
|
|
51
|
+
return "[Object: null prototype]";
|
|
52
|
+
return stringifyConstructor(proto.constructor);
|
|
53
|
+
}
|
|
54
|
+
function stringifyConstructor(ctor) {
|
|
55
|
+
if (!ctor)
|
|
56
|
+
return "[Object: no constructor]";
|
|
57
|
+
if (!ctor.name)
|
|
58
|
+
return "[Object: anonymous]";
|
|
59
|
+
return `[${ctor.name}]`;
|
|
60
|
+
}
|
|
61
|
+
function stringifyValue(value) {
|
|
62
|
+
if (value === null)
|
|
63
|
+
return "<null>";
|
|
64
|
+
if (value === void 0)
|
|
65
|
+
return "<undefined>";
|
|
66
|
+
switch (typeof value) {
|
|
67
|
+
case "string":
|
|
68
|
+
if (value.length > 40)
|
|
69
|
+
value = `${value.substring(0, 40)}\u2026, length=${value.length}`;
|
|
70
|
+
return JSON.stringify(value);
|
|
71
|
+
case "number":
|
|
72
|
+
if (value === Number.POSITIVE_INFINITY)
|
|
73
|
+
return "+Infinity";
|
|
74
|
+
if (value === Number.NEGATIVE_INFINITY)
|
|
75
|
+
return "-Infinity";
|
|
76
|
+
return String(value);
|
|
77
|
+
case "boolean":
|
|
78
|
+
return String(value);
|
|
79
|
+
case "bigint":
|
|
80
|
+
return `${value}n`;
|
|
81
|
+
case "function":
|
|
82
|
+
return value.name ? `<function ${value.name}>` : "<function>";
|
|
83
|
+
case "symbol":
|
|
84
|
+
return value.description ? `<symbol ${value.description}>` : "<symbol>";
|
|
85
|
+
}
|
|
86
|
+
if (isMatcher(value))
|
|
87
|
+
return "<matcher>";
|
|
88
|
+
if (value instanceof RegExp)
|
|
89
|
+
return String(value);
|
|
90
|
+
if (value instanceof Date)
|
|
91
|
+
return `[${constructorName(value)}: ${value.toISOString()}]`;
|
|
92
|
+
if (value instanceof Boolean)
|
|
93
|
+
return `[${constructorName(value)}: ${value.valueOf()}]`;
|
|
94
|
+
if (value instanceof Number)
|
|
95
|
+
return `[${constructorName(value)}: ${stringifyValue(value.valueOf())}]`;
|
|
96
|
+
if (value instanceof String)
|
|
97
|
+
return `[${constructorName(value)}: ${stringifyValue(value.valueOf())}]`;
|
|
98
|
+
if (Array.isArray(value))
|
|
99
|
+
return `[${constructorName(value)} (${value.length})]`;
|
|
100
|
+
if (value instanceof Set)
|
|
101
|
+
return `[${constructorName(value)} (${value.size})]`;
|
|
102
|
+
if (value instanceof Map)
|
|
103
|
+
return `[${constructorName(value)} (${value.size})]`;
|
|
104
|
+
if (value instanceof Buffer)
|
|
105
|
+
return formatBinaryData(value, value);
|
|
106
|
+
if (value instanceof Uint8Array)
|
|
107
|
+
return formatBinaryData(value, Buffer.from(value));
|
|
108
|
+
if (value instanceof ArrayBuffer)
|
|
109
|
+
return formatBinaryData(value, Buffer.from(value));
|
|
110
|
+
if (value instanceof SharedArrayBuffer)
|
|
111
|
+
return formatBinaryData(value, Buffer.from(value));
|
|
112
|
+
return stringifyObjectType(value);
|
|
113
|
+
}
|
|
114
|
+
function prefixType(type) {
|
|
115
|
+
switch (type) {
|
|
116
|
+
case "bigint":
|
|
117
|
+
case "boolean":
|
|
118
|
+
case "buffer":
|
|
119
|
+
case "function":
|
|
120
|
+
case "map":
|
|
121
|
+
case "number":
|
|
122
|
+
case "promise":
|
|
123
|
+
case "regexp":
|
|
124
|
+
case "set":
|
|
125
|
+
case "string":
|
|
126
|
+
case "symbol":
|
|
127
|
+
return `a <${type}>`;
|
|
128
|
+
case "array":
|
|
129
|
+
case "object":
|
|
130
|
+
return `an <${type}>`;
|
|
131
|
+
case "null":
|
|
132
|
+
case "undefined":
|
|
133
|
+
return `<${type}>`;
|
|
134
|
+
default:
|
|
135
|
+
return `of unknown type <${type}>`;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
var matcherMarker = Symbol.for("expect5.matcher");
|
|
139
|
+
function isMatcher(what) {
|
|
140
|
+
return what && what[matcherMarker] === matcherMarker;
|
|
141
|
+
}
|
|
142
|
+
var ExpectationError = class extends Error {
|
|
143
|
+
diff;
|
|
144
|
+
constructor(context, negative, details, diff) {
|
|
145
|
+
const { value } = context;
|
|
146
|
+
const not = negative ? " not" : "";
|
|
147
|
+
let preamble = stringifyValue(value);
|
|
148
|
+
if (context.parent) {
|
|
149
|
+
const properties = [];
|
|
150
|
+
while (context.parent) {
|
|
151
|
+
properties.push(`[${stringifyValue(context.parent.prop)}]`);
|
|
152
|
+
context = context.parent.context;
|
|
153
|
+
}
|
|
154
|
+
preamble = properties.reverse().join("");
|
|
155
|
+
const type = typeof context.value === "object" ? stringifyObjectType(context.value) : (
|
|
156
|
+
// parent values can not be null!
|
|
157
|
+
stringifyValue(context.value)
|
|
158
|
+
);
|
|
159
|
+
preamble = `property ${preamble} of ${type} (${stringifyValue(value)})`;
|
|
160
|
+
}
|
|
161
|
+
super(`Expected ${preamble}${not} ${details}`);
|
|
162
|
+
if (diff)
|
|
163
|
+
this.diff = diff;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
export {
|
|
167
|
+
ExpectationError,
|
|
168
|
+
assertType,
|
|
169
|
+
isMatcher,
|
|
170
|
+
isType,
|
|
171
|
+
matcherMarker,
|
|
172
|
+
prefixType,
|
|
173
|
+
stringifyConstructor,
|
|
174
|
+
stringifyObjectType,
|
|
175
|
+
stringifyValue,
|
|
176
|
+
typeOf
|
|
177
|
+
};
|
|
178
|
+
//# sourceMappingURL=types.mjs.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/expectation/types.ts"],
|
|
4
|
+
"mappings": ";AAoDO,SAAS,OAAO,OAA0B;AAC/C,MAAI,UAAU;AAAM,WAAO;AAG3B,QAAM,OAAO,OAAO;AACpB,UAAQ,MAAM;AAAA,IACZ,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,EACX;AAGA,MAAI,MAAM,QAAQ,KAAK;AAAG,WAAO;AAEjC,MAAI,iBAAiB;AAAS,WAAO;AACrC,MAAI,OAAQ,MAAc,MAAM,MAAM;AAAY,WAAO;AAEzD,MAAI,iBAAiB;AA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c = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// expectation/void.ts
|
|
21
|
+
var void_exports = {};
|
|
22
|
+
__export(void_exports, {
|
|
23
|
+
ToBeDefined: () => ToBeDefined,
|
|
24
|
+
ToBeFalse: () => ToBeFalse,
|
|
25
|
+
ToBeFalsy: () => ToBeFalsy,
|
|
26
|
+
ToBeNaN: () => ToBeNaN,
|
|
27
|
+
ToBeNegativeInfinity: () => ToBeNegativeInfinity,
|
|
28
|
+
ToBeNull: () => ToBeNull,
|
|
29
|
+
ToBePositiveInfinity: () => ToBePositiveInfinity,
|
|
30
|
+
ToBeTrue: () => ToBeTrue,
|
|
31
|
+
ToBeTruthy: () => ToBeTruthy,
|
|
32
|
+
ToBeUndefined: () => ToBeUndefined
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(void_exports);
|
|
35
|
+
var import_types = require("./types.cjs");
|
|
36
|
+
var VoidExpectation = class {
|
|
37
|
+
constructor(_details, _check) {
|
|
38
|
+
this._details = _details;
|
|
39
|
+
this._check = _check;
|
|
40
|
+
}
|
|
41
|
+
expect(context, negative) {
|
|
42
|
+
const check = this._check(context.value);
|
|
43
|
+
if (check === negative) {
|
|
44
|
+
throw new import_types.ExpectationError(context, negative, this._details);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var ToBeDefined = class extends VoidExpectation {
|
|
49
|
+
constructor() {
|
|
50
|
+
super("to be defined", (value) => value !== null && value !== void 0);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var ToBeFalse = class extends VoidExpectation {
|
|
54
|
+
constructor() {
|
|
55
|
+
super(`to be ${(0, import_types.stringifyValue)(false)}`, (value) => value === false);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
var ToBeFalsy = class extends VoidExpectation {
|
|
59
|
+
constructor() {
|
|
60
|
+
super("to be falsy", (value) => !value);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var ToBeNaN = class extends VoidExpectation {
|
|
64
|
+
constructor() {
|
|
65
|
+
super(`to be ${(0, import_types.stringifyValue)(NaN)}`, (value) => typeof value === "number" && isNaN(value));
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
var ToBeNegativeInfinity = class extends VoidExpectation {
|
|
69
|
+
constructor() {
|
|
70
|
+
super(`to equal ${(0, import_types.stringifyValue)(Number.NEGATIVE_INFINITY)}`, (value) => value === Number.NEGATIVE_INFINITY);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
var ToBeNull = class extends VoidExpectation {
|
|
74
|
+
constructor() {
|
|
75
|
+
super(`to be ${(0, import_types.stringifyValue)(null)}`, (value) => value === null);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
var ToBePositiveInfinity = class extends VoidExpectation {
|
|
79
|
+
constructor() {
|
|
80
|
+
super(`to equal ${(0, import_types.stringifyValue)(Number.POSITIVE_INFINITY)}`, (value) => value === Number.POSITIVE_INFINITY);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var ToBeTrue = class extends VoidExpectation {
|
|
84
|
+
constructor() {
|
|
85
|
+
super(`to be ${(0, import_types.stringifyValue)(true)}`, (value) => value === true);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
var ToBeTruthy = class extends VoidExpectation {
|
|
89
|
+
constructor() {
|
|
90
|
+
super("to be truthy", (value) => !!value);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
var ToBeUndefined = class extends VoidExpectation {
|
|
94
|
+
constructor() {
|
|
95
|
+
super(`to be ${(0, import_types.stringifyValue)(void 0)}`, (value) => value === void 0);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
99
|
+
0 && (module.exports = {
|
|
100
|
+
ToBeDefined,
|
|
101
|
+
ToBeFalse,
|
|
102
|
+
ToBeFalsy,
|
|
103
|
+
ToBeNaN,
|
|
104
|
+
ToBeNegativeInfinity,
|
|
105
|
+
ToBeNull,
|
|
106
|
+
ToBePositiveInfinity,
|
|
107
|
+
ToBeTrue,
|
|
108
|
+
ToBeTruthy,
|
|
109
|
+
ToBeUndefined
|
|
110
|
+
});
|
|
111
|
+
//# sourceMappingURL=void.cjs.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/expectation/void.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAiD;AAKjD,IAAe,kBAAf,MAAsD;AAAA,EACpD,YACY,UACA,QACV;AAFU;AACA;AAAA,EACT;AAAA,EAEH,OAAO,SAAuB,UAAyB;AACrD,UAAM,QAAQ,KAAK,OAAO,QAAQ,KAAK;AACvC,QAAI,UAAU,UAAU;AACtB,YAAM,IAAI,8BAAiB,SAAS,UAAU,KAAK,QAAQ;AAAA,IAC7D;AAAA,EACF;AACF;AAIO,IAAM,cAAN,cAA0B,gBAAgB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AACZ,UAAM,aAAS,6BAAe,MAAS,KAAK,CAAC,UAAU,UAAU,MAAS;AAAA,EAC5E;AACF;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Expectation, Expectations } from './expect';
|
|
2
|
+
/** A simple {@link Expectation} performing a basic true/false check */
|
|
3
|
+
declare abstract class VoidExpectation implements Expectation {
|
|
4
|
+
private _details;
|
|
5
|
+
private _check;
|
|
6
|
+
constructor(_details: string, _check: (value: unknown) => boolean);
|
|
7
|
+
expect(context: Expectations, negative: boolean): void;
|
|
8
|
+
}
|
|
9
|
+
export declare class ToBeDefined extends VoidExpectation {
|
|
10
|
+
constructor();
|
|
11
|
+
}
|
|
12
|
+
export declare class ToBeFalse extends VoidExpectation {
|
|
13
|
+
constructor();
|
|
14
|
+
}
|
|
15
|
+
export declare class ToBeFalsy extends VoidExpectation {
|
|
16
|
+
constructor();
|
|
17
|
+
}
|
|
18
|
+
export declare class ToBeNaN extends VoidExpectation {
|
|
19
|
+
constructor();
|
|
20
|
+
}
|
|
21
|
+
export declare class ToBeNegativeInfinity extends VoidExpectation {
|
|
22
|
+
constructor();
|
|
23
|
+
}
|
|
24
|
+
export declare class ToBeNull extends VoidExpectation {
|
|
25
|
+
constructor();
|
|
26
|
+
}
|
|
27
|
+
export declare class ToBePositiveInfinity extends VoidExpectation {
|
|
28
|
+
constructor();
|
|
29
|
+
}
|
|
30
|
+
export declare class ToBeTrue extends VoidExpectation {
|
|
31
|
+
constructor();
|
|
32
|
+
}
|
|
33
|
+
export declare class ToBeTruthy extends VoidExpectation {
|
|
34
|
+
constructor();
|
|
35
|
+
}
|
|
36
|
+
export declare class ToBeUndefined extends VoidExpectation {
|
|
37
|
+
constructor();
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// expectation/void.ts
|
|
2
|
+
import { ExpectationError, stringifyValue } from "./types.mjs";
|
|
3
|
+
var VoidExpectation = class {
|
|
4
|
+
constructor(_details, _check) {
|
|
5
|
+
this._details = _details;
|
|
6
|
+
this._check = _check;
|
|
7
|
+
}
|
|
8
|
+
expect(context, negative) {
|
|
9
|
+
const check = this._check(context.value);
|
|
10
|
+
if (check === negative) {
|
|
11
|
+
throw new ExpectationError(context, negative, this._details);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var ToBeDefined = class extends VoidExpectation {
|
|
16
|
+
constructor() {
|
|
17
|
+
super("to be defined", (value) => value !== null && value !== void 0);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var ToBeFalse = class extends VoidExpectation {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(`to be ${stringifyValue(false)}`, (value) => value === false);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
var ToBeFalsy = class extends VoidExpectation {
|
|
26
|
+
constructor() {
|
|
27
|
+
super("to be falsy", (value) => !value);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var ToBeNaN = class extends VoidExpectation {
|
|
31
|
+
constructor() {
|
|
32
|
+
super(`to be ${stringifyValue(NaN)}`, (value) => typeof value === "number" && isNaN(value));
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var ToBeNegativeInfinity = class extends VoidExpectation {
|
|
36
|
+
constructor() {
|
|
37
|
+
super(`to equal ${stringifyValue(Number.NEGATIVE_INFINITY)}`, (value) => value === Number.NEGATIVE_INFINITY);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
var ToBeNull = class extends VoidExpectation {
|
|
41
|
+
constructor() {
|
|
42
|
+
super(`to be ${stringifyValue(null)}`, (value) => value === null);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var ToBePositiveInfinity = class extends VoidExpectation {
|
|
46
|
+
constructor() {
|
|
47
|
+
super(`to equal ${stringifyValue(Number.POSITIVE_INFINITY)}`, (value) => value === Number.POSITIVE_INFINITY);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var ToBeTrue = class extends VoidExpectation {
|
|
51
|
+
constructor() {
|
|
52
|
+
super(`to be ${stringifyValue(true)}`, (value) => value === true);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var ToBeTruthy = class extends VoidExpectation {
|
|
56
|
+
constructor() {
|
|
57
|
+
super("to be truthy", (value) => !!value);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
var ToBeUndefined = class extends VoidExpectation {
|
|
61
|
+
constructor() {
|
|
62
|
+
super(`to be ${stringifyValue(void 0)}`, (value) => value === void 0);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
export {
|
|
66
|
+
ToBeDefined,
|
|
67
|
+
ToBeFalse,
|
|
68
|
+
ToBeFalsy,
|
|
69
|
+
ToBeNaN,
|
|
70
|
+
ToBeNegativeInfinity,
|
|
71
|
+
ToBeNull,
|
|
72
|
+
ToBePositiveInfinity,
|
|
73
|
+
ToBeTrue,
|
|
74
|
+
ToBeTruthy,
|
|
75
|
+
ToBeUndefined
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=void.mjs.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/expectation/void.ts"],
|
|
4
|
+
"mappings": ";AAAA,SAAS,kBAAkB,sBAAsB;AAKjD,IAAe,kBAAf,MAAsD;AAAA,EACpD,YACY,UACA,QACV;AAFU;AACA;AAAA,EACT;AAAA,EAEH,OAAO,SAAuB,UAAyB;AACrD,UAAM,QAAQ,KAAK,OAAO,QAAQ,KAAK;AACvC,QAAI,UAAU,UAAU;AACtB,YAAM,IAAI,iBAAiB,SAAS,UAAU,KAAK,QAAQ;AAAA,IAC7D;AAAA,EACF;AACF;AAIO,IAAM,cAAN,cAA0B,gBAAgB;AAAA,EAC/C,cAAc;AACZ,UAAM,iBAAiB,CAAC,UAAW,UAAU,QAAU,UAAU,MAAU;AAAA,EAC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[]
|
|
6
|
+
}
|
package/dist/globals.cjs
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type * as setup from './execution/setup';
|
|
2
|
+
import type { skip as SkipFunction } from './execution/executable';
|
|
3
|
+
import type { expect as ExpectFunction } from './expectation/expect';
|
|
4
|
+
import type { logging } from '@plugjs/plug';
|
|
5
|
+
declare global {
|
|
6
|
+
const describe: setup.SuiteFunction;
|
|
7
|
+
const fdescribe: setup.SuiteSetup;
|
|
8
|
+
const xdescribe: setup.SuiteSetup;
|
|
9
|
+
const it: setup.SpecFunction;
|
|
10
|
+
const fit: setup.SpecSetup;
|
|
11
|
+
const xit: setup.SpecSetup;
|
|
12
|
+
const afterAll: setup.HookFunction;
|
|
13
|
+
const afterEach: setup.HookFunction;
|
|
14
|
+
const beforeAll: setup.HookFunction;
|
|
15
|
+
const beforeEach: setup.HookFunction;
|
|
16
|
+
const xafterAll: setup.HookSetup;
|
|
17
|
+
const xafterEach: setup.HookSetup;
|
|
18
|
+
const xbeforeAll: setup.HookSetup;
|
|
19
|
+
const xbeforeEach: setup.HookSetup;
|
|
20
|
+
const skip: typeof SkipFunction;
|
|
21
|
+
const expect: typeof ExpectFunction;
|
|
22
|
+
const log: logging.LogFunction;
|
|
23
|
+
}
|
package/dist/globals.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=globals.mjs.map
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
afterAll: () => import_setup.afterAll,
|
|
24
|
+
afterEach: () => import_setup.afterEach,
|
|
25
|
+
beforeAll: () => import_setup.beforeAll,
|
|
26
|
+
beforeEach: () => import_setup.beforeEach,
|
|
27
|
+
describe: () => import_setup.describe,
|
|
28
|
+
expect: () => import_expect.expect,
|
|
29
|
+
fdescribe: () => import_setup.fdescribe,
|
|
30
|
+
fit: () => import_setup.fit,
|
|
31
|
+
it: () => import_setup.it,
|
|
32
|
+
skip: () => import_executable.skip,
|
|
33
|
+
xafterAll: () => import_setup.xafterAll,
|
|
34
|
+
xafterEach: () => import_setup.xafterEach,
|
|
35
|
+
xbeforeAll: () => import_setup.xbeforeAll,
|
|
36
|
+
xbeforeEach: () => import_setup.xbeforeEach,
|
|
37
|
+
xdescribe: () => import_setup.xdescribe,
|
|
38
|
+
xit: () => import_setup.xit
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(src_exports);
|
|
41
|
+
var import_fork = require("@plugjs/plug/fork");
|
|
42
|
+
var import_paths = require("@plugjs/plug/paths");
|
|
43
|
+
var import_setup = require("./execution/setup.cjs");
|
|
44
|
+
var import_executable = require("./execution/executable.cjs");
|
|
45
|
+
var import_expect = require("./expectation/expect.cjs");
|
|
46
|
+
(0, import_fork.installForking)("test", (0, import_paths.requireResolve)(__filename, "./test"), "Test");
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
49
|
+
afterAll,
|
|
50
|
+
afterEach,
|
|
51
|
+
beforeAll,
|
|
52
|
+
beforeEach,
|
|
53
|
+
describe,
|
|
54
|
+
expect,
|
|
55
|
+
fdescribe,
|
|
56
|
+
fit,
|
|
57
|
+
it,
|
|
58
|
+
skip,
|
|
59
|
+
xafterAll,
|
|
60
|
+
xafterEach,
|
|
61
|
+
xbeforeAll,
|
|
62
|
+
xbeforeEach,
|
|
63
|
+
xdescribe,
|
|
64
|
+
xit
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA+B;AAC/B,mBAA+B;AAQ/B,mBAKO;AACP,wBAAqB;AACrB,oBAAuB;AAAA,IAqCvB,4BAAe,YAAQ,6BAAe,YAAW,QAAQ,GAAG,MAAM;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ForkOptions } from '@plugjs/plug/fork';
|
|
2
|
+
export { it, fit, xit, describe, fdescribe, xdescribe, afterAll, afterEach, xafterAll, xafterEach, beforeAll, beforeEach, xbeforeAll, xbeforeEach, } from './execution/setup';
|
|
3
|
+
export { skip } from './execution/executable';
|
|
4
|
+
export { expect } from './expectation/expect';
|
|
5
|
+
/** Options to construct our {@link Jasmine} plug. */
|
|
6
|
+
export interface TestOptions extends ForkOptions {
|
|
7
|
+
/** Report up to the specified amount of failures (default: `+Infinity`) */
|
|
8
|
+
maxFailures?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Specify whether the variables (`describe`, `it`, `expect`, ...) will be
|
|
11
|
+
* exposed as _global_ variables to tests or not (default: `true`)
|
|
12
|
+
*/
|
|
13
|
+
globals?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Print differences between expected and actual values from generic errors
|
|
16
|
+
* (e.g. `AssertionError` or _Chai_ expectations) (default: `true`)
|
|
17
|
+
*/
|
|
18
|
+
genericErrorDiffs?: boolean;
|
|
19
|
+
}
|
|
20
|
+
declare module '@plugjs/plug' {
|
|
21
|
+
interface Pipe {
|
|
22
|
+
/**
|
|
23
|
+
* Run tests.
|
|
24
|
+
*
|
|
25
|
+
* @param options Optional {@link TestOptions | options}.
|
|
26
|
+
*/
|
|
27
|
+
test(options?: TestOptions): Promise<undefined>;
|
|
28
|
+
}
|
|
29
|
+
}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// index.ts
|
|
2
|
+
import { installForking } from "@plugjs/plug/fork";
|
|
3
|
+
import { requireResolve } from "@plugjs/plug/paths";
|
|
4
|
+
import {
|
|
5
|
+
it,
|
|
6
|
+
fit,
|
|
7
|
+
xit,
|
|
8
|
+
describe,
|
|
9
|
+
fdescribe,
|
|
10
|
+
xdescribe,
|
|
11
|
+
afterAll,
|
|
12
|
+
afterEach,
|
|
13
|
+
xafterAll,
|
|
14
|
+
xafterEach,
|
|
15
|
+
beforeAll,
|
|
16
|
+
beforeEach,
|
|
17
|
+
xbeforeAll,
|
|
18
|
+
xbeforeEach
|
|
19
|
+
} from "./execution/setup.mjs";
|
|
20
|
+
import { skip } from "./execution/executable.mjs";
|
|
21
|
+
import { expect } from "./expectation/expect.mjs";
|
|
22
|
+
installForking("test", requireResolve(import.meta.url, "./test"), "Test");
|
|
23
|
+
export {
|
|
24
|
+
afterAll,
|
|
25
|
+
afterEach,
|
|
26
|
+
beforeAll,
|
|
27
|
+
beforeEach,
|
|
28
|
+
describe,
|
|
29
|
+
expect,
|
|
30
|
+
fdescribe,
|
|
31
|
+
fit,
|
|
32
|
+
it,
|
|
33
|
+
skip,
|
|
34
|
+
xafterAll,
|
|
35
|
+
xafterEach,
|
|
36
|
+
xbeforeAll,
|
|
37
|
+
xbeforeEach,
|
|
38
|
+
xdescribe,
|
|
39
|
+
xit
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts"],
|
|
4
|
+
"mappings": ";AAAA,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAQ/B;AAAA,EACE;AAAA,EAAI;AAAA,EAAK;AAAA,EACT;AAAA,EAAU;AAAA,EAAW;AAAA,EACrB;AAAA,EAAU;AAAA,EAAW;AAAA,EAAW;AAAA,EAChC;AAAA,EAAW;AAAA,EAAY;AAAA,EAAY;AAAA,OAC9B;AACP,SAAS,YAAY;AACrB,SAAS,cAAc;AAqCvB,eAAe,QAAQ,eAAe,iBAAW,QAAQ,GAAG,MAAM;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|