@effectionx/bdd 0.2.2 → 0.3.1
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 +1 -1
- package/esm/bdd/mod.d.ts +26 -0
- package/esm/bdd/mod.d.ts.map +1 -0
- package/esm/bdd/mod.js +78 -0
- package/{script/deps/jsr.io/@std/assert/1.0.14 → esm/deps/jsr.io/@std/assert/1.0.16}/assertion_error.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/assertion_state.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/testing/{1.0.15 → 1.0.16}/_test_suite.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/testing/{1.0.15 → 1.0.16}/_test_suite.js +2 -2
- package/esm/deps/jsr.io/@std/testing/{1.0.15 → 1.0.16}/bdd.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/testing/{1.0.15 → 1.0.16}/bdd.js +2 -2
- package/esm/test-adapter/box.d.ts +4 -0
- package/esm/test-adapter/box.d.ts.map +1 -0
- package/esm/test-adapter/box.js +15 -0
- package/esm/test-adapter/mod.d.ts +77 -0
- package/esm/test-adapter/mod.d.ts.map +1 -0
- package/esm/test-adapter/mod.js +89 -0
- package/package.json +6 -7
- package/script/bdd/mod.d.ts +26 -0
- package/script/bdd/mod.d.ts.map +1 -0
- package/script/bdd/mod.js +84 -0
- package/{esm/deps/jsr.io/@std/assert/1.0.14 → script/deps/jsr.io/@std/assert/1.0.16}/assertion_error.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/assertion_state.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/testing/{1.0.15 → 1.0.16}/_test_suite.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/testing/{1.0.15 → 1.0.16}/_test_suite.js +2 -2
- package/script/deps/jsr.io/@std/testing/{1.0.15 → 1.0.16}/bdd.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/testing/{1.0.15 → 1.0.16}/bdd.js +2 -2
- package/script/test-adapter/box.d.ts +4 -0
- package/script/test-adapter/box.d.ts.map +1 -0
- package/script/test-adapter/box.js +19 -0
- package/script/test-adapter/mod.d.ts +77 -0
- package/script/test-adapter/mod.d.ts.map +1 -0
- package/script/test-adapter/mod.js +92 -0
- package/esm/mod.d.ts +0 -14
- package/esm/mod.d.ts.map +0 -1
- package/esm/mod.js +0 -50
- package/script/mod.d.ts +0 -14
- package/script/mod.d.ts.map +0 -1
- package/script/mod.js +0 -56
- /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/assertion_error.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/assertion_error.js +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/assertion_state.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/assertion_state.js +0 -0
- /package/esm/deps/jsr.io/@std/testing/{1.0.15 → 1.0.16}/_test_suite.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/testing/{1.0.15 → 1.0.16}/bdd.d.ts +0 -0
- /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/assertion_error.d.ts +0 -0
- /package/script/deps/jsr.io/@std/assert/{1.0.14 → 1.0.16}/assertion_error.js +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/assertion_state.d.ts +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.10 → 1.0.12}/assertion_state.js +0 -0
- /package/script/deps/jsr.io/@std/testing/{1.0.15 → 1.0.16}/_test_suite.d.ts +0 -0
- /package/script/deps/jsr.io/@std/testing/{1.0.15 → 1.0.16}/bdd.d.ts +0 -0
package/README.md
CHANGED
package/esm/bdd/mod.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Operation } from "effection";
|
|
2
|
+
/**
|
|
3
|
+
* Sanitization options for test cases and test suites.
|
|
4
|
+
* These options control Deno's test sanitizers.
|
|
5
|
+
*/
|
|
6
|
+
export interface SanitizeOptions {
|
|
7
|
+
/** Ensure the test case does not prematurely cause the process to exit. Defaults to true. */
|
|
8
|
+
sanitizeExit?: boolean;
|
|
9
|
+
/** Check that the number of async completed ops after the test is the same as number of dispatched ops. Defaults to true. */
|
|
10
|
+
sanitizeOps?: boolean;
|
|
11
|
+
/** Ensure the test case does not "leak" resources - ie. the resource table after the test has exactly the same contents as before the test. Defaults to true. */
|
|
12
|
+
sanitizeResources?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function describe(name: string, body: () => void, options?: SanitizeOptions): void;
|
|
15
|
+
export declare namespace describe {
|
|
16
|
+
var skip: <T>(...args: import("../deps/jsr.io/@std/testing/1.0.16/bdd.js").DescribeArgs<T>) => import("../deps/jsr.io/@std/testing/1.0.16/_test_suite.js").TestSuite<T>;
|
|
17
|
+
var only: (name: string, body: () => void, options?: SanitizeOptions) => void;
|
|
18
|
+
}
|
|
19
|
+
export declare function beforeAll(body: () => Operation<void>): void;
|
|
20
|
+
export declare function beforeEach(body: () => Operation<void>): void;
|
|
21
|
+
export declare function it(desc: string, body?: () => Operation<void>, options?: SanitizeOptions): void;
|
|
22
|
+
export declare namespace it {
|
|
23
|
+
var skip: (desc: string, body?: (() => Operation<void>) | undefined, options?: SanitizeOptions | undefined) => ReturnType<typeof it>;
|
|
24
|
+
var only: (desc: string, body: () => Operation<void>, options?: SanitizeOptions) => void;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/bdd/mod.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAO3C;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,6FAA6F;IAC7F,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,6HAA6H;IAC7H,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iKAAiK;IACjK,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAID,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,IAAI,EAChB,OAAO,CAAC,EAAE,eAAe,QAiB1B;yBApBe,QAAQ;;qBAwBhB,MAAM,QACN,MAAM,IAAI,YACN,eAAe,KACxB,IAAI;;AAkBP,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,SAAS,CAAC,IAAI,CAAC,QAEpD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,SAAS,CAAC,IAAI,CAAC,QAErD;AAED,wBAAgB,EAAE,CAChB,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,MAAM,SAAS,CAAC,IAAI,CAAC,EAC5B,OAAO,CAAC,EAAE,eAAe,GACxB,IAAI,CAgBN;yBApBe,EAAE;2CAEH,SAAS,CAAC,IAAI,CAAC,yDAoBc,UAAU,CAAC,OAAO,EAAE,CAAC;qBAMzD,MAAM,QACN,MAAM,SAAS,CAAC,IAAI,CAAC,YACjB,eAAe,KACxB,IAAI"}
|
package/esm/bdd/mod.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { createTestAdapter } from "../test-adapter/mod.js";
|
|
2
|
+
import { afterAll as $afterAll, describe as $describe, it as $it, } from "../deps/jsr.io/@std/testing/1.0.16/bdd.js";
|
|
3
|
+
let current;
|
|
4
|
+
export function describe(name, body, options) {
|
|
5
|
+
const original = current;
|
|
6
|
+
try {
|
|
7
|
+
const child = current = createTestAdapter({ name, parent: original });
|
|
8
|
+
$describe({
|
|
9
|
+
name,
|
|
10
|
+
fn: () => {
|
|
11
|
+
$afterAll(() => child.destroy());
|
|
12
|
+
body();
|
|
13
|
+
},
|
|
14
|
+
...options,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
finally {
|
|
18
|
+
current = original;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
describe.skip = $describe.skip;
|
|
22
|
+
describe.only = function (name, body, options) {
|
|
23
|
+
const original = current;
|
|
24
|
+
try {
|
|
25
|
+
const child = current = createTestAdapter({ name, parent: original });
|
|
26
|
+
$describe.only({
|
|
27
|
+
name,
|
|
28
|
+
fn: () => {
|
|
29
|
+
$afterAll(() => child.destroy());
|
|
30
|
+
body();
|
|
31
|
+
},
|
|
32
|
+
...options,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
finally {
|
|
36
|
+
current = original;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export function beforeAll(body) {
|
|
40
|
+
current?.addOnetimeSetup(body);
|
|
41
|
+
}
|
|
42
|
+
export function beforeEach(body) {
|
|
43
|
+
current?.addSetup(body);
|
|
44
|
+
}
|
|
45
|
+
export function it(desc, body, options) {
|
|
46
|
+
const adapter = current;
|
|
47
|
+
if (!body) {
|
|
48
|
+
$it.skip(desc, () => { });
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
$it({
|
|
52
|
+
name: desc,
|
|
53
|
+
fn: async () => {
|
|
54
|
+
const result = await adapter.runTest(body);
|
|
55
|
+
if (!result.ok) {
|
|
56
|
+
throw result.error;
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
...options,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
it.skip = (...args) => {
|
|
63
|
+
const [desc] = args;
|
|
64
|
+
return $it.skip(desc, () => { });
|
|
65
|
+
};
|
|
66
|
+
it.only = (desc, body, options) => {
|
|
67
|
+
const adapter = current;
|
|
68
|
+
$it.only({
|
|
69
|
+
name: desc,
|
|
70
|
+
fn: async () => {
|
|
71
|
+
const result = await adapter.runTest(body);
|
|
72
|
+
if (!result.ok) {
|
|
73
|
+
throw result.error;
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
...options,
|
|
77
|
+
});
|
|
78
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertion_error.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.
|
|
1
|
+
{"version":3,"file":"assertion_error.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.16/assertion_error.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC;;;;OAIG;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertion_state.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.
|
|
1
|
+
{"version":3,"file":"assertion_state.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.12/assertion_state.ts"],"names":[],"mappings":"AAeA,qBAAa,cAAc;;;IAgDzB;;;;;;;;;;;;OAYG;IACH,IAAI,cAAc,IAAI,MAAM,GAAG,SAAS,CAEvC;IAED;;;;;;;;;;;;OAYG;IACH,IAAI,uBAAuB,IAAI,MAAM,CAEpC;IAED;;;;;;;;;;;;OAYG;IACH,iBAAiB,CAAC,GAAG,EAAE,OAAO;IAI9B;;;;;;;;;;;;OAYG;IACH,qBAAqB,CAAC,GAAG,EAAE,OAAO;IAIlC;;;;;;;;;;;;;OAaG;IACH,iBAAiB,CAAC,GAAG,EAAE,MAAM;IAI7B;;;;;;;;;;OAUG;IACH,2BAA2B;IAM3B;;;;;;;;;;;;;;;;OAgBG;IACH,wBAAwB,IAAI,OAAO;IAInC;;;;;;;;;;OAUG;IACH,mBAAmB,IAAI,IAAI;IAS3B;;;;;;;;;;;;;;;;OAgBG;IACH,4BAA4B,IAAI,OAAO;CAIxC;AAID;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,CAElD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_test_suite.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/testing/1.0.
|
|
1
|
+
{"version":3,"file":"_test_suite.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/testing/1.0.16/_test_suite.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB;kBACL,OAAO,GAAG,SAAS;iBACpB,OAAO,GAAG,SAAS;uBACb,OAAO,GAAG,SAAS;CACpD,CAAC;AAGF,wEAAwE;AACxE,MAAM,WAAW,kBAAkB,CAAC,CAAC,CAAE,SAAQ,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC;IAC5E,iCAAiC;IACjC,EAAE,CAAC,EAAE,MAAM,IAAI,GAAG,SAAS,CAAC;IAC5B;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IACrB,kEAAkE;IAClE,SAAS,CAAC,EACN,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GACnC,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;IAC1C,oEAAoE;IACpE,QAAQ,CAAC,EACL,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GACnC,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;IAC1C,2DAA2D;IAC3D,UAAU,CAAC,EACP,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GACnC,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;IAC1C,6DAA6D;IAC7D,SAAS,CAAC,EACN,CAAC,CAAC,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"../../assert/1.0.
|
|
2
|
+
import { getAssertionState } from "../../internal/1.0.12/assertion_state.js";
|
|
3
|
+
import { AssertionError } from "../../assert/1.0.16/assertion_error.js";
|
|
4
4
|
export const globalSanitizersState = {
|
|
5
5
|
sanitizeExit: undefined,
|
|
6
6
|
sanitizeOps: undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bdd.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/testing/1.0.
|
|
1
|
+
{"version":3,"file":"bdd.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/testing/1.0.16/bdd.ts"],"names":[],"mappings":"AAsZA,OAAO,EACL,KAAK,kBAAkB,EAGvB,KAAK,YAAY,EACjB,KAAK,SAAS,EAEf,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC;AAE5D,uCAAuC;AACvC,MAAM,MAAM,MAAM,CAAC,CAAC,IAChB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,GAC1B;IACA,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC;CACvC,GACC;IACA,IAAI,EAAE,MAAM;IACZ,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAC3D,GACC,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAC5D;IACA,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAC7C,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,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AElD,4EAA4E;IAC5E,IAAI,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EACxB,GAAG,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,GACvB,SAAS,CAAC,CAAC,CAAC,CAUd;yBAZe,QAAQ;eAsCc,CAAC,WAC5B,YAAY,CAAC,CAAC,CAAC,KACvB,SAAS,CAAC,CAAC,CAAC;iBA+B2B,CAAC,WAChC,YAAY,CAAC,CAAC,CAAC,KACvB,SAAS,CAAC,CAAC,CAAC;eA+BuB,CAAC,WAC5B,YAAY,CAAC,CAAC,CAAC,KACvB,SAAS,CAAC,CAAC,CAAC"}
|
|
@@ -400,8 +400,8 @@
|
|
|
400
400
|
*
|
|
401
401
|
* @module
|
|
402
402
|
*/
|
|
403
|
-
import { getAssertionState } from "../../internal/1.0.
|
|
404
|
-
import { AssertionError } from "../../assert/1.0.
|
|
403
|
+
import { getAssertionState } from "../../internal/1.0.12/assertion_state.js";
|
|
404
|
+
import { AssertionError } from "../../assert/1.0.16/assertion_error.js";
|
|
405
405
|
import { globalSanitizersState, TestSuiteInternal, } from "./_test_suite.js";
|
|
406
406
|
/** Generates an ItDefinition from ItArgs. */
|
|
407
407
|
function itDefinition(...args) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../src/test-adapter/box.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,SAAS,EAAE,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AAEjE,wBAAiB,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAMzE;AAED,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAK7C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Err, Ok } from "effection";
|
|
2
|
+
export function* box(content) {
|
|
3
|
+
try {
|
|
4
|
+
return Ok(yield* content());
|
|
5
|
+
}
|
|
6
|
+
catch (error) {
|
|
7
|
+
return Err(error);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export function unbox(result) {
|
|
11
|
+
if (result.ok) {
|
|
12
|
+
return result.value;
|
|
13
|
+
}
|
|
14
|
+
throw result.error;
|
|
15
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { Future, Operation, Result, Scope } from "effection";
|
|
2
|
+
export interface TestOperation {
|
|
3
|
+
(): Operation<void>;
|
|
4
|
+
}
|
|
5
|
+
export interface TestAdapter {
|
|
6
|
+
/**
|
|
7
|
+
* The parent of this adapter. All of the setup from this adapter will be
|
|
8
|
+
* run in addition to the setup of this adapter during `runTest()`
|
|
9
|
+
*/
|
|
10
|
+
readonly parent?: TestAdapter;
|
|
11
|
+
/**
|
|
12
|
+
* The name of this adapter which is mostly useful for debugging purposes
|
|
13
|
+
*/
|
|
14
|
+
readonly name: string;
|
|
15
|
+
/**
|
|
16
|
+
* A qualified name that contains not only the name of this adapter, but of all its
|
|
17
|
+
* ancestors. E.g. `All Tests > File System > write`
|
|
18
|
+
*/
|
|
19
|
+
readonly fullname: string;
|
|
20
|
+
/**
|
|
21
|
+
* A list of this test adapter and every adapter that it descends from.
|
|
22
|
+
*/
|
|
23
|
+
readonly lineage: Array<TestAdapter>;
|
|
24
|
+
/**
|
|
25
|
+
* The setup operations that will be run by this test adapter. It only includes those
|
|
26
|
+
* setups that are associated with this adapter, not those of its ancestors.
|
|
27
|
+
*/
|
|
28
|
+
readonly setup: {
|
|
29
|
+
all: TestOperation[];
|
|
30
|
+
each: TestOperation[];
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Add a setup operation to every test that is part of this adapter. In BDD integrations,
|
|
34
|
+
* this is usually called by `beforEach()`
|
|
35
|
+
*/
|
|
36
|
+
addSetup(op: TestOperation): void;
|
|
37
|
+
/**
|
|
38
|
+
* Add a setup operation that will run exactly once before any tests that are run in this
|
|
39
|
+
* adapter. In BDD integrations, this is usually called by beforeAll()
|
|
40
|
+
*/
|
|
41
|
+
addOnetimeSetup(op: TestOperation): void;
|
|
42
|
+
/**
|
|
43
|
+
* Actually run a test. This evaluates all setup operations, and then after those have completed
|
|
44
|
+
* it runs the body of the test itself.
|
|
45
|
+
*/
|
|
46
|
+
runTest(body: TestOperation): Future<Result<void>>;
|
|
47
|
+
/**
|
|
48
|
+
* Teardown this test adapter and all of the task and resources that are running inside it.
|
|
49
|
+
* This basically destroys the Effection `Scope` associated with this adapter.
|
|
50
|
+
*/
|
|
51
|
+
destroy(): Future<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Used internally to prepare adapters to run test
|
|
54
|
+
*
|
|
55
|
+
* @ignore
|
|
56
|
+
*/
|
|
57
|
+
["@@init@@"](): Operation<Result<Scope>>;
|
|
58
|
+
}
|
|
59
|
+
export interface TestAdapterOptions {
|
|
60
|
+
/**
|
|
61
|
+
* The name of this test adapter which is handy for debugging.
|
|
62
|
+
* Usually, you'll give this the same name as the current test
|
|
63
|
+
* context. For example, when integrating with BDD, this would be
|
|
64
|
+
* the same as
|
|
65
|
+
*/
|
|
66
|
+
name?: string;
|
|
67
|
+
/**
|
|
68
|
+
* The parent test adapter. All of the setup from this adapter will be
|
|
69
|
+
* run in addition to the setup of this adapter during `runTest()`
|
|
70
|
+
*/
|
|
71
|
+
parent?: TestAdapter;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Create a new test adapter with the given options.
|
|
75
|
+
*/
|
|
76
|
+
export declare function createTestAdapter(options?: TestAdapterOptions): TestAdapter;
|
|
77
|
+
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.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A4Fb"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { createScope, Ok, run, suspend, useScope, withResolvers, } from "effection";
|
|
2
|
+
import { box } from "./box.js";
|
|
3
|
+
const anonymousNames = (function* () {
|
|
4
|
+
let count = 1;
|
|
5
|
+
while (true) {
|
|
6
|
+
yield `anonymous test adapter ${count++}`;
|
|
7
|
+
}
|
|
8
|
+
})();
|
|
9
|
+
/**
|
|
10
|
+
* Create a new test adapter with the given options.
|
|
11
|
+
*/
|
|
12
|
+
export function createTestAdapter(options = {}) {
|
|
13
|
+
const setup = {
|
|
14
|
+
all: [],
|
|
15
|
+
each: [],
|
|
16
|
+
};
|
|
17
|
+
const { parent, name = anonymousNames.next().value } = options;
|
|
18
|
+
let scope = undefined;
|
|
19
|
+
let destroy = function* () { };
|
|
20
|
+
const adapter = {
|
|
21
|
+
parent,
|
|
22
|
+
name,
|
|
23
|
+
setup,
|
|
24
|
+
get lineage() {
|
|
25
|
+
const lineage = [adapter];
|
|
26
|
+
for (let current = parent; current; current = current.parent) {
|
|
27
|
+
lineage.unshift(current);
|
|
28
|
+
}
|
|
29
|
+
return lineage;
|
|
30
|
+
},
|
|
31
|
+
get fullname() {
|
|
32
|
+
return adapter.lineage.map((adapter) => adapter.name).join(" > ");
|
|
33
|
+
},
|
|
34
|
+
addSetup(op) {
|
|
35
|
+
setup.each.push(op);
|
|
36
|
+
},
|
|
37
|
+
addOnetimeSetup(op) {
|
|
38
|
+
setup.all.push(op);
|
|
39
|
+
},
|
|
40
|
+
runTest(op) {
|
|
41
|
+
return run(function* () {
|
|
42
|
+
let init = yield* adapter["@@init@@"]();
|
|
43
|
+
if (!init.ok) {
|
|
44
|
+
return init;
|
|
45
|
+
}
|
|
46
|
+
let scope = init.value;
|
|
47
|
+
const setups = adapter.lineage.reduce((all, adapter) => all.concat(adapter.setup.each), []);
|
|
48
|
+
let test = yield* scope.spawn(() => box(function* () {
|
|
49
|
+
for (let fn of setups) {
|
|
50
|
+
yield* fn();
|
|
51
|
+
}
|
|
52
|
+
yield* op();
|
|
53
|
+
}));
|
|
54
|
+
return yield* test;
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
*["@@init@@"]() {
|
|
58
|
+
if (scope) {
|
|
59
|
+
return yield* scope.operation;
|
|
60
|
+
}
|
|
61
|
+
scope = withResolvers();
|
|
62
|
+
let parent = adapter.parent
|
|
63
|
+
? yield* adapter.parent["@@init@@"]()
|
|
64
|
+
: Ok(createScope()[0]);
|
|
65
|
+
if (!parent.ok) {
|
|
66
|
+
scope.resolve(parent);
|
|
67
|
+
return yield* scope.operation;
|
|
68
|
+
}
|
|
69
|
+
let task = yield* parent.value.spawn(function* () {
|
|
70
|
+
let init = yield* box(function* () {
|
|
71
|
+
for (let initializer of adapter.setup.all) {
|
|
72
|
+
yield* initializer();
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
if (!init.ok) {
|
|
76
|
+
scope.resolve(init);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
scope.resolve(Ok(yield* useScope()));
|
|
80
|
+
yield* suspend();
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
destroy = task.halt;
|
|
84
|
+
return yield* scope.operation;
|
|
85
|
+
},
|
|
86
|
+
destroy: () => run(destroy),
|
|
87
|
+
};
|
|
88
|
+
return adapter;
|
|
89
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effectionx/bdd",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"author": "engineering@frontside.com",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
"bugs": {
|
|
11
11
|
"url": "https://github.com/thefrontside/effectionx/issues"
|
|
12
12
|
},
|
|
13
|
-
"main": "./script/mod.js",
|
|
14
|
-
"module": "./esm/mod.js",
|
|
13
|
+
"main": "./script/bdd/mod.js",
|
|
14
|
+
"module": "./esm/bdd/mod.js",
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
17
|
-
"import": "./esm/mod.js",
|
|
18
|
-
"require": "./script/mod.js"
|
|
17
|
+
"import": "./esm/bdd/mod.js",
|
|
18
|
+
"require": "./script/bdd/mod.js"
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"scripts": {},
|
|
@@ -24,8 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"sideEffects": false,
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"
|
|
28
|
-
"effection": "^3"
|
|
27
|
+
"effection": "^3 || ^4.0.0-0"
|
|
29
28
|
},
|
|
30
29
|
"_generatedBy": "dnt@dev"
|
|
31
30
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Operation } from "effection";
|
|
2
|
+
/**
|
|
3
|
+
* Sanitization options for test cases and test suites.
|
|
4
|
+
* These options control Deno's test sanitizers.
|
|
5
|
+
*/
|
|
6
|
+
export interface SanitizeOptions {
|
|
7
|
+
/** Ensure the test case does not prematurely cause the process to exit. Defaults to true. */
|
|
8
|
+
sanitizeExit?: boolean;
|
|
9
|
+
/** Check that the number of async completed ops after the test is the same as number of dispatched ops. Defaults to true. */
|
|
10
|
+
sanitizeOps?: boolean;
|
|
11
|
+
/** Ensure the test case does not "leak" resources - ie. the resource table after the test has exactly the same contents as before the test. Defaults to true. */
|
|
12
|
+
sanitizeResources?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function describe(name: string, body: () => void, options?: SanitizeOptions): void;
|
|
15
|
+
export declare namespace describe {
|
|
16
|
+
var skip: <T>(...args: import("../deps/jsr.io/@std/testing/1.0.16/bdd.js").DescribeArgs<T>) => import("../deps/jsr.io/@std/testing/1.0.16/_test_suite.js").TestSuite<T>;
|
|
17
|
+
var only: (name: string, body: () => void, options?: SanitizeOptions) => void;
|
|
18
|
+
}
|
|
19
|
+
export declare function beforeAll(body: () => Operation<void>): void;
|
|
20
|
+
export declare function beforeEach(body: () => Operation<void>): void;
|
|
21
|
+
export declare function it(desc: string, body?: () => Operation<void>, options?: SanitizeOptions): void;
|
|
22
|
+
export declare namespace it {
|
|
23
|
+
var skip: (desc: string, body?: (() => Operation<void>) | undefined, options?: SanitizeOptions | undefined) => ReturnType<typeof it>;
|
|
24
|
+
var only: (desc: string, body: () => Operation<void>, options?: SanitizeOptions) => void;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/bdd/mod.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAO3C;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,6FAA6F;IAC7F,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,6HAA6H;IAC7H,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,iKAAiK;IACjK,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAID,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,IAAI,EAChB,OAAO,CAAC,EAAE,eAAe,QAiB1B;yBApBe,QAAQ;;qBAwBhB,MAAM,QACN,MAAM,IAAI,YACN,eAAe,KACxB,IAAI;;AAkBP,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,SAAS,CAAC,IAAI,CAAC,QAEpD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,SAAS,CAAC,IAAI,CAAC,QAErD;AAED,wBAAgB,EAAE,CAChB,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,MAAM,SAAS,CAAC,IAAI,CAAC,EAC5B,OAAO,CAAC,EAAE,eAAe,GACxB,IAAI,CAgBN;yBApBe,EAAE;2CAEH,SAAS,CAAC,IAAI,CAAC,yDAoBc,UAAU,CAAC,OAAO,EAAE,CAAC;qBAMzD,MAAM,QACN,MAAM,SAAS,CAAC,IAAI,CAAC,YACjB,eAAe,KACxB,IAAI"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.describe = describe;
|
|
4
|
+
exports.beforeAll = beforeAll;
|
|
5
|
+
exports.beforeEach = beforeEach;
|
|
6
|
+
exports.it = it;
|
|
7
|
+
const mod_js_1 = require("../test-adapter/mod.js");
|
|
8
|
+
const bdd_js_1 = require("../deps/jsr.io/@std/testing/1.0.16/bdd.js");
|
|
9
|
+
let current;
|
|
10
|
+
function describe(name, body, options) {
|
|
11
|
+
const original = current;
|
|
12
|
+
try {
|
|
13
|
+
const child = current = (0, mod_js_1.createTestAdapter)({ name, parent: original });
|
|
14
|
+
(0, bdd_js_1.describe)({
|
|
15
|
+
name,
|
|
16
|
+
fn: () => {
|
|
17
|
+
(0, bdd_js_1.afterAll)(() => child.destroy());
|
|
18
|
+
body();
|
|
19
|
+
},
|
|
20
|
+
...options,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
current = original;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
describe.skip = bdd_js_1.describe.skip;
|
|
28
|
+
describe.only = function (name, body, options) {
|
|
29
|
+
const original = current;
|
|
30
|
+
try {
|
|
31
|
+
const child = current = (0, mod_js_1.createTestAdapter)({ name, parent: original });
|
|
32
|
+
bdd_js_1.describe.only({
|
|
33
|
+
name,
|
|
34
|
+
fn: () => {
|
|
35
|
+
(0, bdd_js_1.afterAll)(() => child.destroy());
|
|
36
|
+
body();
|
|
37
|
+
},
|
|
38
|
+
...options,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
current = original;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
function beforeAll(body) {
|
|
46
|
+
current?.addOnetimeSetup(body);
|
|
47
|
+
}
|
|
48
|
+
function beforeEach(body) {
|
|
49
|
+
current?.addSetup(body);
|
|
50
|
+
}
|
|
51
|
+
function it(desc, body, options) {
|
|
52
|
+
const adapter = current;
|
|
53
|
+
if (!body) {
|
|
54
|
+
bdd_js_1.it.skip(desc, () => { });
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
(0, bdd_js_1.it)({
|
|
58
|
+
name: desc,
|
|
59
|
+
fn: async () => {
|
|
60
|
+
const result = await adapter.runTest(body);
|
|
61
|
+
if (!result.ok) {
|
|
62
|
+
throw result.error;
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
...options,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
it.skip = (...args) => {
|
|
69
|
+
const [desc] = args;
|
|
70
|
+
return bdd_js_1.it.skip(desc, () => { });
|
|
71
|
+
};
|
|
72
|
+
it.only = (desc, body, options) => {
|
|
73
|
+
const adapter = current;
|
|
74
|
+
bdd_js_1.it.only({
|
|
75
|
+
name: desc,
|
|
76
|
+
fn: async () => {
|
|
77
|
+
const result = await adapter.runTest(body);
|
|
78
|
+
if (!result.ok) {
|
|
79
|
+
throw result.error;
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
...options,
|
|
83
|
+
});
|
|
84
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertion_error.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.
|
|
1
|
+
{"version":3,"file":"assertion_error.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/assert/1.0.16/assertion_error.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC;;;;OAIG;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAIpD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertion_state.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.
|
|
1
|
+
{"version":3,"file":"assertion_state.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.12/assertion_state.ts"],"names":[],"mappings":"AAeA,qBAAa,cAAc;;;IAgDzB;;;;;;;;;;;;OAYG;IACH,IAAI,cAAc,IAAI,MAAM,GAAG,SAAS,CAEvC;IAED;;;;;;;;;;;;OAYG;IACH,IAAI,uBAAuB,IAAI,MAAM,CAEpC;IAED;;;;;;;;;;;;OAYG;IACH,iBAAiB,CAAC,GAAG,EAAE,OAAO;IAI9B;;;;;;;;;;;;OAYG;IACH,qBAAqB,CAAC,GAAG,EAAE,OAAO;IAIlC;;;;;;;;;;;;;OAaG;IACH,iBAAiB,CAAC,GAAG,EAAE,MAAM;IAI7B;;;;;;;;;;OAUG;IACH,2BAA2B;IAM3B;;;;;;;;;;;;;;;;OAgBG;IACH,wBAAwB,IAAI,OAAO;IAInC;;;;;;;;;;OAUG;IACH,mBAAmB,IAAI,IAAI;IAS3B;;;;;;;;;;;;;;;;OAgBG;IACH,4BAA4B,IAAI,OAAO;CAIxC;AAID;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,CAElD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_test_suite.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/testing/1.0.
|
|
1
|
+
{"version":3,"file":"_test_suite.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/testing/1.0.16/_test_suite.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB;kBACL,OAAO,GAAG,SAAS;iBACpB,OAAO,GAAG,SAAS;uBACb,OAAO,GAAG,SAAS;CACpD,CAAC;AAGF,wEAAwE;AACxE,MAAM,WAAW,kBAAkB,CAAC,CAAC,CAAE,SAAQ,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC;IAC5E,iCAAiC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,iBAAiB,CAAC,CAAC,CAAC,EAC3B,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC;IAmB9C,4DAA4D;IAC5D,MAAM,CAAC,OAAO,CAAC,CAAC,EACd,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAC3B,IAAI,EAAE,SAAS,EACf,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAcvC,iEAAiE;WACpD,GAAG,CAAC,CAAC,EAChB,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAC3B,OAAO,EAAE,CAAC,EACV,CAAC,EAAE,IAAI,CAAC,WAAW;WA2ER,OAAO,CAAC,CAAC,EACpB,CAAC,EAAE,IAAI,CAAC,WAAW,EACnB,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EAC1D,OAAO,EAAE,CAAC,EACV,WAAW,SAAI;CAiDlB"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.TestSuiteInternal = exports.globalSanitizersState = void 0;
|
|
5
|
-
const assertion_state_js_1 = require("../../internal/1.0.
|
|
6
|
-
const assertion_error_js_1 = require("../../assert/1.0.
|
|
5
|
+
const assertion_state_js_1 = require("../../internal/1.0.12/assertion_state.js");
|
|
6
|
+
const assertion_error_js_1 = require("../../assert/1.0.16/assertion_error.js");
|
|
7
7
|
exports.globalSanitizersState = {
|
|
8
8
|
sanitizeExit: undefined,
|
|
9
9
|
sanitizeOps: undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bdd.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/testing/1.0.
|
|
1
|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CAAC,CAAC,KACvB,SAAS,CAAC,CAAC,CAAC;iBA+B2B,CAAC,WAChC,YAAY,CAAC,CAAC,CAAC,KACvB,SAAS,CAAC,CAAC,CAAC;eA+BuB,CAAC,WAC5B,YAAY,CAAC,CAAC,CAAC,KACvB,SAAS,CAAC,CAAC,CAAC"}
|
|
@@ -411,8 +411,8 @@ exports.describe = describe;
|
|
|
411
411
|
*
|
|
412
412
|
* @module
|
|
413
413
|
*/
|
|
414
|
-
const assertion_state_js_1 = require("../../internal/1.0.
|
|
415
|
-
const assertion_error_js_1 = require("../../assert/1.0.
|
|
414
|
+
const assertion_state_js_1 = require("../../internal/1.0.12/assertion_state.js");
|
|
415
|
+
const assertion_error_js_1 = require("../../assert/1.0.16/assertion_error.js");
|
|
416
416
|
const _test_suite_js_1 = require("./_test_suite.js");
|
|
417
417
|
/** Generates an ItDefinition from ItArgs. */
|
|
418
418
|
function itDefinition(...args) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"box.d.ts","sourceRoot":"","sources":["../../src/test-adapter/box.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,SAAS,EAAE,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AAEjE,wBAAiB,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAMzE;AAED,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAK7C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.box = box;
|
|
4
|
+
exports.unbox = unbox;
|
|
5
|
+
const effection_1 = require("effection");
|
|
6
|
+
function* box(content) {
|
|
7
|
+
try {
|
|
8
|
+
return (0, effection_1.Ok)(yield* content());
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
return (0, effection_1.Err)(error);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function unbox(result) {
|
|
15
|
+
if (result.ok) {
|
|
16
|
+
return result.value;
|
|
17
|
+
}
|
|
18
|
+
throw result.error;
|
|
19
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { Future, Operation, Result, Scope } from "effection";
|
|
2
|
+
export interface TestOperation {
|
|
3
|
+
(): Operation<void>;
|
|
4
|
+
}
|
|
5
|
+
export interface TestAdapter {
|
|
6
|
+
/**
|
|
7
|
+
* The parent of this adapter. All of the setup from this adapter will be
|
|
8
|
+
* run in addition to the setup of this adapter during `runTest()`
|
|
9
|
+
*/
|
|
10
|
+
readonly parent?: TestAdapter;
|
|
11
|
+
/**
|
|
12
|
+
* The name of this adapter which is mostly useful for debugging purposes
|
|
13
|
+
*/
|
|
14
|
+
readonly name: string;
|
|
15
|
+
/**
|
|
16
|
+
* A qualified name that contains not only the name of this adapter, but of all its
|
|
17
|
+
* ancestors. E.g. `All Tests > File System > write`
|
|
18
|
+
*/
|
|
19
|
+
readonly fullname: string;
|
|
20
|
+
/**
|
|
21
|
+
* A list of this test adapter and every adapter that it descends from.
|
|
22
|
+
*/
|
|
23
|
+
readonly lineage: Array<TestAdapter>;
|
|
24
|
+
/**
|
|
25
|
+
* The setup operations that will be run by this test adapter. It only includes those
|
|
26
|
+
* setups that are associated with this adapter, not those of its ancestors.
|
|
27
|
+
*/
|
|
28
|
+
readonly setup: {
|
|
29
|
+
all: TestOperation[];
|
|
30
|
+
each: TestOperation[];
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Add a setup operation to every test that is part of this adapter. In BDD integrations,
|
|
34
|
+
* this is usually called by `beforEach()`
|
|
35
|
+
*/
|
|
36
|
+
addSetup(op: TestOperation): void;
|
|
37
|
+
/**
|
|
38
|
+
* Add a setup operation that will run exactly once before any tests that are run in this
|
|
39
|
+
* adapter. In BDD integrations, this is usually called by beforeAll()
|
|
40
|
+
*/
|
|
41
|
+
addOnetimeSetup(op: TestOperation): void;
|
|
42
|
+
/**
|
|
43
|
+
* Actually run a test. This evaluates all setup operations, and then after those have completed
|
|
44
|
+
* it runs the body of the test itself.
|
|
45
|
+
*/
|
|
46
|
+
runTest(body: TestOperation): Future<Result<void>>;
|
|
47
|
+
/**
|
|
48
|
+
* Teardown this test adapter and all of the task and resources that are running inside it.
|
|
49
|
+
* This basically destroys the Effection `Scope` associated with this adapter.
|
|
50
|
+
*/
|
|
51
|
+
destroy(): Future<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Used internally to prepare adapters to run test
|
|
54
|
+
*
|
|
55
|
+
* @ignore
|
|
56
|
+
*/
|
|
57
|
+
["@@init@@"](): Operation<Result<Scope>>;
|
|
58
|
+
}
|
|
59
|
+
export interface TestAdapterOptions {
|
|
60
|
+
/**
|
|
61
|
+
* The name of this test adapter which is handy for debugging.
|
|
62
|
+
* Usually, you'll give this the same name as the current test
|
|
63
|
+
* context. For example, when integrating with BDD, this would be
|
|
64
|
+
* the same as
|
|
65
|
+
*/
|
|
66
|
+
name?: string;
|
|
67
|
+
/**
|
|
68
|
+
* The parent test adapter. All of the setup from this adapter will be
|
|
69
|
+
* run in addition to the setup of this adapter during `runTest()`
|
|
70
|
+
*/
|
|
71
|
+
parent?: TestAdapter;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Create a new test adapter with the given options.
|
|
75
|
+
*/
|
|
76
|
+
export declare function createTestAdapter(options?: TestAdapterOptions): TestAdapter;
|
|
77
|
+
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/test-adapter/mod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,SAAS,EACT,MAAM,EACN,KAAK,EAEN,MAAM,WAAW,CAAC;AAWnB,MAAM,WAAW,aAAa;IAC5B,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAE9B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAErC;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE;QAAE,GAAG,EAAE,aAAa,EAAE,CAAC;QAAC,IAAI,EAAE,aAAa,EAAE,CAAA;KAAE,CAAC;IAEhE;;;OAGG;IACH,QAAQ,CAAC,EAAE,EAAE,aAAa,GAAG,IAAI,CAAC;IAElC;;;OAGG;IACH,eAAe,CAAC,EAAE,EAAE,aAAa,GAAG,IAAI,CAAC;IAEzC;;;OAGG;IACH,OAAO,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAEnD;;;OAGG;IACH,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC;IAExB;;;;OAIG;IACH,CAAC,UAAU,CAAC,IAAI,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;CAC1C;AAED,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AASD;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE,kBAAuB,GAC/B,WAAW,CA4Fb"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTestAdapter = createTestAdapter;
|
|
4
|
+
const effection_1 = require("effection");
|
|
5
|
+
const box_js_1 = require("./box.js");
|
|
6
|
+
const anonymousNames = (function* () {
|
|
7
|
+
let count = 1;
|
|
8
|
+
while (true) {
|
|
9
|
+
yield `anonymous test adapter ${count++}`;
|
|
10
|
+
}
|
|
11
|
+
})();
|
|
12
|
+
/**
|
|
13
|
+
* Create a new test adapter with the given options.
|
|
14
|
+
*/
|
|
15
|
+
function createTestAdapter(options = {}) {
|
|
16
|
+
const setup = {
|
|
17
|
+
all: [],
|
|
18
|
+
each: [],
|
|
19
|
+
};
|
|
20
|
+
const { parent, name = anonymousNames.next().value } = options;
|
|
21
|
+
let scope = undefined;
|
|
22
|
+
let destroy = function* () { };
|
|
23
|
+
const adapter = {
|
|
24
|
+
parent,
|
|
25
|
+
name,
|
|
26
|
+
setup,
|
|
27
|
+
get lineage() {
|
|
28
|
+
const lineage = [adapter];
|
|
29
|
+
for (let current = parent; current; current = current.parent) {
|
|
30
|
+
lineage.unshift(current);
|
|
31
|
+
}
|
|
32
|
+
return lineage;
|
|
33
|
+
},
|
|
34
|
+
get fullname() {
|
|
35
|
+
return adapter.lineage.map((adapter) => adapter.name).join(" > ");
|
|
36
|
+
},
|
|
37
|
+
addSetup(op) {
|
|
38
|
+
setup.each.push(op);
|
|
39
|
+
},
|
|
40
|
+
addOnetimeSetup(op) {
|
|
41
|
+
setup.all.push(op);
|
|
42
|
+
},
|
|
43
|
+
runTest(op) {
|
|
44
|
+
return (0, effection_1.run)(function* () {
|
|
45
|
+
let init = yield* adapter["@@init@@"]();
|
|
46
|
+
if (!init.ok) {
|
|
47
|
+
return init;
|
|
48
|
+
}
|
|
49
|
+
let scope = init.value;
|
|
50
|
+
const setups = adapter.lineage.reduce((all, adapter) => all.concat(adapter.setup.each), []);
|
|
51
|
+
let test = yield* scope.spawn(() => (0, box_js_1.box)(function* () {
|
|
52
|
+
for (let fn of setups) {
|
|
53
|
+
yield* fn();
|
|
54
|
+
}
|
|
55
|
+
yield* op();
|
|
56
|
+
}));
|
|
57
|
+
return yield* test;
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
*["@@init@@"]() {
|
|
61
|
+
if (scope) {
|
|
62
|
+
return yield* scope.operation;
|
|
63
|
+
}
|
|
64
|
+
scope = (0, effection_1.withResolvers)();
|
|
65
|
+
let parent = adapter.parent
|
|
66
|
+
? yield* adapter.parent["@@init@@"]()
|
|
67
|
+
: (0, effection_1.Ok)((0, effection_1.createScope)()[0]);
|
|
68
|
+
if (!parent.ok) {
|
|
69
|
+
scope.resolve(parent);
|
|
70
|
+
return yield* scope.operation;
|
|
71
|
+
}
|
|
72
|
+
let task = yield* parent.value.spawn(function* () {
|
|
73
|
+
let init = yield* (0, box_js_1.box)(function* () {
|
|
74
|
+
for (let initializer of adapter.setup.all) {
|
|
75
|
+
yield* initializer();
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
if (!init.ok) {
|
|
79
|
+
scope.resolve(init);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
scope.resolve((0, effection_1.Ok)(yield* (0, effection_1.useScope)()));
|
|
83
|
+
yield* (0, effection_1.suspend)();
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
destroy = task.halt;
|
|
87
|
+
return yield* scope.operation;
|
|
88
|
+
},
|
|
89
|
+
destroy: () => (0, effection_1.run)(destroy),
|
|
90
|
+
};
|
|
91
|
+
return adapter;
|
|
92
|
+
}
|
package/esm/mod.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Operation } from "effection";
|
|
2
|
-
export declare function describe(name: string, body: () => void): void;
|
|
3
|
-
export declare namespace describe {
|
|
4
|
-
var skip: <T>(...args: import("./deps/jsr.io/@std/testing/1.0.15/bdd.js").DescribeArgs<T>) => import("./deps/jsr.io/@std/testing/1.0.15/_test_suite.js").TestSuite<T>;
|
|
5
|
-
var only: <T>(...args: import("./deps/jsr.io/@std/testing/1.0.15/bdd.js").DescribeArgs<T>) => import("./deps/jsr.io/@std/testing/1.0.15/_test_suite.js").TestSuite<T>;
|
|
6
|
-
}
|
|
7
|
-
export declare function beforeAll(body: () => Operation<void>): void;
|
|
8
|
-
export declare function beforeEach(body: () => Operation<void>): void;
|
|
9
|
-
export declare function it(desc: string, body?: () => Operation<void>): void;
|
|
10
|
-
export declare namespace it {
|
|
11
|
-
var skip: (desc: string, body?: (() => Operation<void>) | undefined) => ReturnType<typeof it>;
|
|
12
|
-
var only: (desc: string, body: () => Operation<void>) => void;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=mod.d.ts.map
|
package/esm/mod.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAS3C,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,IAAI,QAYtD;yBAZe,QAAQ;;;;AAiBxB,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,SAAS,CAAC,IAAI,CAAC,QAEpD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,SAAS,CAAC,IAAI,CAAC,QAErD;AAED,wBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAYnE;yBAZe,EAAE;2CAA4B,SAAS,CAAC,IAAI,CAAC,kBAcjB,UAAU,CAAC,OAAO,EAAE,CAAC;qBAKhD,MAAM,QAAQ,MAAM,SAAS,CAAC,IAAI,CAAC,KAAG,IAAI"}
|
package/esm/mod.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { createTestAdapter } from "@effectionx/test-adapter";
|
|
2
|
-
import { afterAll as $afterAll, describe as $describe, it as $it, } from "./deps/jsr.io/@std/testing/1.0.15/bdd.js";
|
|
3
|
-
let current;
|
|
4
|
-
export function describe(name, body) {
|
|
5
|
-
const original = current;
|
|
6
|
-
try {
|
|
7
|
-
const child = current = createTestAdapter({ name, parent: original });
|
|
8
|
-
$describe(name, () => {
|
|
9
|
-
$afterAll(() => child.destroy());
|
|
10
|
-
body();
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
finally {
|
|
14
|
-
current = original;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
describe.skip = $describe.skip;
|
|
18
|
-
describe.only = $describe.only;
|
|
19
|
-
export function beforeAll(body) {
|
|
20
|
-
current?.addOnetimeSetup(body);
|
|
21
|
-
}
|
|
22
|
-
export function beforeEach(body) {
|
|
23
|
-
current?.addSetup(body);
|
|
24
|
-
}
|
|
25
|
-
export function it(desc, body) {
|
|
26
|
-
const adapter = current;
|
|
27
|
-
if (!body) {
|
|
28
|
-
$it.skip(desc, () => { });
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
$it(desc, async () => {
|
|
32
|
-
const result = await adapter.runTest(body);
|
|
33
|
-
if (!result.ok) {
|
|
34
|
-
throw result.error;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
it.skip = (...args) => {
|
|
39
|
-
const [desc] = args;
|
|
40
|
-
return $it.skip(desc, () => { });
|
|
41
|
-
};
|
|
42
|
-
it.only = (desc, body) => {
|
|
43
|
-
const adapter = current;
|
|
44
|
-
$it.only(desc, async () => {
|
|
45
|
-
const result = await adapter.runTest(body);
|
|
46
|
-
if (!result.ok) {
|
|
47
|
-
throw result.error;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
};
|
package/script/mod.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Operation } from "effection";
|
|
2
|
-
export declare function describe(name: string, body: () => void): void;
|
|
3
|
-
export declare namespace describe {
|
|
4
|
-
var skip: <T>(...args: import("./deps/jsr.io/@std/testing/1.0.15/bdd.js").DescribeArgs<T>) => import("./deps/jsr.io/@std/testing/1.0.15/_test_suite.js").TestSuite<T>;
|
|
5
|
-
var only: <T>(...args: import("./deps/jsr.io/@std/testing/1.0.15/bdd.js").DescribeArgs<T>) => import("./deps/jsr.io/@std/testing/1.0.15/_test_suite.js").TestSuite<T>;
|
|
6
|
-
}
|
|
7
|
-
export declare function beforeAll(body: () => Operation<void>): void;
|
|
8
|
-
export declare function beforeEach(body: () => Operation<void>): void;
|
|
9
|
-
export declare function it(desc: string, body?: () => Operation<void>): void;
|
|
10
|
-
export declare namespace it {
|
|
11
|
-
var skip: (desc: string, body?: (() => Operation<void>) | undefined) => ReturnType<typeof it>;
|
|
12
|
-
var only: (desc: string, body: () => Operation<void>) => void;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=mod.d.ts.map
|
package/script/mod.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAS3C,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,IAAI,QAYtD;yBAZe,QAAQ;;;;AAiBxB,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,SAAS,CAAC,IAAI,CAAC,QAEpD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,SAAS,CAAC,IAAI,CAAC,QAErD;AAED,wBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAYnE;yBAZe,EAAE;2CAA4B,SAAS,CAAC,IAAI,CAAC,kBAcjB,UAAU,CAAC,OAAO,EAAE,CAAC;qBAKhD,MAAM,QAAQ,MAAM,SAAS,CAAC,IAAI,CAAC,KAAG,IAAI"}
|
package/script/mod.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.describe = describe;
|
|
4
|
-
exports.beforeAll = beforeAll;
|
|
5
|
-
exports.beforeEach = beforeEach;
|
|
6
|
-
exports.it = it;
|
|
7
|
-
const test_adapter_1 = require("@effectionx/test-adapter");
|
|
8
|
-
const bdd_js_1 = require("./deps/jsr.io/@std/testing/1.0.15/bdd.js");
|
|
9
|
-
let current;
|
|
10
|
-
function describe(name, body) {
|
|
11
|
-
const original = current;
|
|
12
|
-
try {
|
|
13
|
-
const child = current = (0, test_adapter_1.createTestAdapter)({ name, parent: original });
|
|
14
|
-
(0, bdd_js_1.describe)(name, () => {
|
|
15
|
-
(0, bdd_js_1.afterAll)(() => child.destroy());
|
|
16
|
-
body();
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
finally {
|
|
20
|
-
current = original;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
describe.skip = bdd_js_1.describe.skip;
|
|
24
|
-
describe.only = bdd_js_1.describe.only;
|
|
25
|
-
function beforeAll(body) {
|
|
26
|
-
current?.addOnetimeSetup(body);
|
|
27
|
-
}
|
|
28
|
-
function beforeEach(body) {
|
|
29
|
-
current?.addSetup(body);
|
|
30
|
-
}
|
|
31
|
-
function it(desc, body) {
|
|
32
|
-
const adapter = current;
|
|
33
|
-
if (!body) {
|
|
34
|
-
bdd_js_1.it.skip(desc, () => { });
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
(0, bdd_js_1.it)(desc, async () => {
|
|
38
|
-
const result = await adapter.runTest(body);
|
|
39
|
-
if (!result.ok) {
|
|
40
|
-
throw result.error;
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
it.skip = (...args) => {
|
|
45
|
-
const [desc] = args;
|
|
46
|
-
return bdd_js_1.it.skip(desc, () => { });
|
|
47
|
-
};
|
|
48
|
-
it.only = (desc, body) => {
|
|
49
|
-
const adapter = current;
|
|
50
|
-
bdd_js_1.it.only(desc, async () => {
|
|
51
|
-
const result = await adapter.runTest(body);
|
|
52
|
-
if (!result.ok) {
|
|
53
|
-
throw result.error;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|