risei 3.2.1 → 3.3.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 +6 -2
- package/package.json +2 -2
- package/system/TestDef.js +30 -7
- package/system/TestStages.js +1 -1
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ And they have a summary bar at the bottom:
|
|
|
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. The latest release, **3.
|
|
49
|
+
Risei's major features are now complete, but new enhancements or fixes may appear from time to time. The latest release, **3.3.0**, brings further significant improvements and bug fixes on top of the major improvements in other recent releases.
|
|
50
50
|
|
|
51
51
|
Check out the [full list of changes](#version-history).
|
|
52
52
|
|
|
@@ -219,6 +219,10 @@ If errors are thrown while testing, gold bars listing them appear at the bottom,
|
|
|
219
219
|
|
|
220
220
|
## Version history
|
|
221
221
|
|
|
222
|
+
- Release **3.3.0** (January, 2025) adds this change to those of other recent releases:
|
|
223
|
+
- You can now test instance members with the same names as static members using a new `.and` option of `"instance"`.
|
|
224
|
+
|
|
225
|
+
|
|
222
226
|
- Release **3.2.1** (January, 2025) contains all the changes from **3.2.0**, **3.1.1**, and **3.1.0**, plus this change:
|
|
223
227
|
- Risei's mistaken nominal dependency on **npm** has been removed.
|
|
224
228
|
|
|
@@ -278,7 +282,7 @@ Older releases
|
|
|
278
282
|
|
|
279
283
|
## Known issues and workarounds
|
|
280
284
|
|
|
281
|
-
There are two minor issues
|
|
285
|
+
There are two minor issues:
|
|
282
286
|
|
|
283
287
|
- If args for a test are mutated by tested code, the mutated args are used when collapsing forward.
|
|
284
288
|
- The workaround is just to restate those args for each test.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "risei",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
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",
|
|
@@ -50,6 +50,6 @@
|
|
|
50
50
|
"fs": "^0.0.1-security",
|
|
51
51
|
"mocha": "^10.0.0",
|
|
52
52
|
"morgan": "~1.9.1",
|
|
53
|
-
"risei": "^3.2.
|
|
53
|
+
"risei": "^3.2.1"
|
|
54
54
|
}
|
|
55
55
|
}
|
package/system/TestDef.js
CHANGED
|
@@ -14,6 +14,7 @@ export default class TestDef {
|
|
|
14
14
|
// region Definitions
|
|
15
15
|
|
|
16
16
|
static staticName = "static";
|
|
17
|
+
static instanceName = "instance";
|
|
17
18
|
static throwName = "throw";
|
|
18
19
|
static polyName = "poly";
|
|
19
20
|
static constructorName = "constructor";
|
|
@@ -173,16 +174,19 @@ export default class TestDef {
|
|
|
173
174
|
}
|
|
174
175
|
|
|
175
176
|
get isInstanceTest() /* passed */ {
|
|
176
|
-
return
|
|
177
|
+
return this.#isNamedTypeTest(
|
|
178
|
+
TestDef.instanceName,
|
|
179
|
+
TestDef.staticName,
|
|
180
|
+
TypeAnalyzer.isInstanceMember
|
|
181
|
+
);
|
|
177
182
|
}
|
|
178
183
|
|
|
179
184
|
get isStaticTest() /* passed */ {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
return is || stated;
|
|
185
|
+
return this.#isNamedTypeTest(
|
|
186
|
+
TestDef.staticName,
|
|
187
|
+
TestDef.instanceName,
|
|
188
|
+
TypeAnalyzer.isStaticMember
|
|
189
|
+
);
|
|
186
190
|
}
|
|
187
191
|
|
|
188
192
|
get isThrowTest() /* passed */ {
|
|
@@ -308,6 +312,25 @@ export default class TestDef {
|
|
|
308
312
|
|
|
309
313
|
// region State methods
|
|
310
314
|
|
|
315
|
+
/* Dependency of .isInstanceTest and .isStaticTest. */
|
|
316
|
+
#isNamedTypeTest(type, antiType, analyzer) /* verified */ {
|
|
317
|
+
// If stated to be the opposite type, not this type.
|
|
318
|
+
if (this.andStringContains(antiType)) {
|
|
319
|
+
return false;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// Analysis of what the type probably is.
|
|
323
|
+
let plainName = NameAnalyzer.plainNameOf(this.of);
|
|
324
|
+
let is = analyzer(this.on, plainName);
|
|
325
|
+
|
|
326
|
+
// If states to be this type, then this type.
|
|
327
|
+
let stated = this.andStringContains(type);
|
|
328
|
+
|
|
329
|
+
// Whichever may apply.
|
|
330
|
+
return is || stated;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
|
|
311
334
|
/* Needed externally, and dependency
|
|
312
335
|
of all .and-based properties. */
|
|
313
336
|
andStringContains(keyword) /* passed */ {
|
package/system/TestStages.js
CHANGED