@fncts/test 0.0.30 → 0.0.32
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/_cjs/api.cjs +1 -1
- package/_cjs/api.cjs.map +1 -1
- package/_cjs/control/AbstractRunnableSpec.cjs +79 -5
- package/_cjs/control/AbstractRunnableSpec.cjs.map +1 -1
- package/_cjs/control/Annotations/definition.cjs +11 -3
- package/_cjs/control/Annotations/definition.cjs.map +1 -1
- package/_cjs/control/DefaultRunnableSpec.cjs +3 -6
- package/_cjs/control/DefaultRunnableSpec.cjs.map +1 -1
- package/_cjs/control/Gen/api.cjs +51 -30
- package/_cjs/control/Gen/api.cjs.map +1 -1
- package/_cjs/control/Live/definition.cjs.map +1 -1
- package/_cjs/data/TestAnnotationMap.cjs.map +1 -1
- package/_cjs/demo.cjs +3 -1
- package/_cjs/demo.cjs.map +1 -1
- package/_mjs/api.mjs +1 -1
- package/_mjs/api.mjs.map +1 -1
- package/_mjs/control/AbstractRunnableSpec.mjs +78 -5
- package/_mjs/control/AbstractRunnableSpec.mjs.map +1 -1
- package/_mjs/control/Annotations/definition.mjs +8 -1
- package/_mjs/control/Annotations/definition.mjs.map +1 -1
- package/_mjs/control/DefaultRunnableSpec.mjs +3 -6
- package/_mjs/control/DefaultRunnableSpec.mjs.map +1 -1
- package/_mjs/control/Gen/api.mjs +47 -28
- package/_mjs/control/Gen/api.mjs.map +1 -1
- package/_mjs/control/Live/definition.mjs +2 -1
- package/_mjs/control/Live/definition.mjs.map +1 -1
- package/_mjs/data/TestAnnotationMap.mjs +2 -1
- package/_mjs/data/TestAnnotationMap.mjs.map +1 -1
- package/_mjs/demo.mjs +3 -1
- package/_mjs/demo.mjs.map +1 -1
- package/_src/api.ts +1 -1
- package/_src/control/AbstractRunnableSpec.ts +93 -11
- package/_src/control/Annotations/definition.ts +4 -0
- package/_src/control/DefaultRunnableSpec.ts +3 -7
- package/_src/control/Gen/api.ts +35 -6
- package/_src/demo.ts +4 -2
- package/control/AbstractRunnableSpec.d.ts +22 -9
- package/control/Annotations/definition.d.ts +3 -0
- package/control/DefaultRunnableSpec.d.ts +4 -4
- package/control/Gen/api.d.ts +24 -0
- package/package.json +3 -3
- package/_cjs/control/RunnableSpec.cjs +0 -52
- package/_cjs/control/RunnableSpec.cjs.map +0 -1
- package/_cjs/control/TestExecutor.cjs +0 -44
- package/_cjs/control/TestExecutor.cjs.map +0 -1
- package/_cjs/control/TestRunner.cjs +0 -28
- package/_cjs/control/TestRunner.cjs.map +0 -1
- package/_mjs/control/RunnableSpec.mjs +0 -42
- package/_mjs/control/RunnableSpec.mjs.map +0 -1
- package/_mjs/control/TestExecutor.mjs +0 -36
- package/_mjs/control/TestExecutor.mjs.map +0 -1
- package/_mjs/control/TestRunner.mjs +0 -19
- package/_mjs/control/TestRunner.mjs.map +0 -1
- package/_src/control/RunnableSpec.ts +0 -47
- package/_src/control/TestExecutor.ts +0 -52
- package/_src/control/TestRunner.ts +0 -31
- package/control/RunnableSpec.d.ts +0 -11
- package/control/TestExecutor.d.ts +0 -12
- package/control/TestRunner.d.ts +0 -17
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"definition.mjs","mappings":";;;;;;;;AAEA;;;AAGO,MAAMA,yBAAUC,wBAAU,iBAAiB,CAAC;aAAtCC,OAAO;AAEpB;;;AAGA,
|
1
|
+
{"version":3,"file":"definition.mjs","mappings":";;;;;;;;AAEA;;;AAGO,MAAMA,yBAAUC,wBAAU,iBAAiB,CAAC;aAAtCC,OAAO;AAEpB;;;AAGA,MAAsBC,IAAI;EAaxB,OAAOA,IAAI,CAAuBC,EAAe;IAC/C,OAAOC,8BAAkBC,IAAI,IAAKA,IAAI,CAACC,OAAO,CAACH,EAAE,CAAC,mCAAU;EAC9D;;AAbOD,YAAO,gBAA8BK,qCAC1CH,gCACGI,GAAG,IACF,IAAK,cAAcN,IAAI;EACrBI,OAAO,CAAUH,EAAe;IAC9B,OAAOM,sDAA4BC,CAAC,IAAKC,sBAAQH,GAAG,EAAXE,CAAC,CAAW,wBAAC,CAACP,EAAE,CAAC;EAC5D;CACD,EAAG,wBACP,mCAEF;SAZmBD,IAAI;AAkB1B;;;AAGA,OAAM,SAAUU,SAAS,CACvBT,EAAe,EACfU,CAA2C;EAE3C;EACA,OAAOC,wBAAoCC,CAAC,IAAKb,IAAI,CAACA,IAAI,CAACW,CAAC,CAACT,mCAAsBW,CAAC,yBAAvBZ,EAAE,CAAsB,CAAC,CAAC,yBAAhFC,kDAA0B,CAAuD;AAC1F;AAEA,OAAM,SAAUY,QAAQ,CAAuBb,EAAe;EAC5D,OAAeU,CAAmC,IAChDJ,wBAAwBQ,QAAQ,IAAKf,IAAI,CAACA,IAAI,CAACW,CAAC,CAACJ,kDAAuBQ,QAAQ,wBAAC,CAACd,EAAE,CAAC,CAAC,CAAC,kDAAC;AAC5F","names":["LiveTag_1","tsplus_module_1","LiveTag","Live","io","tsplus_module_5","live","provide","tsplus_module_6","env","tsplus_module_4","_","tsplus_module_2","withLive_","f","tsplus_module_7","r","withLive","services"],"sourceRoot":"","sources":["../../../_src/control/Live/definition.ts"],"sourcesContent":[null]}
|
@@ -3,7 +3,7 @@ import * as tsplus_module_2 from "@fncts/base/data/Maybe/destructors";
|
|
3
3
|
import * as tsplus_module_3 from "@fncts/base/collection/immutable/Conc/constructors";
|
4
4
|
import * as tsplus_module_4 from "@fncts/base/collection/immutable/Conc/api";
|
5
5
|
import { identity } from "@fncts/base/data/function";
|
6
|
-
|
6
|
+
class TestAnnotationMap {
|
7
7
|
constructor(map) {
|
8
8
|
this.map = map;
|
9
9
|
}
|
@@ -24,4 +24,5 @@ export class TestAnnotationMap {
|
|
24
24
|
}
|
25
25
|
}
|
26
26
|
TestAnnotationMap.empty = /*#__PURE__*/new TestAnnotationMap( /*#__PURE__*/tsplus_module_1.empty());
|
27
|
+
export { TestAnnotationMap };
|
27
28
|
//# sourceMappingURL=TestAnnotationMap.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TestAnnotationMap.mjs","mappings":";;;;AAEA,SAASA,QAAQ,QAAQ,2BAA2B;AAEpD,
|
1
|
+
{"version":3,"file":"TestAnnotationMap.mjs","mappings":";;;;AAEA,SAASA,QAAQ,QAAQ,2BAA2B;AAEpD,MAAaC,iBAAiB;EAC5BC,YAA6BC,GAAsC;IAAtC,QAAG,GAAHA,GAAG;EAAsC;EACtEC,OAAO,CAACC,IAAuB;IAC7B,OAAO,IAAIJ,iBAAiB,CAC1BK,yBAEYC,uBAAe,EAAE,CAACC,GAAG,EAAE,CAACC,CAAC,EAAEC,CAAC,CAAC,KACrCH,oBACEE,CAAC,EACDE,sBACE,MAAMD,CAAC,EACNE,CAAC,IAAKH,CAAC,CAACL,OAAO,CAACQ,CAAC,EAAEF,CAAC,CAAC,EAFxBH,oBAAQE,CAAC,EAATD,GAAG,CAAO,CAGT,EALHA,GAAG,CAMF,EATLF,uBACUO,qBAAUR,IAAI,CAACF,GAAG,CAAC,EAD7BU,qBAAU,IAAI,CAACV,GAAG,CAAC,CACW,CAS3B,CACJ;EACH;EACAW,GAAG,CAAIC,GAAsB;IAC3B,OAAOJ,sBAAwB,MAAMI,GAAG,CAACC,OAAO,EAAEhB,QAAQ,EAAnDO,oBAAaQ,GAAG,EAAhB,IAAI,CAACZ,GAAG,CAAS,CAAmC;EAC7D;EACQc,SAAS,CAAIF,GAAsB,EAAEG,KAAQ;IACnD,OAAO,IAAIjB,iBAAiB,CAACM,oBAAaQ,GAAG,EAAEG,KAAK,EAAvB,IAAI,CAACf,GAAG,CAAgB,CAAC;EACxD;EACQgB,MAAM,CAAIJ,GAAsB,EAAEK,CAAc;IACtD,OAAO,IAAI,CAACH,SAAS,CAACF,GAAG,EAAEK,CAAC,CAAC,IAAI,CAACN,GAAG,CAACC,GAAG,CAAC,CAAC,CAAC;EAC9C;EACAM,QAAQ,CAAIN,GAAsB,EAAEG,KAAQ;IAC1C,OAAO,IAAI,CAACC,MAAM,CAACJ,GAAG,EAAGH,CAAC,IAAKG,GAAG,CAACX,OAAO,CAACQ,CAAC,EAAEM,KAAK,CAAC,CAAC;EACvD;;AACOjB,uBAAK,gBAAsB,IAAIA,iBAAiB,eAACM,uBAAe,CAAC;SA7B7DN,iBAAiB","names":["identity","TestAnnotationMap","constructor","map","combine","that","tsplus_module_4","tsplus_module_1","acc","k","v","tsplus_module_2","_","tsplus_module_3","get","key","initial","overwrite","value","update","f","annotate"],"sourceRoot":"","sources":["../../_src/data/TestAnnotationMap.ts"],"sourcesContent":[null]}
|
package/_mjs/demo.mjs
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
const fileName_1 = "(@fncts/test) src/demo.ts";
|
1
2
|
import * as tsplus_module_1 from "@fncts/base/data/Tag/constructors";
|
2
3
|
import * as tsplus_module_2 from "@fncts/test/api";
|
4
|
+
import * as tsplus_module_3 from "@fncts/io/IO/runtime";
|
3
5
|
import { DefaultRunnableSpec } from "@fncts/test/control/DefaultRunnableSpec";
|
4
6
|
import { suite, test } from "./api.mjs";
|
5
7
|
import { strictEqualTo } from "./control/Assertion.mjs";
|
@@ -26,5 +28,5 @@ class DemoSpec extends DefaultRunnableSpec {
|
|
26
28
|
})));
|
27
29
|
}
|
28
30
|
}
|
29
|
-
new DemoSpec().
|
31
|
+
tsplus_module_3.unsafeRunAsync(new DemoSpec().run(fileName_1 + ":17:19"), fileName_1 + ":17:36");
|
30
32
|
//# sourceMappingURL=demo.mjs.map
|
package/_mjs/demo.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"demo.mjs","mappings":"
|
1
|
+
{"version":3,"file":"demo.mjs","mappings":";;;;AAAA,SAASA,mBAAmB,QAAQ,yCAAyC;AAE7E,SAASC,KAAK,EAAEC,IAAI,QAAQ,WAAU;AACtC,SAASC,aAAa,QAAQ,yBAAwB;AAEtD,MAAMC,WAAW,gBAAGC,wBAEjB,0BAA0B,CAAC;AAE9B,MAAMC,QAAS,SAAQN,mBAAmB;EAA1CO;;IACE,SAAI,GAAGN,KAAK,CACV,WAAW,EACXC,IAAI,CAAC,cAAc,QAAEM,uBAAWL,aAAa,CAAC,CAAC,CAAC,EAA1B,CAAC,CAA0B,CAAC,EAClDD,IAAI,CAAC,cAAc,QAAEM,uBAAuCL,aAAa,CAAC;MAAEM,CAAC,EAAE;QAAEC,CAAC,EAAE;UAAEC,CAAC,EAAE;YAAEC,CAAC,EAAE;UAAC;QAAE;MAAE;IAAE,CAAE,CAAC,EAAnF;MAAEH,CAAC,EAAE;QAAEC,CAAC,EAAE;UAAEC,CAAC,EAAE;YAAEC,CAAC,EAAE;UAAG;QAAE;MAAE;IAAE,CAAE,CAAqD,CAAC,CAC3G;EACH;;AACAC,mCAAIP,QAAQ,EAAE,CAACQ,GAAG,uBAAE,wBAAiB","names":["DefaultRunnableSpec","suite","test","strictEqualTo","ServiceATag","tsplus_module_1","DemoSpec","constructor","tsplus_module_2","a","b","c","d","tsplus_module_3","run"],"sourceRoot":"","sources":["../_src/demo.ts"],"sourcesContent":[null]}
|
package/_src/api.ts
CHANGED
@@ -132,7 +132,7 @@ function checkStreamC<R, E, A, R1>(
|
|
132
132
|
return TestConfig.shrinks.flatMap((shrinks) =>
|
133
133
|
shrinkStream(
|
134
134
|
stream.zipWithIndex
|
135
|
-
.
|
135
|
+
.mapIOConcurrently(concurrency, ([initial, index]) =>
|
136
136
|
initial
|
137
137
|
.foreach(
|
138
138
|
(input) =>
|
@@ -1,17 +1,99 @@
|
|
1
|
-
import type {
|
1
|
+
import type { Annotated } from "@fncts/test/control/Annotations";
|
2
|
+
import type { Spec, SpecCase } from "@fncts/test/control/Spec";
|
2
3
|
import type { TestAspect } from "@fncts/test/control/TestAspect";
|
3
|
-
import type {
|
4
|
-
import type {
|
5
|
-
import type { ExecutedSpec } from "@fncts/test/data/ExecutedSpec";
|
4
|
+
import type { TestFailure } from "@fncts/test/data/TestFailure";
|
5
|
+
import type { TestSuccess } from "@fncts/test/data/TestSuccess";
|
6
6
|
|
7
|
+
import { matchTag, matchTag_ } from "@fncts/base/util/pattern";
|
8
|
+
import { DefaultTestReporter } from "@fncts/test/control/DefaultTestReporter";
|
9
|
+
import { SummaryBuilder } from "@fncts/test/control/SummaryBuilder";
|
10
|
+
import { TestAnnotationRenderer } from "@fncts/test/control/TestAnnotationRenderer";
|
11
|
+
import { timeoutWarning } from "@fncts/test/control/TestAspect";
|
12
|
+
import { TestEnvironment } from "@fncts/test/control/TestEnvironment";
|
13
|
+
import { TestLogger } from "@fncts/test/control/TestLogger";
|
14
|
+
import { ConsoleRenderer } from "@fncts/test/control/TestRenderer/ConsoleRenderer";
|
15
|
+
import { ExecutedSpec } from "@fncts/test/data/ExecutedSpec";
|
16
|
+
import { TestAnnotationMap } from "@fncts/test/data/TestAnnotationMap";
|
17
|
+
import { RuntimeFailure } from "@fncts/test/data/TestFailure";
|
18
|
+
|
19
|
+
/**
|
20
|
+
* @tsplus type fncts.test.AbstractRunnableSpec
|
21
|
+
*/
|
7
22
|
export abstract class AbstractRunnableSpec<R, E> {
|
8
|
-
|
9
|
-
|
10
|
-
abstract spec: Spec<R, E>;
|
11
|
-
|
12
|
-
|
23
|
+
aspects: ReadonlyArray<TestAspect<R | TestEnvironment, any>> = [timeoutWarning((60).seconds)];
|
24
|
+
|
25
|
+
abstract spec: Spec<R | TestEnvironment | Scope, E>;
|
26
|
+
abstract bootstrap: Layer<never, never, R>;
|
27
|
+
|
28
|
+
runSpec(spec: Spec<R | TestEnvironment | Scope, E>, __tsplusTrace?: string): UIO<ExecutedSpec<E>> {
|
29
|
+
return spec.annotated
|
30
|
+
.provideLayer(this.bootstrap.and(TestEnvironment))
|
31
|
+
.foreachExec(
|
32
|
+
(cause): UIO<Annotated<Either<TestFailure<E>, TestSuccess>>> =>
|
33
|
+
cause.failureOrCause.match(
|
34
|
+
([failure, annotations]) => IO.succeedNow([Either.left(failure), annotations]),
|
35
|
+
(cause) => IO.succeedNow([Either.left(new RuntimeFailure(cause)), TestAnnotationMap.empty]),
|
36
|
+
),
|
37
|
+
([success, annotations]): UIO<Annotated<Either<TestFailure<E>, TestSuccess>>> =>
|
38
|
+
IO.succeedNow([Either.right(success), annotations]),
|
39
|
+
ExecutionStrategy.concurrentBounded(10),
|
40
|
+
)
|
41
|
+
.scoped.flatMap(
|
42
|
+
(s) =>
|
43
|
+
s.foldScoped(
|
44
|
+
(spec: SpecCase<never, never, Annotated<Either<TestFailure<E>, TestSuccess>>, ExecutedSpec<E>>) =>
|
45
|
+
matchTag_(spec, {
|
46
|
+
Exec: ({ spec }) => IO.succeedNow(spec),
|
47
|
+
Labeled: ({ label, spec }) => IO.succeedNow(ExecutedSpec.labeled(spec, label)),
|
48
|
+
Scoped: ({ scoped }) => scoped,
|
49
|
+
Multiple: ({ specs }) => IO.succeedNow(ExecutedSpec.multiple(specs)),
|
50
|
+
Test: ({ test, annotations }) =>
|
51
|
+
test.map(([result, dynamicAnnotations]) =>
|
52
|
+
ExecutedSpec.test(result, annotations.combine(dynamicAnnotations)),
|
53
|
+
),
|
54
|
+
}),
|
55
|
+
ExecutionStrategy.concurrentBounded(10),
|
56
|
+
).scoped,
|
57
|
+
)
|
58
|
+
.timedWith(Clock.currentTime)
|
59
|
+
.flatMap(([duration, results]) =>
|
60
|
+
DefaultTestReporter.report(ConsoleRenderer.render, TestAnnotationRenderer.Default)(duration, results).as(
|
61
|
+
results,
|
62
|
+
),
|
63
|
+
)
|
64
|
+
.provideLayer(TestLogger.fromConsole);
|
13
65
|
}
|
14
|
-
|
15
|
-
|
66
|
+
|
67
|
+
run(__tsplusTrace?: string): UIO<number> {
|
68
|
+
return Do((Δ) => {
|
69
|
+
const results = Δ(this.runSpec(this.spec));
|
70
|
+
const hasFailures = results.some(
|
71
|
+
matchTag(
|
72
|
+
{
|
73
|
+
Test: ({ test }) => test.isLeft(),
|
74
|
+
},
|
75
|
+
() => false,
|
76
|
+
),
|
77
|
+
);
|
78
|
+
const summary = SummaryBuilder.buildSummary(results);
|
79
|
+
Δ(TestLogger.logLine(summary.summary));
|
80
|
+
return hasFailures ? 1 : 0;
|
81
|
+
}).provideSomeLayer(TestLogger.fromConsole);
|
16
82
|
}
|
17
83
|
}
|
84
|
+
|
85
|
+
/**
|
86
|
+
* @tsplus pipeable fncts.test.AbstractRunnableSpec combine
|
87
|
+
* @tsplus pipeable-operator fncts.test.AbstractRunnableSpec +
|
88
|
+
*/
|
89
|
+
export function combine<R1, E1>(that: AbstractRunnableSpec<R1, E1>) {
|
90
|
+
return <R, E>(self: AbstractRunnableSpec<R, E>): AbstractRunnableSpec<R | R1, E | E1> => {
|
91
|
+
return new (class extends AbstractRunnableSpec<R | R1, E | E1> {
|
92
|
+
bootstrap: Layer<never, never, R1 | R> = self.bootstrap.and(that.bootstrap);
|
93
|
+
spec: Spec<Scope | R1 | R | TestEnvironment, E1 | E> = self.aspects
|
94
|
+
.foldLeft(self.spec, (b, a) => a(b))
|
95
|
+
.combine(that.aspects.foldLeft(that.spec, (b, a) => a(b)));
|
96
|
+
aspects: readonly TestAspect<R1 | R | TestEnvironment, any>[] = [];
|
97
|
+
})();
|
98
|
+
};
|
99
|
+
}
|
@@ -1,6 +1,9 @@
|
|
1
1
|
import type { TestAnnotation } from "../../data/TestAnnotation.js";
|
2
2
|
import type { TestAnnotationMap } from "../../data/TestAnnotationMap.js";
|
3
3
|
|
4
|
+
export const AnnotationsTypeId = Symbol.for("fncts.test.Annotations");
|
5
|
+
export type AnnotationsTypeId = typeof AnnotationsTypeId;
|
6
|
+
|
4
7
|
export type Annotated<A> = readonly [A, TestAnnotationMap];
|
5
8
|
|
6
9
|
/**
|
@@ -8,6 +11,7 @@ export type Annotated<A> = readonly [A, TestAnnotationMap];
|
|
8
11
|
* @tsplus companion fncts.test.AnnotationsOps
|
9
12
|
*/
|
10
13
|
export abstract class Annotations {
|
14
|
+
readonly [AnnotationsTypeId]: AnnotationsTypeId = AnnotationsTypeId;
|
11
15
|
abstract annotate<V>(key: TestAnnotation<V>, value: V): UIO<void>;
|
12
16
|
abstract get<V>(key: TestAnnotation<V>): UIO<V>;
|
13
17
|
abstract withAnnotation<R, E, A>(io: IO<R, E, A>): IO<R, Annotated<E>, Annotated<A>>;
|
@@ -1,12 +1,8 @@
|
|
1
|
-
import {
|
1
|
+
import { AbstractRunnableSpec } from "@fncts/test/control/AbstractRunnableSpec";
|
2
2
|
import { timeoutWarning } from "@fncts/test/control/TestAspect";
|
3
3
|
import { TestEnvironment } from "@fncts/test/control/TestEnvironment";
|
4
|
-
import { defaultTestExecutor } from "@fncts/test/control/TestExecutor";
|
5
|
-
import { TestRunner } from "@fncts/test/control/TestRunner";
|
6
4
|
|
7
|
-
|
8
|
-
|
9
|
-
export abstract class DefaultRunnableSpec extends RunnableSpec<TestEnvironment, any> {
|
5
|
+
export abstract class DefaultRunnableSpec extends AbstractRunnableSpec<TestEnvironment, any> {
|
10
6
|
aspects = [timeoutWarning((1).minutes)];
|
11
|
-
|
7
|
+
bootstrap: Layer<never, never, TestEnvironment> = TestEnvironment;
|
12
8
|
}
|
package/_src/control/Gen/api.ts
CHANGED
@@ -4,7 +4,6 @@ import type { ArrayInt64 } from "@fncts/base/util/rand";
|
|
4
4
|
|
5
5
|
import { SortedMap } from "@fncts/base/collection/immutable/SortedMap";
|
6
6
|
import { IllegalArgumentError, NoSuchElementError } from "@fncts/base/data/exceptions";
|
7
|
-
import { tuple } from "@fncts/base/data/function";
|
8
7
|
import { identity } from "@fncts/base/data/function";
|
9
8
|
|
10
9
|
import {
|
@@ -59,6 +58,7 @@ export function alphaNumericStringWith(constraints: LengthConstraints = {}): Gen
|
|
59
58
|
export const alphaNumericString: Gen<Sized, string> = alphaNumericChar.string();
|
60
59
|
|
61
60
|
/**
|
61
|
+
* @tsplus static fncts.test.GenOps array
|
62
62
|
* @tsplus getter fncts.test.Gen array
|
63
63
|
*/
|
64
64
|
export function array<R, A>(self: Gen<R, A>): Gen<R | Sized, ReadonlyArray<A>> {
|
@@ -183,6 +183,7 @@ export function concWith(constraints: LengthConstraints = {}) {
|
|
183
183
|
|
184
184
|
/**
|
185
185
|
* @tsplus getter fncts.test.Gen conc
|
186
|
+
* @tsplus static fncts.test.GenOps conc
|
186
187
|
*/
|
187
188
|
export function conc<R, A>(self: Gen<R, A>): Gen<R | Sized, Conc<A>> {
|
188
189
|
return self.conc();
|
@@ -347,6 +348,11 @@ export function floatWith(constraints: NumberConstraints & FloatConstraints = {}
|
|
347
348
|
);
|
348
349
|
}
|
349
350
|
|
351
|
+
/**
|
352
|
+
* @tsplus static fncts.test.GenOps float
|
353
|
+
*/
|
354
|
+
export const float: Gen<never, number> = floatWith();
|
355
|
+
|
350
356
|
/**
|
351
357
|
* @tsplus static fncts.test.GenOps fullUnicodeChar
|
352
358
|
*/
|
@@ -463,6 +469,9 @@ export function oneOf<A extends ReadonlyArray<Gen<any, any>>>(...gens: A): Gen<_
|
|
463
469
|
else return Gen.intWith({ min: 0, max: gens.length - 1 }).flatMap((i) => gens[i]!);
|
464
470
|
}
|
465
471
|
|
472
|
+
/**
|
473
|
+
* @tsplus static fncts.test.GenOps partial
|
474
|
+
*/
|
466
475
|
export function partial<P extends Record<string, Gen<any, any>>>(
|
467
476
|
properties: P,
|
468
477
|
): Gen<
|
@@ -540,6 +549,9 @@ export function stringN(n: number) {
|
|
540
549
|
};
|
541
550
|
}
|
542
551
|
|
552
|
+
/**
|
553
|
+
* @tsplus static fncts.test.GenOps struct
|
554
|
+
*/
|
543
555
|
export function struct<P extends Record<string, Gen<any, any>>>(
|
544
556
|
properties: P,
|
545
557
|
): Gen<
|
@@ -626,10 +638,13 @@ export function unwrap<R, R1, A>(effect: URIO<R, Gen<R1, A>>): Gen<R | R1, A> {
|
|
626
638
|
*/
|
627
639
|
export function weighted<R, A>(...gens: ReadonlyArray<readonly [Gen<R, A>, number]>): Gen<R, A> {
|
628
640
|
const sum = gens.map(([, weight]) => weight).foldLeft(0, (b, a) => b + a);
|
629
|
-
const [map] = gens.foldLeft(
|
630
|
-
|
631
|
-
|
632
|
-
|
641
|
+
const [map] = gens.foldLeft(
|
642
|
+
Function.tuple(SortedMap.make<number, Gen<R, A>>(Number.Ord), 0),
|
643
|
+
([map, acc], [gen, d]) => {
|
644
|
+
if ((acc + d) / sum > acc / sum) return Function.tuple(map.set((acc + d) / sum, gen), acc + d);
|
645
|
+
else return Function.tuple(map, acc);
|
646
|
+
},
|
647
|
+
);
|
633
648
|
return Gen.uniform.flatMap((n) =>
|
634
649
|
map.getGte(n).getOrElse(() => {
|
635
650
|
throw new NoSuchElementError("Gen.weighted");
|
@@ -651,10 +666,24 @@ export function zipWith<A, R1, B, C>(that: Gen<R1, B>, f: (a: A, b: B) => C) {
|
|
651
666
|
*/
|
652
667
|
export function zip<R1, B>(that: Gen<R1, B>) {
|
653
668
|
return <R, A>(self: Gen<R, A>): Gen<R | R1, readonly [A, B]> => {
|
654
|
-
return self.zipWith(that, tuple);
|
669
|
+
return self.zipWith(that, Function.tuple);
|
655
670
|
};
|
656
671
|
}
|
657
672
|
|
673
|
+
/**
|
674
|
+
* @tsplus static fncts.test.GenOps tuple
|
675
|
+
*/
|
676
|
+
export function tuple<A extends [...Gen<any, any>[]]>(
|
677
|
+
...components: A
|
678
|
+
): Gen<
|
679
|
+
{ [K in keyof A]: [A[K]] extends [Gen<infer R, any>] ? R : never }[keyof A & number],
|
680
|
+
{ [K in keyof A]: [A[K]] extends [Gen<any, infer A>] ? A : never }
|
681
|
+
> {
|
682
|
+
return components.foldLeft(Gen.constant<Array<any>>([]) as Gen<any, ReadonlyArray<any>>, (b, a) =>
|
683
|
+
b.zipWith(a, (vs, v) => [...vs, v]),
|
684
|
+
) as any;
|
685
|
+
}
|
686
|
+
|
658
687
|
function _char(min: number, max: number, mapToCode: (v: number) => number): Gen<never, string> {
|
659
688
|
return Gen.intWith({ min, max }).map((n) => String.fromCharCode(mapToCode(n)));
|
660
689
|
}
|
package/_src/demo.ts
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
import { DefaultRunnableSpec } from "@fncts/test/control/DefaultRunnableSpec";
|
2
2
|
|
3
|
-
import { suite, test
|
3
|
+
import { suite, test } from "./api.js";
|
4
4
|
import { strictEqualTo } from "./control/Assertion.js";
|
5
|
+
|
5
6
|
const ServiceATag = Tag<{
|
6
7
|
x: number;
|
7
8
|
}>("fncts.test.demo.ServiceA");
|
9
|
+
|
8
10
|
class DemoSpec extends DefaultRunnableSpec {
|
9
11
|
spec = suite(
|
10
12
|
"TestSuite",
|
@@ -12,4 +14,4 @@ class DemoSpec extends DefaultRunnableSpec {
|
|
12
14
|
test("Demo failure", { a: { b: { c: { d: 100 } } } }.assert(strictEqualTo({ a: { b: { c: { d: 0 } } } }))),
|
13
15
|
);
|
14
16
|
}
|
15
|
-
new DemoSpec().
|
17
|
+
new DemoSpec().run().unsafeRunAsync()
|
@@ -1,13 +1,26 @@
|
|
1
|
-
import {
|
1
|
+
import { Scope } from "@fncts/io/Scope/definition";
|
2
|
+
import { Layer } from "@fncts/io/Layer";
|
3
|
+
import { UIO, IO } from "@fncts/io/IO/definition";
|
4
|
+
import { Either } from "@fncts/base/data/Either/definition";
|
5
|
+
import { ExecutionStrategy } from "@fncts/base/data/ExecutionStrategy";
|
6
|
+
import { Clock } from "@fncts/io/Clock/definition";
|
2
7
|
import type { Spec } from "@fncts/test/control/Spec";
|
3
8
|
import type { TestAspect } from "@fncts/test/control/TestAspect";
|
4
|
-
import
|
5
|
-
import
|
6
|
-
|
9
|
+
import { TestEnvironment } from "@fncts/test/control/TestEnvironment";
|
10
|
+
import { ExecutedSpec } from "@fncts/test/data/ExecutedSpec";
|
11
|
+
/**
|
12
|
+
* @tsplus type fncts.test.AbstractRunnableSpec
|
13
|
+
*/
|
7
14
|
export declare abstract class AbstractRunnableSpec<R, E> {
|
8
|
-
|
9
|
-
abstract
|
10
|
-
abstract
|
11
|
-
|
12
|
-
|
15
|
+
aspects: ReadonlyArray<TestAspect<R | TestEnvironment, any>>;
|
16
|
+
abstract spec: Spec<R | TestEnvironment | Scope, E>;
|
17
|
+
abstract bootstrap: Layer<never, never, R>;
|
18
|
+
runSpec(spec: Spec<R | TestEnvironment | Scope, E>, __tsplusTrace?: string): UIO<ExecutedSpec<E>>;
|
19
|
+
run(__tsplusTrace?: string): UIO<number>;
|
13
20
|
}
|
21
|
+
/**
|
22
|
+
* @tsplus pipeable fncts.test.AbstractRunnableSpec combine
|
23
|
+
* @tsplus pipeable-operator fncts.test.AbstractRunnableSpec +
|
24
|
+
* @tsplus location "@fncts/test/control/AbstractRunnableSpec"
|
25
|
+
*/
|
26
|
+
export declare function combine<R1, E1>(that: AbstractRunnableSpec<R1, E1>): <R, E>(self: AbstractRunnableSpec<R, E>) => AbstractRunnableSpec<R1 | R, E1 | E>;
|
@@ -3,12 +3,15 @@ import { HashSet } from "@fncts/base/collection/immutable/HashSet/definition";
|
|
3
3
|
import { Fiber } from "@fncts/io/Fiber/definition";
|
4
4
|
import type { TestAnnotation } from "../../data/TestAnnotation.js";
|
5
5
|
import type { TestAnnotationMap } from "../../data/TestAnnotationMap.js";
|
6
|
+
export declare const AnnotationsTypeId: unique symbol;
|
7
|
+
export type AnnotationsTypeId = typeof AnnotationsTypeId;
|
6
8
|
export type Annotated<A> = readonly [A, TestAnnotationMap];
|
7
9
|
/**
|
8
10
|
* @tsplus type fncts.test.Annotations
|
9
11
|
* @tsplus companion fncts.test.AnnotationsOps
|
10
12
|
*/
|
11
13
|
export declare abstract class Annotations {
|
14
|
+
readonly [AnnotationsTypeId]: AnnotationsTypeId;
|
12
15
|
abstract annotate<V>(key: TestAnnotation<V>, value: V): UIO<void>;
|
13
16
|
abstract get<V>(key: TestAnnotation<V>): UIO<V>;
|
14
17
|
abstract withAnnotation<R, E, A>(io: IO<R, E, A>): IO<R, Annotated<E>, Annotated<A>>;
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import {
|
1
|
+
import { Layer } from "@fncts/io/Layer";
|
2
|
+
import { AbstractRunnableSpec } from "@fncts/test/control/AbstractRunnableSpec";
|
2
3
|
import { TestEnvironment } from "@fncts/test/control/TestEnvironment";
|
3
|
-
|
4
|
-
export declare abstract class DefaultRunnableSpec extends RunnableSpec<TestEnvironment, any> {
|
4
|
+
export declare abstract class DefaultRunnableSpec extends AbstractRunnableSpec<TestEnvironment, any> {
|
5
5
|
aspects: import("@fncts/test/control/TestAspect").TestAspect<import("./Live").Live, any>[];
|
6
|
-
|
6
|
+
bootstrap: Layer<never, never, TestEnvironment>;
|
7
7
|
}
|
package/control/Gen/api.d.ts
CHANGED
@@ -38,6 +38,7 @@ export declare function alphaNumericStringWith(constraints?: LengthConstraints):
|
|
38
38
|
*/
|
39
39
|
export declare const alphaNumericString: Gen<Sized, string>;
|
40
40
|
/**
|
41
|
+
* @tsplus static fncts.test.GenOps array
|
41
42
|
* @tsplus getter fncts.test.Gen array
|
42
43
|
* @tsplus location "@fncts/test/control/Gen/api"
|
43
44
|
*/
|
@@ -119,6 +120,7 @@ export declare const char16: Gen<never, string>;
|
|
119
120
|
export declare function concWith(constraints?: LengthConstraints): <R, A>(self: Gen<R, A>) => Gen<Sized | R, import("@fncts/base/collection/immutable/Conc.js").Conc<A>>;
|
120
121
|
/**
|
121
122
|
* @tsplus getter fncts.test.Gen conc
|
123
|
+
* @tsplus static fncts.test.GenOps conc
|
122
124
|
* @tsplus location "@fncts/test/control/Gen/api"
|
123
125
|
*/
|
124
126
|
export declare function conc<R, A>(self: Gen<R, A>): Gen<R | Sized, Conc<A>>;
|
@@ -193,6 +195,11 @@ export declare function fromIOSample<R, A>(effect: IO<R, never, Sample<R, A>>):
|
|
193
195
|
* @tsplus location "@fncts/test/control/Gen/api"
|
194
196
|
*/
|
195
197
|
export declare function floatWith(constraints?: NumberConstraints & FloatConstraints): Gen<never, number>;
|
198
|
+
/**
|
199
|
+
* @tsplus static fncts.test.GenOps float
|
200
|
+
* @tsplus location "@fncts/test/control/Gen/api"
|
201
|
+
*/
|
202
|
+
export declare const float: Gen<never, number>;
|
196
203
|
/**
|
197
204
|
* @tsplus static fncts.test.GenOps fullUnicodeChar
|
198
205
|
* @tsplus location "@fncts/test/control/Gen/api"
|
@@ -253,6 +260,10 @@ export declare function nat(max?: number): Gen<unknown, number>;
|
|
253
260
|
* @tsplus location "@fncts/test/control/Gen/api"
|
254
261
|
*/
|
255
262
|
export declare function oneOf<A extends ReadonlyArray<Gen<any, any>>>(...gens: A): Gen<_R<A[number]>, _A<A[number]>>;
|
263
|
+
/**
|
264
|
+
* @tsplus static fncts.test.GenOps partial
|
265
|
+
* @tsplus location "@fncts/test/control/Gen/api"
|
266
|
+
*/
|
256
267
|
export declare function partial<P extends Record<string, Gen<any, any>>>(properties: P): Gen<_R<P[keyof P]>, Partial<{
|
257
268
|
readonly [K in keyof P]: _A<P[K]>;
|
258
269
|
}>>;
|
@@ -291,6 +302,10 @@ export declare function string(constraints?: LengthConstraints): <R>(char: Gen<R
|
|
291
302
|
* @tsplus location "@fncts/test/control/Gen/api"
|
292
303
|
*/
|
293
304
|
export declare function stringN(n: number): <R>(char: Gen<R, string>) => Gen<R, string>;
|
305
|
+
/**
|
306
|
+
* @tsplus static fncts.test.GenOps struct
|
307
|
+
* @tsplus location "@fncts/test/control/Gen/api"
|
308
|
+
*/
|
294
309
|
export declare function struct<P extends Record<string, Gen<any, any>>>(properties: P): Gen<_R<P[keyof P]>, {
|
295
310
|
readonly [K in keyof P]: _A<P[K]>;
|
296
311
|
}>;
|
@@ -349,3 +364,12 @@ export declare function zipWith<A, R1, B, C>(that: Gen<R1, B>, f: (a: A, b: B) =
|
|
349
364
|
* @tsplus location "@fncts/test/control/Gen/api"
|
350
365
|
*/
|
351
366
|
export declare function zip<R1, B>(that: Gen<R1, B>): <R, A>(self: Gen<R, A>) => Gen<R1 | R, readonly [A, B]>;
|
367
|
+
/**
|
368
|
+
* @tsplus static fncts.test.GenOps tuple
|
369
|
+
* @tsplus location "@fncts/test/control/Gen/api"
|
370
|
+
*/
|
371
|
+
export declare function tuple<A extends [...Gen<any, any>[]]>(...components: A): Gen<{
|
372
|
+
[K in keyof A]: [A[K]] extends [Gen<infer R, any>] ? R : never;
|
373
|
+
}[keyof A & number], {
|
374
|
+
[K in keyof A]: [A[K]] extends [Gen<any, infer A>] ? A : never;
|
375
|
+
}>;
|
package/package.json
CHANGED
@@ -1,52 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.RunnableSpec = void 0;
|
7
|
-
exports.isRunnableSpec = isRunnableSpec;
|
8
|
-
var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/test/control/TestLogger"));
|
9
|
-
var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api"));
|
10
|
-
var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/test/control/SummaryBuilder"));
|
11
|
-
var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Either/api"));
|
12
|
-
var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/test/data/ExecutedSpec/api"));
|
13
|
-
var tsplus_module_6 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Exit/api"));
|
14
|
-
var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/provideLayer"));
|
15
|
-
var tsplus_module_8 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/runtime"));
|
16
|
-
var _pattern = /*#__PURE__*/require("@fncts/base/util/pattern");
|
17
|
-
var _predicates = /*#__PURE__*/require("@fncts/base/util/predicates");
|
18
|
-
var _AbstractRunnableSpec = /*#__PURE__*/require("@fncts/test/control/AbstractRunnableSpec");
|
19
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
20
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
21
|
-
const fileName_1 = "(@fncts/test) src/control/RunnableSpec.ts";
|
22
|
-
class RunnableSpec extends _AbstractRunnableSpec.AbstractRunnableSpec {
|
23
|
-
constructor() {
|
24
|
-
super(...arguments);
|
25
|
-
this._tag = "RunnableSpec";
|
26
|
-
}
|
27
|
-
run(spec) {
|
28
|
-
const self = this;
|
29
|
-
return tsplus_module_2.flatMap(results => {
|
30
|
-
const hasFailures = tsplus_module_5.some((0, _pattern.matchTag)({
|
31
|
-
Test: ({
|
32
|
-
test
|
33
|
-
}) => tsplus_module_4.isLeft(test)
|
34
|
-
}, () => false))(results);
|
35
|
-
const summary = tsplus_module_3.buildSummary(results);
|
36
|
-
return tsplus_module_2.map(() => hasFailures ? 1 : 0, fileName_1 + ":25:8")(tsplus_module_1.logLine(summary.summary));
|
37
|
-
}, fileName_1 + ":15:28")(self.runSpec(spec));
|
38
|
-
}
|
39
|
-
main(_args) {
|
40
|
-
// const filteredSpec = this.spec.filterByArgs(args);
|
41
|
-
tsplus_module_8.unsafeRunAsyncWith(tsplus_module_7.provideLayer(this.runner.bootstrap, fileName_1 + ":33:20")(this.run(this.spec)), exit => {
|
42
|
-
tsplus_module_6.match(() => {
|
43
|
-
process.exit(1);
|
44
|
-
}, code => process.exit(code))(exit);
|
45
|
-
}, fileName_1 + ":34:26");
|
46
|
-
}
|
47
|
-
}
|
48
|
-
exports.RunnableSpec = RunnableSpec;
|
49
|
-
function isRunnableSpec(u) {
|
50
|
-
return (0, _predicates.isObject)(u) && "_tag" in u && u["_tag"] === "RunnableSpec";
|
51
|
-
}
|
52
|
-
//# sourceMappingURL=RunnableSpec.cjs.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"RunnableSpec.cjs","mappings":";;;;;;;;;;;;;;;AAGA;AACA;AACA;AAAgF;AAAA;;AAI1E,MAAgBA,YAAmB,SAAQC,0CAA0B;EAA3EC;;IACW,SAAI,GAAG,cAAc;EAgChC;EA/BEC,GAAG,CAACC,IAAgB;IAClB,MAAMC,IAAI,GAAG,IAAI;IACjB,+BACQC,OAAO;MACb,MAAMC,WAAW,GAAGC,qBAClB,qBAAQ,EACN;QACEC,IAAI,EAAE,CAAC;UAAEC;QAAI,CAAE,KAAKC,2BAAI;OACzB,EACD,MAAM,KAAK,CACZ,EANiBL,OAAO,CAO1B;MACD,MAAMM,OAAO,GAAGC,6BAA4BP,OAAO,CAAC;uCAE7CC,WAAW,GAAG,CAAC,GAAG,CAAC,wBADxBO,wBAAmBF,OAAO,CAACA,OAAO,CAAC;8BAVfP,IAAI,CAACU,OAAO,CAACX,IAAI,CAAC;EAa5C;EAEAY,IAAI,CAACC,KAAgB;IACnB;IACAC,gEACgB,IAAI,CAACC,MAAM,CAACC,SAAS,yBADrC,IAAI,CAACjB,GAAG,CAAC,IAAI,CAACC,IAAI,CAAC,CACmB,EACfiB,IAAI,IAAI;MAC3BC,sBACE,MAAK;QACHC,OAAO,CAACF,IAAI,CAAC,CAAC,CAAC;MACjB,CAAC,EACAG,IAAI,IAAKD,OAAO,CAACF,IAAI,CAACG,IAAI,CAAC,EAJ9BH,IAAI,CAKH;IACH,CAAC,wBAAC;EACN;;AACD;AAEK,SAAUI,cAAc,CAACC,CAAU;EACvC,OAAO,wBAAQ,EAACA,CAAC,CAAC,IAAI,MAAM,IAAIA,CAAC,IAAIA,CAAC,CAAC,MAAM,CAAC,KAAK,cAAc;AACnE","names":["RunnableSpec","AbstractRunnableSpec","constructor","run","spec","self","results","hasFailures","tsplus_module_5","Test","test","tsplus_module_4","summary","tsplus_module_3","tsplus_module_1","runSpec","main","_args","tsplus_module_8","runner","bootstrap","exit","tsplus_module_6","process","code","isRunnableSpec","u"],"sourceRoot":"","sources":["../../_src/control/RunnableSpec.ts"],"sourcesContent":[null]}
|
@@ -1,44 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.defaultTestExecutor = defaultTestExecutor;
|
7
|
-
var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api"));
|
8
|
-
var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/test/data/ExecutedSpec/api"));
|
9
|
-
var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/test/control/Spec/api"));
|
10
|
-
var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api/scoped"));
|
11
|
-
var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Either/constructors"));
|
12
|
-
var tsplus_module_6 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Cause/api"));
|
13
|
-
var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Either/destructors"));
|
14
|
-
var _pattern = /*#__PURE__*/require("@fncts/base/util/pattern");
|
15
|
-
var _TestAnnotationMap = /*#__PURE__*/require("../data/TestAnnotationMap.cjs");
|
16
|
-
var _TestFailure = /*#__PURE__*/require("../data/TestFailure.cjs");
|
17
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
18
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
19
|
-
const fileName_1 = "(@fncts/test) src/control/TestExecutor.ts";
|
20
|
-
function defaultTestExecutor(env) {
|
21
|
-
return {
|
22
|
-
run: (spec, defExec) => tsplus_module_1.flatMap(s => tsplus_module_4.scoped(tsplus_module_3.foldScoped(spec => (0, _pattern.matchTag_)(spec, {
|
23
|
-
Exec: ({
|
24
|
-
spec
|
25
|
-
}) => tsplus_module_1.succeedNow(spec, fileName_1 + ":38:52"),
|
26
|
-
Labeled: ({
|
27
|
-
label,
|
28
|
-
spec
|
29
|
-
}) => tsplus_module_1.succeedNow(tsplus_module_2.labeled(spec, label), fileName_1 + ":39:62"),
|
30
|
-
Scoped: ({
|
31
|
-
scoped
|
32
|
-
}) => scoped,
|
33
|
-
Multiple: ({
|
34
|
-
specs
|
35
|
-
}) => tsplus_module_1.succeedNow(tsplus_module_2.multiple(specs), fileName_1 + ":41:57"),
|
36
|
-
Test: ({
|
37
|
-
test,
|
38
|
-
annotations
|
39
|
-
}) => tsplus_module_1.map(([result, dynamicAnnotations]) => tsplus_module_2.test(result, annotations.combine(dynamicAnnotations)), fileName_1 + ":43:29")(test)
|
40
|
-
}), defExec)(s), fileName_1 + ":48:14"), fileName_1 + ":33:24")(tsplus_module_4.scoped(tsplus_module_3.foreachExec(cause => tsplus_module_7.match(([failure, annotations]) => tsplus_module_1.succeedNow([tsplus_module_5.left(failure), annotations], fileName_1 + ":26:56"), cause => tsplus_module_1.succeedNow([tsplus_module_5.left(new _TestFailure.RuntimeFailure(cause)), _TestAnnotationMap.TestAnnotationMap.empty], fileName_1 + ":27:39"))(tsplus_module_6.failureOrCause(cause)), ([success, annotations]) => tsplus_module_1.succeedNow([tsplus_module_5.right(success), annotations], fileName_1 + ":30:26"), defExec)(tsplus_module_3.provideLayer(env)(tsplus_module_3.annotated(spec))), fileName_1 + ":32:10")),
|
41
|
-
environment: env
|
42
|
-
};
|
43
|
-
}
|
44
|
-
//# sourceMappingURL=TestExecutor.cjs.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"TestExecutor.cjs","mappings":";;;;;;;;;;;;;AAMA;AAGA;AACA;AAAwD;AAAA;;AAOlD,SAAUA,mBAAmB,CAAIC,GAAyC;EAC9E,OAAO;IACLC,GAAG,EAAE,CAAIC,IAA8B,EAAEC,OAA0B,KACjEC,wBAaKC,CAAC,IAAIC,uBACJC,2BACGL,IAA6F,IAC5F,sBAAS,EAACA,IAAI,EAAE;MACdM,IAAI,EAAE,CAAC;QAAEN;MAAI,CAAE,KAAKE,2BAAcF,IAAI,wBAAC;MACvCO,OAAO,EAAE,CAAC;QAAEC,KAAK;QAAER;MAAI,CAAE,KAAKE,2BAAcO,wBAAqBT,IAAI,EAAEQ,KAAK,CAAC,wBAAC;MAC9EE,MAAM,EAAE,CAAC;QAAEC;MAAM,CAAE,KAAKA,MAAM;MAC9BC,QAAQ,EAAE,CAAC;QAAEC;MAAK,CAAE,KAAKX,2BAAcO,yBAAsBI,KAAK,CAAC,wBAAC;MACpEC,IAAI,EAAE,CAAC;QAAEC,IAAI;QAAEC;MAAW,CAAE,KAC1Bd,oBAAS,CAAC,CAACe,MAAM,EAAEC,kBAAkB,CAAC,KACpCT,qBAAkBQ,MAAM,EAAED,WAAW,CAACG,OAAO,CAACD,kBAAkB,CAAC,CAAC,yBADpEH,IAAI;KAGP,CAAC,EACJd,OAAO,EAZTE,CAAC,CAaA,wBAAO,gDA3BdE,4BAGKe,KAAK,IACJC,sBACE,CAAC,CAACC,OAAO,EAAEN,WAAW,CAAC,KAAKd,2BAAc,CAACqB,qBAAYD,OAAO,CAAC,EAAEN,WAAW,CAAC,wBAAC,EAC7EI,KAAK,IAAKlB,2BAAc,CAACqB,qBAAY,IAAIC,2BAAc,CAACJ,KAAK,CAAC,CAAC,EAAEK,oCAAiB,CAACC,KAAK,CAAC,wBAAC,iCAF7FN,KAAK,EAGJ,EACH,CAAC,CAACO,OAAO,EAAEX,WAAW,CAAC,KACrBd,2BAAc,CAACqB,sBAAaI,OAAO,CAAC,EAAEX,WAAW,CAAC,wBAAC,EACrDf,OAAO,EAVXI,6BACgBP,GAAG,4BADnBE,IAAI,EACgB,CAUjB,yBAiBA;IACL4B,WAAW,EAAE9B;GACd;AACH","names":["defaultTestExecutor","env","run","spec","defExec","tsplus_module_1","s","tsplus_module_4","tsplus_module_3","Exec","Labeled","label","tsplus_module_2","Scoped","scoped","Multiple","specs","Test","test","annotations","result","dynamicAnnotations","combine","cause","tsplus_module_7","failure","tsplus_module_5","RuntimeFailure","TestAnnotationMap","empty","success","environment"],"sourceRoot":"","sources":["../../_src/control/TestExecutor.ts"],"sourcesContent":[null]}
|
@@ -1,28 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.TestRunner = void 0;
|
7
|
-
var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/test/control/TestRenderer/ConsoleRenderer"));
|
8
|
-
var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/test/control/TestAnnotationRenderer/api"));
|
9
|
-
var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/test/control/DefaultTestReporter/render"));
|
10
|
-
var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/test/control/TestLogger"));
|
11
|
-
var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/IO/api"));
|
12
|
-
var tsplus_module_6 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/io/Clock/api"));
|
13
|
-
var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/ExecutionStrategy"));
|
14
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
15
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
16
|
-
const fileName_1 = "(@fncts/test) src/control/TestRunner.ts";
|
17
|
-
class TestRunner {
|
18
|
-
constructor(executor, reporter, bootstrap) {
|
19
|
-
this.executor = executor;
|
20
|
-
this.reporter = reporter ?? tsplus_module_3.report(tsplus_module_1.render, tsplus_module_2.Default);
|
21
|
-
this.bootstrap = bootstrap ?? tsplus_module_4.fromConsole;
|
22
|
-
}
|
23
|
-
run(spec) {
|
24
|
-
return tsplus_module_5.flatMap(([duration, results]) => tsplus_module_5.as(() => results, fileName_1 + ":29:76")(this.reporter(duration, results)), fileName_1 + ":29:15")(tsplus_module_5.timedWith(tsplus_module_6.currentTime, fileName_1 + ":28:17")(this.executor.run(spec, tsplus_module_7.concurrentBounded(10))));
|
25
|
-
}
|
26
|
-
}
|
27
|
-
exports.TestRunner = TestRunner;
|
28
|
-
//# sourceMappingURL=TestRunner.cjs.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"TestRunner.cjs","mappings":";;;;;;;;;;;;;;;;AAYM,MAAOA,UAAU;EAGrBC,YACWC,QAAyB,EAClCC,QAA0B,EAC1BC,SAA2C;IAFlC,aAAQ,GAARF,QAAQ;IAIjB,IAAI,CAACC,QAAQ,GAAIA,QAAQ,IAAIE,uEAAkF;IAC/G,IAAI,CAACD,SAAS,GAAGA,SAAS,+BAA0B;EACtD;EAEAE,GAAG,CAACC,IAA8B;IAChC,OAAOC,wBAGI,CAAC,CAACC,QAAQ,EAAEC,OAAO,CAAC,KAAKF,yBAAoCE,OAAO,yBAA3C,IAAI,CAACP,QAAQ,CAACM,QAAQ,EAAEC,OAAO,CAAC,CAAY,yBAHzEF,kFAAI,CAACN,QAAQ,CACjBI,GAAG,CAACC,IAAI,EAAEI,kCAAoC,EAAE,CAAC,CAAC,CACtB,CACkD;EACnF;;AACD","names":["TestRunner","constructor","executor","reporter","bootstrap","tsplus_module_3","run","spec","tsplus_module_5","duration","results","tsplus_module_7"],"sourceRoot":"","sources":["../../_src/control/TestRunner.ts"],"sourcesContent":[null]}
|