risei 3.3.1 → 3.3.3
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 +10 -54
- package/package.json +6 -2
- package/system/PropertySpoofer.js +1 -1
- package/system/SpoofDef.js +6 -18
- package/system/TestDef.js +341 -387
- package/system/TestFinder.js +1 -1
- package/system/TestFrame.js +20 -9
- package/system/TestRunner.js +12 -36
- package/system/TestStages.js +69 -172
- package/system/TestSummary.js +6 -18
- package/system/TestTargets.js +114 -0
- package/system/TotalComparer.js +0 -2
- package/system/TypeAnalyzer.js +0 -1
package/README.md
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
## Overview
|
|
5
5
|
|
|
6
|
-
Risei is a new way to write unit tests that's easier
|
|
6
|
+
Risei is a new way to write unit tests that's easier, faster, and more readable. Tests made with Risei aren't a source of errors or a drag on redesigns.
|
|
7
7
|
|
|
8
8
|
Risei does all this by replacing hand-coded tests with simple declarative syntax.
|
|
9
9
|
|
|
10
10
|
- Risei has many convenient and time-saving [features](#features-of-risei).
|
|
11
|
-
- Risei works with
|
|
11
|
+
- Risei works with class-based JavaScript in modules.
|
|
12
12
|
- Risei works with TypeScript after just a few [tweaks](https://deusware.com/risei/index.html#typescript-with-risei).
|
|
13
13
|
|
|
14
14
|
You can find a longer version of this read-me at [https://deusware.com/risei](https://deusware.com/risei/index.html). It expands greatly on the information here.
|
|
@@ -40,15 +40,15 @@ And they have a summary bar at the bottom:
|
|
|
40
40
|
|
|
41
41
|

|
|
42
42
|
|
|
43
|
-
- This bar is red when any tests fail,
|
|
43
|
+
- This bar is red when any tests fail, just as you'd expect.
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
## Status
|
|
48
48
|
|
|
49
|
-
Risei's major features are now complete, but new enhancements or fixes may appear from time to time
|
|
49
|
+
Risei's major features are now complete, but new enhancements or fixes may appear from time to time.
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
The latest release, **3.3.3**, adds `async` capabilities to poly-testing, the last place they were missing.
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
|
|
@@ -121,7 +121,8 @@ tests = [ ...
|
|
|
121
121
|
... ];
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
-
- Asynchronous
|
|
124
|
+
- **Asynchronous / awaitable code can tested with no changes at all to this syntax.**
|
|
125
|
+
- You use `async` and `await` normally if you define functions within tests.
|
|
125
126
|
- Use empty arrays for `.in` or `.with` when there are no args to pass.
|
|
126
127
|
- You can use [long names](https://deusware.com/risei/index.html#long-names) for properties if you want.
|
|
127
128
|
|
|
@@ -216,51 +217,6 @@ If errors are thrown while testing, gold bars listing them appear at the bottom,
|
|
|
216
217
|
|
|
217
218
|
|
|
218
219
|
|
|
219
|
-
## Version history
|
|
220
|
-
|
|
221
|
-
- Release **3.3.1** (February, 2025) contains this change:
|
|
222
|
-
- You can now spoof and otherwise address value properties (formally _data descriptors_) that don't have an initial value, whether they are static or instance class members.
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
- Release **3.3.0** (January, 2025) adds this change to those of other recent releases:
|
|
226
|
-
- You can now test instance members with the same names as static members using a new `.and` option of `"instance"`.
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
<details>
|
|
231
|
-
<summary>
|
|
232
|
-
Older releases
|
|
233
|
-
</summary>
|
|
234
|
-
|
|
235
|
-
- Release **3.2.1** (January, 2025) contains all the changes from **3.2.0**, **3.1.1**, and **3.1.0**, plus this change:
|
|
236
|
-
- Risei's mistaken nominal dependency on **npm** has been removed.
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
- Release **3.2.0** (January, 2025) contains all the changes from **3.1.1** and **3.1.0**, plus this change:
|
|
240
|
-
- Risei's self-dependency for its own self-testing has been moved back to the development-only scope.
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
- Release **3.1.1** (January, 2025) contains these changes:
|
|
244
|
-
- Extra commas and non-objects in arrays of test objects are disregarded, and no longer cause a throw.
|
|
245
|
-
- Throws in wider scopes are now listed at the end, like others already found there.
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
- Release **3.1.0** (January, 2025) contains these changes:
|
|
249
|
-
- Accessor properties (formally _accessor descriptors_) are now compared for test results and displayed in test outputs.
|
|
250
|
-
- Any accessor properties that throw errors during display are displayed as `(threw)`.
|
|
251
|
-
- Throws in tested code and in test framing code are now listed at the end, and also displayed amid the tests.
|
|
252
|
-
- `File` objects now have a succinct custom display in outputs.
|
|
253
|
-
- **(Breaking change)** In `constructor` tests, constructed instances are available in `.from` functions only as `actual` / `test.actual`.
|
|
254
|
-
- **(Breaking change)** In `constructor` tests, `test.target` is now the `prototype` of the tested class.
|
|
255
|
-
- Widespread internal reengineering of other kinds.
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
> Older releases are dropped from this list progressively over time. Using the latest release is recommended.
|
|
259
|
-
|
|
260
|
-
</details>
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
220
|
## Known issues and workarounds
|
|
265
221
|
|
|
266
222
|
There are the known minor issues:
|
|
@@ -270,10 +226,10 @@ There are the known minor issues:
|
|
|
270
226
|
|
|
271
227
|
|
|
272
228
|
- Spoofing accessor properties only works when they have both a getter and a setter.
|
|
273
|
-
-
|
|
229
|
+
- There is no specific workaround for this, but you may look for other ways to produce the property values you need.
|
|
274
230
|
|
|
275
231
|
|
|
276
|
-
-
|
|
232
|
+
- Custom versions of JavaScript methods like `toString()` may not be recognized, nor any instance methods with the same names as static methods.
|
|
277
233
|
- The workaround is to use an `.and` value of `"instance"` for any methods like these that you test.
|
|
278
234
|
|
|
279
235
|
|
|
@@ -285,7 +241,7 @@ At present, there are a few things Risei doesn't support. Some of these m
|
|
|
285
241
|
- You can see the whole list [here](https://deusware.com/risei/index.html#exclusions-from-risei).
|
|
286
242
|
|
|
287
243
|
|
|
288
|
-
|
|
244
|
+
You can save a lot of time by using Risei for most of your code, but another framework for whatever it doesn't support.
|
|
289
245
|
|
|
290
246
|
|
|
291
247
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "risei",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.3",
|
|
4
4
|
"description": "Risei allows you to write unit tests as simple JavaScript objects, so it's easy and fast, with no drag on redesign.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unit test",
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
"objects",
|
|
16
16
|
"declarative",
|
|
17
17
|
"javascript",
|
|
18
|
+
"class",
|
|
19
|
+
"modules",
|
|
20
|
+
"object-oriented",
|
|
21
|
+
"object oriented",
|
|
18
22
|
"typescript"
|
|
19
23
|
],
|
|
20
24
|
"author": "Ed Fallin <riseimaker@gmail.com>",
|
|
@@ -50,6 +54,6 @@
|
|
|
50
54
|
"fs": "^0.0.1-security",
|
|
51
55
|
"mocha": "^10.0.0",
|
|
52
56
|
"morgan": "~1.9.1",
|
|
53
|
-
"risei": "^3.3.
|
|
57
|
+
"risei": "^3.3.2"
|
|
54
58
|
}
|
|
55
59
|
}
|
|
@@ -78,7 +78,7 @@ export default class PropertySpoofer extends ASpoofingFixture {
|
|
|
78
78
|
// Stripping spoofs of any sigils.
|
|
79
79
|
propertySpoofs.forEach(x => x.method = NameAnalyzer.plainNameOf(x.method));
|
|
80
80
|
|
|
81
|
-
// Storing
|
|
81
|
+
// Storing spoofing definitions.
|
|
82
82
|
this.#settables = propertySpoofs;
|
|
83
83
|
|
|
84
84
|
// Storing original values for restoring later.
|
package/system/SpoofDef.js
CHANGED
|
@@ -42,29 +42,17 @@ export default class SpoofDef {
|
|
|
42
42
|
|
|
43
43
|
/* These short names make JSON-like definitions easier. */
|
|
44
44
|
|
|
45
|
-
get on() {
|
|
46
|
-
return this.target;
|
|
47
|
-
}
|
|
45
|
+
get on() { return this.target; }
|
|
48
46
|
|
|
49
|
-
set on(value) {
|
|
50
|
-
this.target = value;
|
|
51
|
-
}
|
|
47
|
+
set on(value) { this.target = value; }
|
|
52
48
|
|
|
53
|
-
get of() {
|
|
54
|
-
return this.method;
|
|
55
|
-
}
|
|
49
|
+
get of() { return this.method; }
|
|
56
50
|
|
|
57
|
-
set of(value) {
|
|
58
|
-
this.method = value;
|
|
59
|
-
}
|
|
51
|
+
set of(value) { this.method = value; }
|
|
60
52
|
|
|
61
|
-
get as() {
|
|
62
|
-
return this.output;
|
|
63
|
-
}
|
|
53
|
+
get as() { return this.output; }
|
|
64
54
|
|
|
65
|
-
set as(value) {
|
|
66
|
-
this.output = value;
|
|
67
|
-
}
|
|
55
|
+
set as(value) { this.output = value; }
|
|
68
56
|
|
|
69
57
|
// endregion Spoof definition, short names
|
|
70
58
|
|