risei 1.3.3 → 1.3.4

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 CHANGED
@@ -8,8 +8,6 @@
8
8
  * Refactor or replace existing designs without worrying about the cost in past or future test time.
9
9
  * Create tests with immediate confidence, because you can't introduce mistakes in test code you write.
10
10
 
11
- Risei may be referred to as **Rs** here for brevity.
12
-
13
11
 
14
12
 
15
13
 
@@ -472,7 +470,7 @@ Testing TypeScript code with Risei basically just means transpiling before runni
472
470
 
473
471
  If you follow the general Risei set-up, you can just make the following few modifications for TypeScript applications.
474
472
  - These steps have worked with both Angular and React.
475
- - Variant approaches are also sure to work, depending on the other technical choices in play.
473
+ - Varying other approaches are also sure to work, depending on the other technical choices in play.
476
474
 
477
475
 
478
476
 
@@ -568,26 +566,46 @@ Two issues are known to exist:
568
566
 
569
567
  - When a few properties are changed in separate objects, they are treated as whole new tests, which usually fail because of their unintended mix of old and new properties.
570
568
  - To avoid this problem, just change properties as part of whole new tests, or else restate `.of` along with the changed properties.
571
- - Rs is actually working as intended when this happens, but ways to optionally prevent it are being considered.
569
+ - Risei is actually working as intended when this happens, but ways to optionally prevent it are being considered.
572
570
 
573
571
 
574
572
 
575
573
  ## What's new in Risei
576
574
 
575
+ - Release **1.3.4** (March, 2024) fixes a bug that caused class definitions still to appear instead of class names when classes were used as object properties.
576
+ - As a side effect of this change, objects' own `toString()` is never used in onscreen test output any longer, but all of Risei's output display is now handled the same.
577
+
578
+
577
579
  - Release **1.3.3** (March, 2024) fixes a major bug related to file paths that prevented any tests from loading or running in Windows environments.
580
+ - Risei is now fully usable in Windows environments again.
581
+
582
+
583
+ - Release **1.3.2** (February, 2024) does not change the code at all, but improves this read-me.
584
+ - It now explains the easiest way to deal with mutable args (which is just restating the args).
585
+ - A few mistakes in the text were also fixed.
578
586
 
579
- - Release **1.3.2** (February, 2024) does not change the code at all, but improves this read-me, notably explaining the easiest way to deal with mutable args (which is just restating the args), and correcting a few mistakes.
580
587
 
581
- - Release **1.3.1** (February, 2024) reverses some changes in 1.3.0 that were intended to fully isolate tests against mutable args, but which caused incomplete or inaccurate object contents in some cases.  This sort of built-in total isolation is not feasible, and in fact is rarely needed.
588
+ - Release **1.3.1** (February, 2024) reverses some changes in 1.3.0 that were intended to fully isolate tests against mutable args, but which caused incomplete or inaccurate object contents in some cases.
589
+ - Supporting built-in total test isolation is not feasible with collapsing forward, nor is it usually necessary given easy usage alternatives.
590
+ - In contrast, collapsing forward is both highly beneficial and frequently used.
582
591
 
583
- - Release **1.3.0** (February, 2024) moves the display of test-loading error messages to a new gold bar that appears at the bottom of the summary when there are any loading errors.  A sorting error that occurs when no test files exist yet has also been fixed.
584
592
 
585
- - Release **1.2.0** (January, 2024) changes sorting of test files.  Previously they were displayed in the order found.  Now the order remains the same, except that the last-edited file is moved to the bottom, making it easy to see the latest test results.
593
+ - Release **1.3.0** (February, 2024) makes two changes:
594
+ - If there are any test-loading errors, their messages now appear in a new gold bar that appears below the summary of the test run.
595
+ - A test-sorting error has also been fixed that occurred when no test files existed yet.
596
+
597
+
598
+ - Release **1.2.0** (January, 2024) changes sorting of test files to make tests you're working on now appear at the bottom.
599
+ - Previously tests were displayed in the order found, which is always alphabetical (though is not guaranteed to be so).
600
+ - The order for all files except one remains the same.
601
+ - The last-edited file is moved to the bottom, making it easy to see the latest test results.
602
+
586
603
 
587
604
  - Release **1.1.2** of Risei (January, 2024) fixes two problems:
588
605
  - Classes were sometimes displayed in output as their entire definition.  Now just the class name is displayed.
589
606
  - All `Date` instances were considered equal, regardless of their actual value.  Now they only are considered equal when they actually are.
