@everyonesoftware/common 7.0.0 → 9.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/outputs/{chunk-VF6FBNAU.js → chunk-HMQKVFIP.js} +181 -44
- package/outputs/chunk-HMQKVFIP.js.map +1 -0
- package/outputs/{chunk-MMAX3IZF.js → chunk-OYMWB5SX.js} +106 -14
- package/outputs/chunk-OYMWB5SX.js.map +1 -0
- package/outputs/sourceIndex.cjs +106 -13
- package/outputs/sourceIndex.cjs.map +1 -1
- package/outputs/sourceIndex.d.cts +45 -2
- package/outputs/sourceIndex.d.ts +45 -2
- package/outputs/sourceIndex.js +3 -1
- package/outputs/testIndex.cjs +279 -55
- package/outputs/testIndex.cjs.map +1 -1
- package/outputs/testIndex.d.cts +58 -10
- package/outputs/testIndex.d.ts +58 -10
- package/outputs/testIndex.js +2 -2
- package/outputs/tests.cjs +3549 -3003
- package/outputs/tests.cjs.map +1 -1
- package/outputs/tests.js +2716 -2389
- package/outputs/tests.js.map +1 -1
- package/package.json +1 -1
- package/outputs/chunk-MMAX3IZF.js.map +0 -1
- package/outputs/chunk-VF6FBNAU.js.map +0 -1
package/outputs/testIndex.cjs
CHANGED
|
@@ -1917,6 +1917,97 @@ var JavascriptArrayList = class _JavascriptArrayList {
|
|
|
1917
1917
|
}
|
|
1918
1918
|
};
|
|
1919
1919
|
|
|
1920
|
+
// sources/MutableIndexable.ts
|
|
1921
|
+
var MutableIndexable = class _MutableIndexable {
|
|
1922
|
+
static create(values) {
|
|
1923
|
+
return List.create(values);
|
|
1924
|
+
}
|
|
1925
|
+
toArray() {
|
|
1926
|
+
return _MutableIndexable.toArray(this);
|
|
1927
|
+
}
|
|
1928
|
+
static toArray(indexable) {
|
|
1929
|
+
return Indexable.toArray(indexable);
|
|
1930
|
+
}
|
|
1931
|
+
any() {
|
|
1932
|
+
return _MutableIndexable.any(this);
|
|
1933
|
+
}
|
|
1934
|
+
static any(indexable) {
|
|
1935
|
+
return Indexable.any(indexable);
|
|
1936
|
+
}
|
|
1937
|
+
getCount() {
|
|
1938
|
+
return _MutableIndexable.getCount(this);
|
|
1939
|
+
}
|
|
1940
|
+
static getCount(indexable) {
|
|
1941
|
+
return Indexable.getCount(indexable);
|
|
1942
|
+
}
|
|
1943
|
+
equals(right, equalFunctions) {
|
|
1944
|
+
return _MutableIndexable.equals(this, right, equalFunctions);
|
|
1945
|
+
}
|
|
1946
|
+
static equals(left, right, equalFunctions) {
|
|
1947
|
+
return Indexable.equals(left, right, equalFunctions);
|
|
1948
|
+
}
|
|
1949
|
+
toString(toStringFunctions) {
|
|
1950
|
+
return _MutableIndexable.toString(this, toStringFunctions);
|
|
1951
|
+
}
|
|
1952
|
+
static toString(indexable, toStringFunctions) {
|
|
1953
|
+
return Indexable.toString(indexable, toStringFunctions);
|
|
1954
|
+
}
|
|
1955
|
+
concatenate(...toConcatenate) {
|
|
1956
|
+
return _MutableIndexable.concatenate(this, ...toConcatenate);
|
|
1957
|
+
}
|
|
1958
|
+
static concatenate(indexable, ...toConcatenate) {
|
|
1959
|
+
return Indexable.concatenate(indexable, ...toConcatenate);
|
|
1960
|
+
}
|
|
1961
|
+
map(mapping) {
|
|
1962
|
+
return _MutableIndexable.map(this, mapping);
|
|
1963
|
+
}
|
|
1964
|
+
static map(indexable, mapping) {
|
|
1965
|
+
return Indexable.map(indexable, mapping);
|
|
1966
|
+
}
|
|
1967
|
+
flatMap(mapping) {
|
|
1968
|
+
return _MutableIndexable.flatMap(this, mapping);
|
|
1969
|
+
}
|
|
1970
|
+
static flatMap(indexable, mapping) {
|
|
1971
|
+
return Indexable.flatMap(indexable, mapping);
|
|
1972
|
+
}
|
|
1973
|
+
where(condition) {
|
|
1974
|
+
return _MutableIndexable.where(this, condition);
|
|
1975
|
+
}
|
|
1976
|
+
static where(indexable, condition) {
|
|
1977
|
+
return Indexable.where(indexable, condition);
|
|
1978
|
+
}
|
|
1979
|
+
instanceOf(typeOrTypeCheck) {
|
|
1980
|
+
return _MutableIndexable.instanceOf(this, typeOrTypeCheck);
|
|
1981
|
+
}
|
|
1982
|
+
static instanceOf(indexable, typeOrTypeCheck) {
|
|
1983
|
+
return Indexable.instanceOf(indexable, typeOrTypeCheck);
|
|
1984
|
+
}
|
|
1985
|
+
first(condition) {
|
|
1986
|
+
return _MutableIndexable.first(this, condition);
|
|
1987
|
+
}
|
|
1988
|
+
static first(indexable, condition) {
|
|
1989
|
+
return Indexable.first(indexable, condition);
|
|
1990
|
+
}
|
|
1991
|
+
last(condition) {
|
|
1992
|
+
return _MutableIndexable.last(this, condition);
|
|
1993
|
+
}
|
|
1994
|
+
static last(indexable, condition) {
|
|
1995
|
+
return Indexable.last(indexable, condition);
|
|
1996
|
+
}
|
|
1997
|
+
[Symbol.iterator]() {
|
|
1998
|
+
return Indexable[Symbol.iterator](this);
|
|
1999
|
+
}
|
|
2000
|
+
static [Symbol.iterator](indexable) {
|
|
2001
|
+
return Iterable[Symbol.iterator](indexable);
|
|
2002
|
+
}
|
|
2003
|
+
contains(value, equalFunctions) {
|
|
2004
|
+
return _MutableIndexable.contains(this, value, equalFunctions);
|
|
2005
|
+
}
|
|
2006
|
+
static contains(indexable, value, equalFunctions) {
|
|
2007
|
+
return Indexable.contains(indexable, value, equalFunctions);
|
|
2008
|
+
}
|
|
2009
|
+
};
|
|
2010
|
+
|
|
1920
2011
|
// sources/javascript.ts
|
|
1921
2012
|
var JavascriptMap = Map;
|
|
1922
2013
|
var JavascriptSet = Set;
|
|
@@ -2764,73 +2855,73 @@ var List = class _List {
|
|
|
2764
2855
|
return _List.toArray(this);
|
|
2765
2856
|
}
|
|
2766
2857
|
static toArray(list2) {
|
|
2767
|
-
return
|
|
2858
|
+
return MutableIndexable.toArray(list2);
|
|
2768
2859
|
}
|
|
2769
2860
|
any() {
|
|
2770
2861
|
return _List.any(this);
|
|
2771
2862
|
}
|
|
2772
2863
|
static any(list2) {
|
|
2773
|
-
return
|
|
2864
|
+
return MutableIndexable.any(list2);
|
|
2774
2865
|
}
|
|
2775
2866
|
getCount() {
|
|
2776
2867
|
return _List.getCount(this);
|
|
2777
2868
|
}
|
|
2778
2869
|
static getCount(list2) {
|
|
2779
|
-
return
|
|
2870
|
+
return MutableIndexable.getCount(list2);
|
|
2780
2871
|
}
|
|
2781
2872
|
equals(right, equalFunctions) {
|
|
2782
2873
|
return _List.equals(this, right, equalFunctions);
|
|
2783
2874
|
}
|
|
2784
2875
|
static equals(left, right, equalFunctions) {
|
|
2785
|
-
return
|
|
2876
|
+
return MutableIndexable.equals(left, right, equalFunctions);
|
|
2786
2877
|
}
|
|
2787
2878
|
toString(toStringFunctions) {
|
|
2788
2879
|
return _List.toString(this, toStringFunctions);
|
|
2789
2880
|
}
|
|
2790
2881
|
static toString(list2, toStringFunctions) {
|
|
2791
|
-
return
|
|
2882
|
+
return MutableIndexable.toString(list2, toStringFunctions);
|
|
2792
2883
|
}
|
|
2793
2884
|
concatenate(...toConcatenate) {
|
|
2794
2885
|
return _List.concatenate(this, ...toConcatenate);
|
|
2795
2886
|
}
|
|
2796
2887
|
static concatenate(list2, ...toConcatenate) {
|
|
2797
|
-
return
|
|
2888
|
+
return MutableIndexable.concatenate(list2, ...toConcatenate);
|
|
2798
2889
|
}
|
|
2799
2890
|
map(mapping) {
|
|
2800
2891
|
return _List.map(this, mapping);
|
|
2801
2892
|
}
|
|
2802
2893
|
static map(list2, mapping) {
|
|
2803
|
-
return
|
|
2894
|
+
return MutableIndexable.map(list2, mapping);
|
|
2804
2895
|
}
|
|
2805
2896
|
flatMap(mapping) {
|
|
2806
2897
|
return _List.flatMap(this, mapping);
|
|
2807
2898
|
}
|
|
2808
2899
|
static flatMap(list2, mapping) {
|
|
2809
|
-
return
|
|
2900
|
+
return MutableIndexable.flatMap(list2, mapping);
|
|
2810
2901
|
}
|
|
2811
2902
|
where(condition) {
|
|
2812
2903
|
return _List.where(this, condition);
|
|
2813
2904
|
}
|
|
2814
2905
|
static where(list2, condition) {
|
|
2815
|
-
return
|
|
2906
|
+
return MutableIndexable.where(list2, condition);
|
|
2816
2907
|
}
|
|
2817
2908
|
instanceOf(typeOrTypeCheck) {
|
|
2818
2909
|
return _List.instanceOf(this, typeOrTypeCheck);
|
|
2819
2910
|
}
|
|
2820
2911
|
static instanceOf(list2, typeOrTypeCheck) {
|
|
2821
|
-
return
|
|
2912
|
+
return MutableIndexable.instanceOf(list2, typeOrTypeCheck);
|
|
2822
2913
|
}
|
|
2823
2914
|
first(condition) {
|
|
2824
2915
|
return _List.first(this, condition);
|
|
2825
2916
|
}
|
|
2826
2917
|
static first(list2, condition) {
|
|
2827
|
-
return
|
|
2918
|
+
return MutableIndexable.first(list2, condition);
|
|
2828
2919
|
}
|
|
2829
2920
|
last(condition) {
|
|
2830
2921
|
return _List.last(this, condition);
|
|
2831
2922
|
}
|
|
2832
2923
|
static last(list2, condition) {
|
|
2833
|
-
return
|
|
2924
|
+
return MutableIndexable.last(list2, condition);
|
|
2834
2925
|
}
|
|
2835
2926
|
[Symbol.iterator]() {
|
|
2836
2927
|
return _List[Symbol.iterator](this);
|
|
@@ -2842,7 +2933,7 @@ var List = class _List {
|
|
|
2842
2933
|
return _List.contains(this, value, equalFunctions);
|
|
2843
2934
|
}
|
|
2844
2935
|
static contains(list2, value, equalFunctions) {
|
|
2845
|
-
return
|
|
2936
|
+
return MutableIndexable.contains(list2, value, equalFunctions);
|
|
2846
2937
|
}
|
|
2847
2938
|
};
|
|
2848
2939
|
|
|
@@ -5632,15 +5723,13 @@ var Test = class _Test {
|
|
|
5632
5723
|
|
|
5633
5724
|
// tests/assertTest.ts
|
|
5634
5725
|
var AssertTest = class _AssertTest {
|
|
5635
|
-
|
|
5636
|
-
constructor(name) {
|
|
5637
|
-
this.name = name;
|
|
5726
|
+
constructor() {
|
|
5638
5727
|
}
|
|
5639
5728
|
/**
|
|
5640
5729
|
* Create a new {@link AssertTest} object.
|
|
5641
5730
|
*/
|
|
5642
|
-
static create(
|
|
5643
|
-
return new _AssertTest(
|
|
5731
|
+
static create() {
|
|
5732
|
+
return new _AssertTest();
|
|
5644
5733
|
}
|
|
5645
5734
|
fail(message) {
|
|
5646
5735
|
PreCondition.assertNotEmpty(message, "message");
|
|
@@ -5707,13 +5796,13 @@ function test(runner) {
|
|
|
5707
5796
|
runner.testType("AssertTest", () => {
|
|
5708
5797
|
runner.testFunction("assertThrows()", () => {
|
|
5709
5798
|
runner.test("with throwing action", (test2) => {
|
|
5710
|
-
const at = AssertTest.create(
|
|
5799
|
+
const at = AssertTest.create();
|
|
5711
5800
|
at.assertThrows(() => {
|
|
5712
5801
|
throw new Error("abc");
|
|
5713
5802
|
}, new Error("abc"));
|
|
5714
5803
|
});
|
|
5715
5804
|
runner.test("with non-throwing action", (test2) => {
|
|
5716
|
-
const at = AssertTest.create(
|
|
5805
|
+
const at = AssertTest.create();
|
|
5717
5806
|
test2.assertThrows(
|
|
5718
5807
|
() => at.assertThrows(() => {
|
|
5719
5808
|
}, new Error("oops")),
|
|
@@ -5727,27 +5816,27 @@ function test(runner) {
|
|
|
5727
5816
|
});
|
|
5728
5817
|
runner.testFunction("assertThrowsAsync()", () => {
|
|
5729
5818
|
runner.test("with throwing sync action", async (test2) => {
|
|
5730
|
-
const at = AssertTest.create(
|
|
5819
|
+
const at = AssertTest.create();
|
|
5731
5820
|
await at.assertThrowsAsync(() => {
|
|
5732
5821
|
throw new Error("abc");
|
|
5733
5822
|
}, new Error("abc"));
|
|
5734
5823
|
});
|
|
5735
5824
|
runner.test("with throwing async action", async (test2) => {
|
|
5736
|
-
const at = AssertTest.create(
|
|
5825
|
+
const at = AssertTest.create();
|
|
5737
5826
|
await at.assertThrowsAsync(async () => {
|
|
5738
5827
|
throw new Error("abc");
|
|
5739
5828
|
}, new Error("abc"));
|
|
5740
5829
|
});
|
|
5741
5830
|
runner.test("with rejected Promise", async (test2) => {
|
|
5742
|
-
const at = AssertTest.create(
|
|
5831
|
+
const at = AssertTest.create();
|
|
5743
5832
|
await at.assertThrowsAsync(Promise.reject(new Error("abc")), new Error("abc"));
|
|
5744
5833
|
});
|
|
5745
5834
|
runner.test("with throwing action that returns a rejected Promise", async (test2) => {
|
|
5746
|
-
const at = AssertTest.create(
|
|
5835
|
+
const at = AssertTest.create();
|
|
5747
5836
|
await at.assertThrowsAsync(() => Promise.reject(new Error("abc")), new Error("abc"));
|
|
5748
5837
|
});
|
|
5749
5838
|
runner.test("with non-throwing async action", async (test2) => {
|
|
5750
|
-
const at = AssertTest.create(
|
|
5839
|
+
const at = AssertTest.create();
|
|
5751
5840
|
await test2.assertThrowsAsync(
|
|
5752
5841
|
async () => await at.assertThrowsAsync(async () => {
|
|
5753
5842
|
}, new Error("oops")),
|
|
@@ -5812,12 +5901,9 @@ var FailedTest = class _FailedTest {
|
|
|
5812
5901
|
getTestAction() {
|
|
5813
5902
|
return this.testAction;
|
|
5814
5903
|
}
|
|
5815
|
-
|
|
5904
|
+
getTestError() {
|
|
5816
5905
|
return this.error;
|
|
5817
5906
|
}
|
|
5818
|
-
getErrorMessage() {
|
|
5819
|
-
return this.error instanceof Error && this.error.stack ? this.error.stack : `${this.error}`;
|
|
5820
|
-
}
|
|
5821
5907
|
};
|
|
5822
5908
|
|
|
5823
5909
|
// tests/skippedTest.ts
|
|
@@ -5970,6 +6056,7 @@ var TestRunner = class _TestRunner {
|
|
|
5970
6056
|
var ConsoleTestRunnerUI = class {
|
|
5971
6057
|
writeStream;
|
|
5972
6058
|
styles;
|
|
6059
|
+
getErrorStringOptions;
|
|
5973
6060
|
constructor() {
|
|
5974
6061
|
this.styles = Map2.create();
|
|
5975
6062
|
}
|
|
@@ -6042,6 +6129,10 @@ var ConsoleTestRunnerUI = class {
|
|
|
6042
6129
|
return result;
|
|
6043
6130
|
});
|
|
6044
6131
|
}
|
|
6132
|
+
setGetErrorStringOptions(options) {
|
|
6133
|
+
this.getErrorStringOptions = options;
|
|
6134
|
+
return this;
|
|
6135
|
+
}
|
|
6045
6136
|
beforeTestGroup(testGroup) {
|
|
6046
6137
|
PreCondition.assertNotUndefinedAndNotNull(testGroup, "testGroup");
|
|
6047
6138
|
return AsyncResult.empty();
|
|
@@ -6099,7 +6190,8 @@ var ConsoleTestRunnerUI = class {
|
|
|
6099
6190
|
await this.writeString(`${++counter}) `);
|
|
6100
6191
|
await this.writeFullTestActionName(failedTest.getTestAction());
|
|
6101
6192
|
await this.writeLine();
|
|
6102
|
-
|
|
6193
|
+
const testError = failedTest.getTestError();
|
|
6194
|
+
await this.indent(() => this.writeLine(testError.getErrorString(this.getErrorStringOptions)));
|
|
6103
6195
|
await this.writeLine();
|
|
6104
6196
|
}
|
|
6105
6197
|
}
|
|
@@ -6172,6 +6264,132 @@ var TreeConsoleTestRunnerUI = class _TreeConsoleTestRunnerUI extends ConsoleTest
|
|
|
6172
6264
|
}
|
|
6173
6265
|
};
|
|
6174
6266
|
|
|
6267
|
+
// tests/AssertTestCreator.ts
|
|
6268
|
+
var AssertTestCreator = class _AssertTestCreator {
|
|
6269
|
+
constructor() {
|
|
6270
|
+
}
|
|
6271
|
+
static create() {
|
|
6272
|
+
return new _AssertTestCreator();
|
|
6273
|
+
}
|
|
6274
|
+
createTest() {
|
|
6275
|
+
return AssertTest.create();
|
|
6276
|
+
}
|
|
6277
|
+
};
|
|
6278
|
+
|
|
6279
|
+
// tests/TestCreator.ts
|
|
6280
|
+
var TestCreator = class {
|
|
6281
|
+
/**
|
|
6282
|
+
* Create the default {@link TestCreator}.
|
|
6283
|
+
*/
|
|
6284
|
+
static create() {
|
|
6285
|
+
return AssertTestCreator.create();
|
|
6286
|
+
}
|
|
6287
|
+
};
|
|
6288
|
+
|
|
6289
|
+
// tests/BasicTestError.ts
|
|
6290
|
+
var import_url = require("url");
|
|
6291
|
+
var import_path = __toESM(require("path"), 1);
|
|
6292
|
+
var BasicTestError = class _BasicTestError {
|
|
6293
|
+
error;
|
|
6294
|
+
constructor(error) {
|
|
6295
|
+
PreCondition.assertNotUndefinedAndNotNull(error, "error");
|
|
6296
|
+
this.error = error;
|
|
6297
|
+
}
|
|
6298
|
+
static create(error) {
|
|
6299
|
+
return new _BasicTestError(error);
|
|
6300
|
+
}
|
|
6301
|
+
getError() {
|
|
6302
|
+
return this.error;
|
|
6303
|
+
}
|
|
6304
|
+
getErrorString(options) {
|
|
6305
|
+
let result = this.error instanceof Error && this.error.stack ? this.error.stack : `${this.error}`;
|
|
6306
|
+
const currentFolderPath = process.cwd();
|
|
6307
|
+
if (options?.removeNonProjectPaths ?? false) {
|
|
6308
|
+
result = _BasicTestError.removeNonProjectPaths(result, currentFolderPath);
|
|
6309
|
+
}
|
|
6310
|
+
if (options?.relativeFilePaths ?? false) {
|
|
6311
|
+
result = _BasicTestError.makeFilePathsRelative(result, currentFolderPath);
|
|
6312
|
+
}
|
|
6313
|
+
return result;
|
|
6314
|
+
}
|
|
6315
|
+
static getStackFrameLineMatch(line) {
|
|
6316
|
+
return line.match(/^(\s*)at (.*) \((.+)\)$/) ?? line.match(/^(\s*)at (.+)$/);
|
|
6317
|
+
}
|
|
6318
|
+
static normalizePath(path2) {
|
|
6319
|
+
return path2.replace(/\\/g, "/");
|
|
6320
|
+
}
|
|
6321
|
+
static getStackFrameAbsolutePath(stackFrameLocation) {
|
|
6322
|
+
let result = _BasicTestError.normalizePath(stackFrameLocation);
|
|
6323
|
+
if (result.startsWith("file:///")) {
|
|
6324
|
+
result = _BasicTestError.normalizePath((0, import_url.fileURLToPath)(result));
|
|
6325
|
+
} else if (!/^[A-Za-z]:[\\/]/.test(result) && !result.startsWith("/")) {
|
|
6326
|
+
result = void 0;
|
|
6327
|
+
}
|
|
6328
|
+
return result;
|
|
6329
|
+
}
|
|
6330
|
+
static removeNonProjectPaths(errorString, currentFolderPath) {
|
|
6331
|
+
currentFolderPath = _BasicTestError.normalizePath(currentFolderPath);
|
|
6332
|
+
return errorString.split("\n").filter((line) => {
|
|
6333
|
+
let keepLine = true;
|
|
6334
|
+
const stackFrameLineMatch = _BasicTestError.getStackFrameLineMatch(line);
|
|
6335
|
+
if (stackFrameLineMatch) {
|
|
6336
|
+
const hasFunctionName = stackFrameLineMatch.length === 4;
|
|
6337
|
+
const location = hasFunctionName ? stackFrameLineMatch[3] : stackFrameLineMatch[2];
|
|
6338
|
+
const filePath = _BasicTestError.getStackFrameAbsolutePath(location);
|
|
6339
|
+
keepLine = !!filePath && filePath.startsWith(currentFolderPath) && !filePath.includes("/node_modules/");
|
|
6340
|
+
}
|
|
6341
|
+
return keepLine;
|
|
6342
|
+
}).join("\n");
|
|
6343
|
+
}
|
|
6344
|
+
static makeFilePathsRelative(errorString, currentFolderPath) {
|
|
6345
|
+
return errorString.split("\n").map((line) => {
|
|
6346
|
+
const stackFrameLineMatch = _BasicTestError.getStackFrameLineMatch(line);
|
|
6347
|
+
if (stackFrameLineMatch) {
|
|
6348
|
+
const hasFunctionName = stackFrameLineMatch.length === 4;
|
|
6349
|
+
const indentation = stackFrameLineMatch[1];
|
|
6350
|
+
const functionName = hasFunctionName ? stackFrameLineMatch[2] : void 0;
|
|
6351
|
+
const location = hasFunctionName ? stackFrameLineMatch[3] : stackFrameLineMatch[2];
|
|
6352
|
+
let relativeLocation = location;
|
|
6353
|
+
const pathMatch = location.match(/^(.*?):(\d+):(\d+)$/);
|
|
6354
|
+
if (pathMatch) {
|
|
6355
|
+
const absolutePath = _BasicTestError.getStackFrameAbsolutePath(location);
|
|
6356
|
+
if (absolutePath) {
|
|
6357
|
+
const relativePath = import_path.default.relative(currentFolderPath, absolutePath);
|
|
6358
|
+
relativeLocation = _BasicTestError.normalizePath(relativePath);
|
|
6359
|
+
}
|
|
6360
|
+
}
|
|
6361
|
+
if (relativeLocation !== location) {
|
|
6362
|
+
if (functionName) {
|
|
6363
|
+
line = `${indentation}at ${functionName} (${relativeLocation})`;
|
|
6364
|
+
} else {
|
|
6365
|
+
line = `${indentation}at ${relativeLocation}`;
|
|
6366
|
+
}
|
|
6367
|
+
}
|
|
6368
|
+
}
|
|
6369
|
+
return line;
|
|
6370
|
+
}).join("\n");
|
|
6371
|
+
}
|
|
6372
|
+
};
|
|
6373
|
+
|
|
6374
|
+
// tests/BasicTestErrorCreator.ts
|
|
6375
|
+
var BasicTestErrorCreator = class _BasicTestErrorCreator {
|
|
6376
|
+
constructor() {
|
|
6377
|
+
}
|
|
6378
|
+
static create() {
|
|
6379
|
+
return new _BasicTestErrorCreator();
|
|
6380
|
+
}
|
|
6381
|
+
createTestError(error) {
|
|
6382
|
+
return BasicTestError.create(error);
|
|
6383
|
+
}
|
|
6384
|
+
};
|
|
6385
|
+
|
|
6386
|
+
// tests/TestErrorCreator.ts
|
|
6387
|
+
var TestErrorCreator = class {
|
|
6388
|
+
static create() {
|
|
6389
|
+
return BasicTestErrorCreator.create();
|
|
6390
|
+
}
|
|
6391
|
+
};
|
|
6392
|
+
|
|
6175
6393
|
// tests/consoleTestRunner.ts
|
|
6176
6394
|
var ConsoleTestRunner = class _ConsoleTestRunner {
|
|
6177
6395
|
writeStream;
|
|
@@ -6182,19 +6400,23 @@ var ConsoleTestRunner = class _ConsoleTestRunner {
|
|
|
6182
6400
|
passedTestCount;
|
|
6183
6401
|
skippedTests;
|
|
6184
6402
|
testFailures;
|
|
6403
|
+
testCreator;
|
|
6404
|
+
testErrorCreator;
|
|
6185
6405
|
ui;
|
|
6186
|
-
constructor(ui) {
|
|
6406
|
+
constructor(testCreator, testErrorCreator, ui) {
|
|
6187
6407
|
this.writeStream = IndentedCharacterWriteStream.create(NodeJSCharacterWriteStream.create(process.stdout));
|
|
6188
6408
|
this.testActions = List.create();
|
|
6189
6409
|
this.testActionInsertIndex = 0;
|
|
6190
6410
|
this.passedTestCount = 0;
|
|
6191
6411
|
this.skippedTests = List.create();
|
|
6192
6412
|
this.testFailures = List.create();
|
|
6413
|
+
this.testCreator = testCreator || TestCreator.create();
|
|
6414
|
+
this.testErrorCreator = testErrorCreator || TestErrorCreator.create();
|
|
6193
6415
|
this.ui = ui || ConsoleTestRunnerUI.tree();
|
|
6194
6416
|
this.ui.setWriteStream(this.writeStream);
|
|
6195
6417
|
}
|
|
6196
|
-
static create(ui) {
|
|
6197
|
-
return new _ConsoleTestRunner(ui);
|
|
6418
|
+
static create(testCreator, testErrorCreator, ui) {
|
|
6419
|
+
return new _ConsoleTestRunner(testCreator, testErrorCreator, ui);
|
|
6198
6420
|
}
|
|
6199
6421
|
static run(testFunctionOrTestFunctions) {
|
|
6200
6422
|
let testFunction;
|
|
@@ -6243,6 +6465,10 @@ var ConsoleTestRunner = class _ConsoleTestRunner {
|
|
|
6243
6465
|
this.ui.setStyles(styles);
|
|
6244
6466
|
return this;
|
|
6245
6467
|
}
|
|
6468
|
+
setGetErrorStringOptions(options) {
|
|
6469
|
+
this.ui.setGetErrorStringOptions(options);
|
|
6470
|
+
return this;
|
|
6471
|
+
}
|
|
6246
6472
|
/**
|
|
6247
6473
|
* Get the number of {@link TestAction}s that have yet to be executed.
|
|
6248
6474
|
*/
|
|
@@ -6261,7 +6487,14 @@ var ConsoleTestRunner = class _ConsoleTestRunner {
|
|
|
6261
6487
|
}
|
|
6262
6488
|
insertTestAction(testActionName, testActionType, skip, action) {
|
|
6263
6489
|
const parentTestAction = this.getCurrentTestAction();
|
|
6264
|
-
const testAction = TestAction.create(parentTestAction, testActionName, testActionType, skip,
|
|
6490
|
+
const testAction = TestAction.create(parentTestAction, testActionName, testActionType, skip, async () => {
|
|
6491
|
+
try {
|
|
6492
|
+
await action();
|
|
6493
|
+
} catch (error) {
|
|
6494
|
+
const testError = this.testErrorCreator.createTestError(error);
|
|
6495
|
+
await this.afterFailedTest(testAction, testError);
|
|
6496
|
+
}
|
|
6497
|
+
});
|
|
6265
6498
|
this.testActions.insert(this.testActionInsertIndex, testAction);
|
|
6266
6499
|
this.testActionInsertIndex++;
|
|
6267
6500
|
}
|
|
@@ -6438,12 +6671,7 @@ var ConsoleTestRunner = class _ConsoleTestRunner {
|
|
|
6438
6671
|
skip,
|
|
6439
6672
|
async () => {
|
|
6440
6673
|
this.resetTestActionInsertIndex();
|
|
6441
|
-
|
|
6442
|
-
await testGroupAction();
|
|
6443
|
-
} catch (error) {
|
|
6444
|
-
const currentTestGroupAction = this.getCurrentTestAction();
|
|
6445
|
-
await this.afterFailedTest(currentTestGroupAction, error);
|
|
6446
|
-
}
|
|
6674
|
+
await testGroupAction();
|
|
6447
6675
|
}
|
|
6448
6676
|
);
|
|
6449
6677
|
this.insertTestAction(
|
|
@@ -6463,22 +6691,18 @@ var ConsoleTestRunner = class _ConsoleTestRunner {
|
|
|
6463
6691
|
skip,
|
|
6464
6692
|
async () => {
|
|
6465
6693
|
const currentTestAction = this.getCurrentTestAction();
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
this.currentTest = void 0;
|
|
6477
|
-
}
|
|
6478
|
-
await this.afterPassedTest(currentTestAction);
|
|
6694
|
+
await this.beforeTest(currentTestAction);
|
|
6695
|
+
const skip2 = currentTestAction.getSkip();
|
|
6696
|
+
if (skip2?.getShouldSkip()) {
|
|
6697
|
+
await this.afterSkippedTest(currentTestAction, skip2);
|
|
6698
|
+
} else {
|
|
6699
|
+
this.currentTest = this.testCreator.createTest();
|
|
6700
|
+
try {
|
|
6701
|
+
await testAction(this.currentTest);
|
|
6702
|
+
} finally {
|
|
6703
|
+
this.currentTest = void 0;
|
|
6479
6704
|
}
|
|
6480
|
-
|
|
6481
|
-
await this.afterFailedTest(currentTestAction, error);
|
|
6705
|
+
await this.afterPassedTest(currentTestAction);
|
|
6482
6706
|
}
|
|
6483
6707
|
}
|
|
6484
6708
|
);
|