@fncts/test 0.0.30 → 0.0.32
Sign up to get free protection for your applications and to get access to all the features.
- 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,42 +0,0 @@
|
|
1
|
-
const fileName_1 = "(@fncts/test) src/control/RunnableSpec.ts";
|
2
|
-
import * as tsplus_module_1 from "@fncts/test/control/TestLogger";
|
3
|
-
import * as tsplus_module_2 from "@fncts/io/IO/api";
|
4
|
-
import * as tsplus_module_3 from "@fncts/test/control/SummaryBuilder";
|
5
|
-
import * as tsplus_module_4 from "@fncts/base/data/Either/api";
|
6
|
-
import * as tsplus_module_5 from "@fncts/test/data/ExecutedSpec/api";
|
7
|
-
import * as tsplus_module_6 from "@fncts/base/data/Exit/api";
|
8
|
-
import * as tsplus_module_7 from "@fncts/io/IO/api/provideLayer";
|
9
|
-
import * as tsplus_module_8 from "@fncts/io/IO/runtime";
|
10
|
-
import { matchTag } from "@fncts/base/util/pattern";
|
11
|
-
import { isObject } from "@fncts/base/util/predicates";
|
12
|
-
import { AbstractRunnableSpec } from "@fncts/test/control/AbstractRunnableSpec";
|
13
|
-
export class RunnableSpec extends AbstractRunnableSpec {
|
14
|
-
constructor() {
|
15
|
-
super(...arguments);
|
16
|
-
this._tag = "RunnableSpec";
|
17
|
-
}
|
18
|
-
run(spec) {
|
19
|
-
const self = this;
|
20
|
-
return tsplus_module_2.flatMap(results => {
|
21
|
-
const hasFailures = tsplus_module_5.some(matchTag({
|
22
|
-
Test: ({
|
23
|
-
test
|
24
|
-
}) => tsplus_module_4.isLeft(test)
|
25
|
-
}, () => false))(results);
|
26
|
-
const summary = tsplus_module_3.buildSummary(results);
|
27
|
-
return tsplus_module_2.map(() => hasFailures ? 1 : 0, fileName_1 + ":25:8")(tsplus_module_1.logLine(summary.summary));
|
28
|
-
}, fileName_1 + ":15:28")(self.runSpec(spec));
|
29
|
-
}
|
30
|
-
main(_args) {
|
31
|
-
// const filteredSpec = this.spec.filterByArgs(args);
|
32
|
-
tsplus_module_8.unsafeRunAsyncWith(tsplus_module_7.provideLayer(this.runner.bootstrap, fileName_1 + ":33:20")(this.run(this.spec)), exit => {
|
33
|
-
tsplus_module_6.match(() => {
|
34
|
-
process.exit(1);
|
35
|
-
}, code => process.exit(code))(exit);
|
36
|
-
}, fileName_1 + ":34:26");
|
37
|
-
}
|
38
|
-
}
|
39
|
-
export function isRunnableSpec(u) {
|
40
|
-
return isObject(u) && "_tag" in u && u["_tag"] === "RunnableSpec";
|
41
|
-
}
|
42
|
-
//# sourceMappingURL=RunnableSpec.mjs.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"RunnableSpec.mjs","mappings":";;;;;;;;;AAGA,SAASA,QAAQ,QAAQ,0BAA0B;AACnD,SAASC,QAAQ,QAAQ,6BAA6B;AACtD,SAASC,oBAAoB,QAAQ,0CAA0C;AAI/E,OAAM,MAAgBC,YAAmB,SAAQD,oBAA0B;EAA3EE;;IACW,SAAI,GAAG,cAAc;EAgChC;EA/BEC,GAAG,CAACC,IAAgB;IAClB,MAAMC,IAAI,GAAG,IAAI;IACjB,+BACQC,OAAO;MACb,MAAMC,WAAW,GAAGC,qBAClBV,QAAQ,CACN;QACEW,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;;AAGF,OAAM,SAAUI,cAAc,CAACC,CAAU;EACvC,OAAO3B,QAAQ,CAAC2B,CAAC,CAAC,IAAI,MAAM,IAAIA,CAAC,IAAIA,CAAC,CAAC,MAAM,CAAC,KAAK,cAAc;AACnE","names":["matchTag","isObject","AbstractRunnableSpec","RunnableSpec","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,36 +0,0 @@
|
|
1
|
-
const fileName_1 = "(@fncts/test) src/control/TestExecutor.ts";
|
2
|
-
import * as tsplus_module_1 from "@fncts/io/IO/api";
|
3
|
-
import * as tsplus_module_2 from "@fncts/test/data/ExecutedSpec/api";
|
4
|
-
import * as tsplus_module_3 from "@fncts/test/control/Spec/api";
|
5
|
-
import * as tsplus_module_4 from "@fncts/io/IO/api/scoped";
|
6
|
-
import * as tsplus_module_5 from "@fncts/base/data/Either/constructors";
|
7
|
-
import * as tsplus_module_6 from "@fncts/base/data/Cause/api";
|
8
|
-
import * as tsplus_module_7 from "@fncts/base/data/Either/destructors";
|
9
|
-
import { matchTag_ } from "@fncts/base/util/pattern";
|
10
|
-
import { TestAnnotationMap } from "../data/TestAnnotationMap.mjs";
|
11
|
-
import { RuntimeFailure } from "../data/TestFailure.mjs";
|
12
|
-
export function defaultTestExecutor(env) {
|
13
|
-
return {
|
14
|
-
run: (spec, defExec) => tsplus_module_1.flatMap(s => tsplus_module_4.scoped(tsplus_module_3.foldScoped(spec => matchTag_(spec, {
|
15
|
-
Exec: ({
|
16
|
-
spec
|
17
|
-
}) => tsplus_module_1.succeedNow(spec, fileName_1 + ":38:52"),
|
18
|
-
Labeled: ({
|
19
|
-
label,
|
20
|
-
spec
|
21
|
-
}) => tsplus_module_1.succeedNow(tsplus_module_2.labeled(spec, label), fileName_1 + ":39:62"),
|
22
|
-
Scoped: ({
|
23
|
-
scoped
|
24
|
-
}) => scoped,
|
25
|
-
Multiple: ({
|
26
|
-
specs
|
27
|
-
}) => tsplus_module_1.succeedNow(tsplus_module_2.multiple(specs), fileName_1 + ":41:57"),
|
28
|
-
Test: ({
|
29
|
-
test,
|
30
|
-
annotations
|
31
|
-
}) => tsplus_module_1.map(([result, dynamicAnnotations]) => tsplus_module_2.test(result, annotations.combine(dynamicAnnotations)), fileName_1 + ":43:29")(test)
|
32
|
-
}), 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 RuntimeFailure(cause)), 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")),
|
33
|
-
environment: env
|
34
|
-
};
|
35
|
-
}
|
36
|
-
//# sourceMappingURL=TestExecutor.mjs.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"TestExecutor.mjs","mappings":";;;;;;;;AAMA,SAASA,SAAS,QAAQ,0BAA0B;AAGpD,SAASC,iBAAiB,QAAQ,+BAA8B;AAChE,SAASC,cAAc,QAAQ,yBAAwB;AAOvD,OAAM,SAAUC,mBAAmB,CAAIC,GAAyC;EAC9E,OAAO;IACLC,GAAG,EAAE,CAAIC,IAA8B,EAAEC,OAA0B,KACjEC,wBAaKC,CAAC,IAAIC,uBACJC,2BACGL,IAA6F,IAC5FN,SAAS,CAACM,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,IAAI3B,cAAc,CAACwB,KAAK,CAAC,CAAC,EAAEzB,iBAAiB,CAAC6B,KAAK,CAAC,wBAAC,iCAF7FJ,KAAK,EAGJ,EACH,CAAC,CAACK,OAAO,EAAET,WAAW,CAAC,KACrBd,2BAAc,CAACqB,sBAAaE,OAAO,CAAC,EAAET,WAAW,CAAC,wBAAC,EACrDf,OAAO,EAVXI,6BACgBP,GAAG,4BADnBE,IAAI,EACgB,CAUjB,yBAiBA;IACL0B,WAAW,EAAE5B;GACd;AACH","names":["matchTag_","TestAnnotationMap","RuntimeFailure","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","empty","success","environment"],"sourceRoot":"","sources":["../../_src/control/TestExecutor.ts"],"sourcesContent":[null]}
|
@@ -1,19 +0,0 @@
|
|
1
|
-
const fileName_1 = "(@fncts/test) src/control/TestRunner.ts";
|
2
|
-
import * as tsplus_module_1 from "@fncts/test/control/TestRenderer/ConsoleRenderer";
|
3
|
-
import * as tsplus_module_2 from "@fncts/test/control/TestAnnotationRenderer/api";
|
4
|
-
import * as tsplus_module_3 from "@fncts/test/control/DefaultTestReporter/render";
|
5
|
-
import * as tsplus_module_4 from "@fncts/test/control/TestLogger";
|
6
|
-
import * as tsplus_module_5 from "@fncts/io/IO/api";
|
7
|
-
import * as tsplus_module_6 from "@fncts/io/Clock/api";
|
8
|
-
import * as tsplus_module_7 from "@fncts/base/data/ExecutionStrategy";
|
9
|
-
export class TestRunner {
|
10
|
-
constructor(executor, reporter, bootstrap) {
|
11
|
-
this.executor = executor;
|
12
|
-
this.reporter = reporter ?? tsplus_module_3.report(tsplus_module_1.render, tsplus_module_2.Default);
|
13
|
-
this.bootstrap = bootstrap ?? tsplus_module_4.fromConsole;
|
14
|
-
}
|
15
|
-
run(spec) {
|
16
|
-
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))));
|
17
|
-
}
|
18
|
-
}
|
19
|
-
//# sourceMappingURL=TestRunner.mjs.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"TestRunner.mjs","mappings":";;;;;;;;AAYA,OAAM,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","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]}
|
@@ -1,47 +0,0 @@
|
|
1
|
-
import type { Spec } from "@fncts/test/control/Spec";
|
2
|
-
import type { TestArgs } from "@fncts/test/data/TestArgs";
|
3
|
-
|
4
|
-
import { matchTag } from "@fncts/base/util/pattern";
|
5
|
-
import { isObject } from "@fncts/base/util/predicates";
|
6
|
-
import { AbstractRunnableSpec } from "@fncts/test/control/AbstractRunnableSpec";
|
7
|
-
import { SummaryBuilder } from "@fncts/test/control/SummaryBuilder";
|
8
|
-
import { TestLogger } from "@fncts/test/control/TestLogger";
|
9
|
-
|
10
|
-
export abstract class RunnableSpec<R, E> extends AbstractRunnableSpec<R, E> {
|
11
|
-
readonly _tag = "RunnableSpec";
|
12
|
-
run(spec: Spec<R, E>): URIO<TestLogger, number> {
|
13
|
-
const self = this;
|
14
|
-
return Do((_) => {
|
15
|
-
const results = _(self.runSpec(spec));
|
16
|
-
const hasFailures = results.some(
|
17
|
-
matchTag(
|
18
|
-
{
|
19
|
-
Test: ({ test }) => test.isLeft(),
|
20
|
-
},
|
21
|
-
() => false,
|
22
|
-
),
|
23
|
-
);
|
24
|
-
const summary = SummaryBuilder.buildSummary(results);
|
25
|
-
_(TestLogger.logLine(summary.summary));
|
26
|
-
return hasFailures ? 1 : 0;
|
27
|
-
});
|
28
|
-
}
|
29
|
-
|
30
|
-
main(_args?: TestArgs): void {
|
31
|
-
// const filteredSpec = this.spec.filterByArgs(args);
|
32
|
-
this.run(this.spec)
|
33
|
-
.provideLayer(this.runner.bootstrap)
|
34
|
-
.unsafeRunAsyncWith((exit) => {
|
35
|
-
exit.match(
|
36
|
-
() => {
|
37
|
-
process.exit(1);
|
38
|
-
},
|
39
|
-
(code) => process.exit(code),
|
40
|
-
);
|
41
|
-
});
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
|
-
export function isRunnableSpec(u: unknown): u is RunnableSpec<unknown, unknown> {
|
46
|
-
return isObject(u) && "_tag" in u && u["_tag"] === "RunnableSpec";
|
47
|
-
}
|
@@ -1,52 +0,0 @@
|
|
1
|
-
import type { TestFailure } from "../data/TestFailure.js";
|
2
|
-
import type { TestSuccess } from "../data/TestSuccess.js";
|
3
|
-
import type { Annotated, Annotations } from "./Annotations.js";
|
4
|
-
import type { Spec, SpecCase } from "./Spec.js";
|
5
|
-
import type { ExecutionStrategy } from "@fncts/base/data/ExecutionStrategy";
|
6
|
-
|
7
|
-
import { matchTag_ } from "@fncts/base/util/pattern";
|
8
|
-
|
9
|
-
import { ExecutedSpec } from "../data/ExecutedSpec.js";
|
10
|
-
import { TestAnnotationMap } from "../data/TestAnnotationMap.js";
|
11
|
-
import { RuntimeFailure } from "../data/TestFailure.js";
|
12
|
-
|
13
|
-
export interface TestExecutor<R> {
|
14
|
-
readonly run: <E>(spec: Spec<R | Annotations, E>, defExec: ExecutionStrategy) => UIO<ExecutedSpec<E>>;
|
15
|
-
readonly environment: Layer<unknown, never, R>;
|
16
|
-
}
|
17
|
-
|
18
|
-
export function defaultTestExecutor<R>(env: Layer<never, never, R | Annotations>): TestExecutor<R | Annotations> {
|
19
|
-
return {
|
20
|
-
run: <E>(spec: Spec<R | Annotations, E>, defExec: ExecutionStrategy): UIO<ExecutedSpec<E>> =>
|
21
|
-
spec.annotated
|
22
|
-
.provideLayer(env)
|
23
|
-
.foreachExec(
|
24
|
-
(cause): UIO<Annotated<Either<TestFailure<E>, TestSuccess>>> =>
|
25
|
-
cause.failureOrCause.match(
|
26
|
-
([failure, annotations]) => IO.succeedNow([Either.left(failure), annotations]),
|
27
|
-
(cause) => IO.succeedNow([Either.left(new RuntimeFailure(cause)), TestAnnotationMap.empty]),
|
28
|
-
),
|
29
|
-
([success, annotations]): UIO<Annotated<Either<TestFailure<E>, TestSuccess>>> =>
|
30
|
-
IO.succeedNow([Either.right(success), annotations]),
|
31
|
-
defExec,
|
32
|
-
)
|
33
|
-
.scoped.flatMap(
|
34
|
-
(s) =>
|
35
|
-
s.foldScoped(
|
36
|
-
(spec: SpecCase<never, never, Annotated<Either<TestFailure<E>, TestSuccess>>, ExecutedSpec<E>>) =>
|
37
|
-
matchTag_(spec, {
|
38
|
-
Exec: ({ spec }) => IO.succeedNow(spec),
|
39
|
-
Labeled: ({ label, spec }) => IO.succeedNow(ExecutedSpec.labeled(spec, label)),
|
40
|
-
Scoped: ({ scoped }) => scoped,
|
41
|
-
Multiple: ({ specs }) => IO.succeedNow(ExecutedSpec.multiple(specs)),
|
42
|
-
Test: ({ test, annotations }) =>
|
43
|
-
test.map(([result, dynamicAnnotations]) =>
|
44
|
-
ExecutedSpec.test(result, annotations.combine(dynamicAnnotations)),
|
45
|
-
),
|
46
|
-
}),
|
47
|
-
defExec,
|
48
|
-
).scoped,
|
49
|
-
),
|
50
|
-
environment: env,
|
51
|
-
};
|
52
|
-
}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import type { RuntimeConfig } from "@fncts/io/RuntimeConfig";
|
2
|
-
import type { Annotations } from "@fncts/test/control/Annotations";
|
3
|
-
import type { TestReporter } from "@fncts/test/control/DefaultTestReporter/render";
|
4
|
-
import type { Spec } from "@fncts/test/control/Spec";
|
5
|
-
import type { TestExecutor } from "@fncts/test/control/TestExecutor";
|
6
|
-
import type { ExecutedSpec } from "@fncts/test/data/ExecutedSpec";
|
7
|
-
|
8
|
-
import { DefaultTestReporter } from "@fncts/test/control/DefaultTestReporter";
|
9
|
-
import { TestAnnotationRenderer } from "@fncts/test/control/TestAnnotationRenderer";
|
10
|
-
import { TestLogger } from "@fncts/test/control/TestLogger";
|
11
|
-
import { ConsoleRenderer } from "@fncts/test/control/TestRenderer/ConsoleRenderer";
|
12
|
-
|
13
|
-
export class TestRunner<R, E> {
|
14
|
-
readonly reporter: TestReporter<E>;
|
15
|
-
readonly bootstrap: Layer<never, never, TestLogger>;
|
16
|
-
constructor(
|
17
|
-
readonly executor: TestExecutor<R>,
|
18
|
-
reporter?: TestReporter<E>,
|
19
|
-
bootstrap?: Layer<never, never, TestLogger>,
|
20
|
-
) {
|
21
|
-
this.reporter = reporter ?? DefaultTestReporter.report(ConsoleRenderer.render, TestAnnotationRenderer.Default);
|
22
|
-
this.bootstrap = bootstrap ?? TestLogger.fromConsole;
|
23
|
-
}
|
24
|
-
|
25
|
-
run(spec: Spec<R | Annotations, E>): URIO<TestLogger, ExecutedSpec<E>> {
|
26
|
-
return this.executor
|
27
|
-
.run(spec, ExecutionStrategy.concurrentBounded(10))
|
28
|
-
.timedWith(Clock.currentTime)
|
29
|
-
.flatMap(([duration, results]) => this.reporter(duration, results).as(results));
|
30
|
-
}
|
31
|
-
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import { URIO } from "@fncts/io/IO/definition";
|
2
|
-
import type { Spec } from "@fncts/test/control/Spec";
|
3
|
-
import type { TestArgs } from "@fncts/test/data/TestArgs";
|
4
|
-
import { AbstractRunnableSpec } from "@fncts/test/control/AbstractRunnableSpec";
|
5
|
-
import { TestLogger } from "@fncts/test/control/TestLogger";
|
6
|
-
export declare abstract class RunnableSpec<R, E> extends AbstractRunnableSpec<R, E> {
|
7
|
-
readonly _tag = "RunnableSpec";
|
8
|
-
run(spec: Spec<R, E>): URIO<TestLogger, number>;
|
9
|
-
main(_args?: TestArgs): void;
|
10
|
-
}
|
11
|
-
export declare function isRunnableSpec(u: unknown): u is RunnableSpec<unknown, unknown>;
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import { UIO } from "@fncts/io/IO/definition";
|
2
|
-
import { Layer } from "@fncts/io/Layer";
|
3
|
-
import { Either } from "@fncts/base/data/Either/definition";
|
4
|
-
import type { Annotations } from "./Annotations.js";
|
5
|
-
import type { Spec } from "./Spec.js";
|
6
|
-
import type { ExecutionStrategy } from "@fncts/base/data/ExecutionStrategy";
|
7
|
-
import { ExecutedSpec } from "../data/ExecutedSpec.js";
|
8
|
-
export interface TestExecutor<R> {
|
9
|
-
readonly run: <E>(spec: Spec<R | Annotations, E>, defExec: ExecutionStrategy) => UIO<ExecutedSpec<E>>;
|
10
|
-
readonly environment: Layer<unknown, never, R>;
|
11
|
-
}
|
12
|
-
export declare function defaultTestExecutor<R>(env: Layer<never, never, R | Annotations>): TestExecutor<R | Annotations>;
|
package/control/TestRunner.d.ts
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
import { Layer } from "@fncts/io/Layer";
|
2
|
-
import { URIO } from "@fncts/io/IO/definition";
|
3
|
-
import { ExecutionStrategy } from "@fncts/base/data/ExecutionStrategy";
|
4
|
-
import { Clock } from "@fncts/io/Clock/definition";
|
5
|
-
import type { Annotations } from "@fncts/test/control/Annotations";
|
6
|
-
import type { TestReporter } from "@fncts/test/control/DefaultTestReporter/render";
|
7
|
-
import type { Spec } from "@fncts/test/control/Spec";
|
8
|
-
import type { TestExecutor } from "@fncts/test/control/TestExecutor";
|
9
|
-
import type { ExecutedSpec } from "@fncts/test/data/ExecutedSpec";
|
10
|
-
import { TestLogger } from "@fncts/test/control/TestLogger";
|
11
|
-
export declare class TestRunner<R, E> {
|
12
|
-
readonly executor: TestExecutor<R>;
|
13
|
-
readonly reporter: TestReporter<E>;
|
14
|
-
readonly bootstrap: Layer<never, never, TestLogger>;
|
15
|
-
constructor(executor: TestExecutor<R>, reporter?: TestReporter<E>, bootstrap?: Layer<never, never, TestLogger>);
|
16
|
-
run(spec: Spec<R | Annotations, E>): URIO<TestLogger, ExecutedSpec<E>>;
|
17
|
-
}
|