590
607
 
608
+
591
609
  - Don't use release **1.1.1**, which contains an internal path error.
592
610
 
593
611
 
package/package.json CHANGED
@@ -1,18 +1,21 @@
1
1
  {
2
2
  "name": "risei",
3
- "version": "1.3.3",
4
- "description": "Risei is the framework that allows you to write unit tests as collections of values in JavaScript objects, so it's easy and fast, and tests don't serve as a drag on redesigns.",
3
+ "version": "1.3.4",
4
+ "description": "Risei is the framework that allows you to write unit tests as simple JavaScript objects, so it's easy and fast, and tests don't serve as a drag on redesigns.",
5
5
  "keywords": [
6
6
  "unit test",
7
7
  "test",
8
8
  "unit testing",
9
9
  "testing",
10
+ "test framework",
10
11
  "easy",
11
12
  "fast",
12
13
  "simple",
13
14
  "values",
14
15
  "objects",
15
- "declarative"
16
+ "declarative",
17
+ "javascript",
18
+ "typescript"
16
19
  ],
17
20
  "author": "Ed Fallin <riseimaker@gmail.com>",
18
21
  "license": "MIT",
@@ -4,6 +4,9 @@ import { ASpoofingFixture } from "./ASpoofingFixture.js";
4
4
  import { SpoofDefinition } from "./SpoofDefinition.js";
5
5
  import { TypeAnalyzer } from "./TypeAnalyzer.js";
6
6
 
7
+ /* &cruft, implement this under test so that anything that can be spoofed
8
+ from the class level is spoofed, but not expecting it to get
9
+ absolutely everything, and supporting poly-spoofing syntax */
7
10
  export class ClassPropertySpoofer extends ASpoofingFixture {
8
11
  /* Algorithm: Forward method spoof() looks at spoof definitions in .plus and applies them
9
12
  to each class' prototypes after first saving the original member definitions.
@@ -58,7 +58,7 @@ export class ObjectPropertySpoofer extends ASpoofingFixture {
58
58
 
59
59
  // Working only with property spoofs.
60
60
  let propertySpoofs = Array.from(spoofDefinitions)
61
- .filter(x => TypeAnalyzer.memberIsProperty(test.on, x.on));
61
+ .filter(spoof => TypeAnalyzer.memberIsProperty(test.on, spoof.of));
62
62
 
63
63
  // Storing new values for setting.
64
64
  this.#settables = propertySpoofs;
@@ -105,51 +105,6 @@ export class TestStages {
105
105
 
106
106
  // region Dependencies of test stages
107
107
 
108
- #anyOriginalPropertyGetting(target, settables) {
109
- if (!Array.isArray(settables)) {
110
- return;
111
- }
112
-
113
- let unsettables = [ ];
114
-
115
- for (let settable of settables) {
116
- // Not a setter tuple.
117
- if (!settable.of) {
118
- continue;
119
- }
120
-
121
- // Retaining original.
122
- let original = target[settable.of];
123
- let unsettable = { of: settable.of, as: original };
124
- unsettables.push(unsettable);
125
- }
126
-
127
- return unsettables;
128
- }
129
-
130
- #anyPropertySetting(target, settables) {
131
- // No properties to set.
132
- if (!Array.isArray(settables)) {
133
- return;
134
- }
135
-
136
- for (let settable of settables) {
137
- // Not a setter tuple.
138
- if (!settable.of) {
139
- continue;
140
- }
141
-
142
- // Actually setting property.
143
- target[settable.of] = settable.as;
144
- }
145
- }
146
-
147
- #anyPropertyUnsetting(target, unsettables) {
148
- // Unsetting is the same as setting,
149
- // but with tuples of original values.
150
- return this.#anyPropertySetting(target, unsettables);
151
- }
152
-
153
108
  #compare(expected, actual) {
154
109
  return this.#comparer.compare(expected, actual);
155
110
  }
@@ -104,17 +104,9 @@ export class TotalDisplayer {
104
104
  }
105
105
 
106
106
  displayObject(value) /* passed */ {
107
- // Use toString() text if it's meaningful.
108
- let asString = value.toString();
109
-
110
- if (asString !== "[object Object]") {
111
- return asString;
112
- }
113
-
114
- // If toString() not meaningful, list members.
107
+ // Each property of the object is handled individually.
115
108
  let items = [ ];
116
109
 
117
- // Each property of the object is handled individually.
118
110
  for (let p in value) {
119
111
  // Cross-recursion.
120
112
  let item = this.display(value[p]);