@effectionx/bdd 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bdd.test.ts +12 -0
- package/bdd.ts +124 -0
- package/dist/bdd.d.ts +41 -0
- package/dist/bdd.d.ts.map +1 -0
- package/dist/bdd.js +77 -0
- package/dist/mod.d.ts +2 -0
- package/dist/mod.d.ts.map +1 -0
- package/dist/mod.js +3 -0
- package/dist/mod.node.d.ts +10 -0
- package/dist/mod.node.d.ts.map +1 -0
- package/dist/mod.node.js +8 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/mod.deno.ts +128 -0
- package/mod.node.ts +10 -0
- package/mod.ts +3 -0
- package/package.json +20 -18
- package/tsconfig.json +14 -0
- package/esm/_dnt.shims.d.ts +0 -2
- package/esm/_dnt.shims.d.ts.map +0 -1
- package/esm/_dnt.shims.js +0 -57
- package/esm/bdd/mod.d.ts +0 -26
- package/esm/bdd/mod.d.ts.map +0 -1
- package/esm/bdd/mod.js +0 -78
- package/esm/deps/jsr.io/@std/assert/1.0.16/assertion_error.d.ts +0 -26
- package/esm/deps/jsr.io/@std/assert/1.0.16/assertion_error.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/assert/1.0.16/assertion_error.js +0 -30
- package/esm/deps/jsr.io/@std/internal/1.0.12/assertion_state.d.ts +0 -150
- package/esm/deps/jsr.io/@std/internal/1.0.12/assertion_state.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.12/assertion_state.js +0 -237
- package/esm/deps/jsr.io/@std/testing/1.0.16/_test_suite.d.ts +0 -78
- package/esm/deps/jsr.io/@std/testing/1.0.16/_test_suite.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/testing/1.0.16/_test_suite.js +0 -385
- package/esm/deps/jsr.io/@std/testing/1.0.16/bdd.d.ts +0 -336
- package/esm/deps/jsr.io/@std/testing/1.0.16/bdd.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/testing/1.0.16/bdd.js +0 -1057
- package/esm/package.json +0 -3
- package/esm/test-adapter/box.d.ts +0 -4
- package/esm/test-adapter/box.d.ts.map +0 -1
- package/esm/test-adapter/box.js +0 -15
- package/esm/test-adapter/mod.d.ts +0 -77
- package/esm/test-adapter/mod.d.ts.map +0 -1
- package/esm/test-adapter/mod.js +0 -89
- package/script/_dnt.shims.d.ts +0 -2
- package/script/_dnt.shims.d.ts.map +0 -1
- package/script/_dnt.shims.js +0 -60
- package/script/bdd/mod.d.ts +0 -26
- package/script/bdd/mod.d.ts.map +0 -1
- package/script/bdd/mod.js +0 -84
- package/script/deps/jsr.io/@std/assert/1.0.16/assertion_error.d.ts +0 -26
- package/script/deps/jsr.io/@std/assert/1.0.16/assertion_error.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/assert/1.0.16/assertion_error.js +0 -34
- package/script/deps/jsr.io/@std/internal/1.0.12/assertion_state.d.ts +0 -150
- package/script/deps/jsr.io/@std/internal/1.0.12/assertion_state.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.12/assertion_state.js +0 -275
- package/script/deps/jsr.io/@std/testing/1.0.16/_test_suite.d.ts +0 -78
- package/script/deps/jsr.io/@std/testing/1.0.16/_test_suite.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/testing/1.0.16/_test_suite.js +0 -389
- package/script/deps/jsr.io/@std/testing/1.0.16/bdd.d.ts +0 -336
- package/script/deps/jsr.io/@std/testing/1.0.16/bdd.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/testing/1.0.16/bdd.js +0 -1068
- package/script/package.json +0 -3
- package/script/test-adapter/box.d.ts +0 -4
- package/script/test-adapter/box.d.ts.map +0 -1
- package/script/test-adapter/box.js +0 -19
- package/script/test-adapter/mod.d.ts +0 -77
- package/script/test-adapter/mod.d.ts.map +0 -1
- package/script/test-adapter/mod.js +0 -92
package/esm/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/esm/test-adapter/box.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/esm/test-adapter/mod.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
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/script/_dnt.shims.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_dnt.shims.d.ts","sourceRoot":"","sources":["../src/_dnt.shims.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,gCAA2C,CAAC"}
|
package/script/_dnt.shims.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dntGlobalThis = void 0;
|
|
4
|
-
const dntGlobals = {};
|
|
5
|
-
exports.dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
|
|
6
|
-
function createMergeProxy(baseObj, extObj) {
|
|
7
|
-
return new Proxy(baseObj, {
|
|
8
|
-
get(_target, prop, _receiver) {
|
|
9
|
-
if (prop in extObj) {
|
|
10
|
-
return extObj[prop];
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
return baseObj[prop];
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
set(_target, prop, value) {
|
|
17
|
-
if (prop in extObj) {
|
|
18
|
-
delete extObj[prop];
|
|
19
|
-
}
|
|
20
|
-
baseObj[prop] = value;
|
|
21
|
-
return true;
|
|
22
|
-
},
|
|
23
|
-
deleteProperty(_target, prop) {
|
|
24
|
-
let success = false;
|
|
25
|
-
if (prop in extObj) {
|
|
26
|
-
delete extObj[prop];
|
|
27
|
-
success = true;
|
|
28
|
-
}
|
|
29
|
-
if (prop in baseObj) {
|
|
30
|
-
delete baseObj[prop];
|
|
31
|
-
success = true;
|
|
32
|
-
}
|
|
33
|
-
return success;
|
|
34
|
-
},
|
|
35
|
-
ownKeys(_target) {
|
|
36
|
-
const baseKeys = Reflect.ownKeys(baseObj);
|
|
37
|
-
const extKeys = Reflect.ownKeys(extObj);
|
|
38
|
-
const extKeysSet = new Set(extKeys);
|
|
39
|
-
return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];
|
|
40
|
-
},
|
|
41
|
-
defineProperty(_target, prop, desc) {
|
|
42
|
-
if (prop in extObj) {
|
|
43
|
-
delete extObj[prop];
|
|
44
|
-
}
|
|
45
|
-
Reflect.defineProperty(baseObj, prop, desc);
|
|
46
|
-
return true;
|
|
47
|
-
},
|
|
48
|
-
getOwnPropertyDescriptor(_target, prop) {
|
|
49
|
-
if (prop in extObj) {
|
|
50
|
-
return Reflect.getOwnPropertyDescriptor(extObj, prop);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
return Reflect.getOwnPropertyDescriptor(baseObj, prop);
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
has(_target, prop) {
|
|
57
|
-
return prop in extObj || prop in baseObj;
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
|
-
}
|
package/script/bdd/mod.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
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
|
package/script/bdd/mod.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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/script/bdd/mod.js
DELETED
|
@@ -1,84 +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 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,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error thrown when an assertion fails.
|
|
3
|
-
*
|
|
4
|
-
* @example Usage
|
|
5
|
-
* ```ts ignore
|
|
6
|
-
* import { AssertionError } from "@std/assert";
|
|
7
|
-
*
|
|
8
|
-
* try {
|
|
9
|
-
* throw new AssertionError("foo", { cause: "bar" });
|
|
10
|
-
* } catch (error) {
|
|
11
|
-
* if (error instanceof AssertionError) {
|
|
12
|
-
* error.message === "foo"; // true
|
|
13
|
-
* error.cause === "bar"; // true
|
|
14
|
-
* }
|
|
15
|
-
* }
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare class AssertionError extends Error {
|
|
19
|
-
/** Constructs a new instance.
|
|
20
|
-
*
|
|
21
|
-
* @param message The error message.
|
|
22
|
-
* @param options Additional options. This argument is still unstable. It may change in the future release.
|
|
23
|
-
*/
|
|
24
|
-
constructor(message: string, options?: ErrorOptions);
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=assertion_error.d.ts.map
|
|
@@ -1 +0,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,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
3
|
-
// This module is browser compatible.
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.AssertionError = void 0;
|
|
6
|
-
/**
|
|
7
|
-
* Error thrown when an assertion fails.
|
|
8
|
-
*
|
|
9
|
-
* @example Usage
|
|
10
|
-
* ```ts ignore
|
|
11
|
-
* import { AssertionError } from "@std/assert";
|
|
12
|
-
*
|
|
13
|
-
* try {
|
|
14
|
-
* throw new AssertionError("foo", { cause: "bar" });
|
|
15
|
-
* } catch (error) {
|
|
16
|
-
* if (error instanceof AssertionError) {
|
|
17
|
-
* error.message === "foo"; // true
|
|
18
|
-
* error.cause === "bar"; // true
|
|
19
|
-
* }
|
|
20
|
-
* }
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
class AssertionError extends Error {
|
|
24
|
-
/** Constructs a new instance.
|
|
25
|
-
*
|
|
26
|
-
* @param message The error message.
|
|
27
|
-
* @param options Additional options. This argument is still unstable. It may change in the future release.
|
|
28
|
-
*/
|
|
29
|
-
constructor(message, options) {
|
|
30
|
-
super(message, options);
|
|
31
|
-
this.name = "AssertionError";
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.AssertionError = AssertionError;
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
export declare class AssertionState {
|
|
2
|
-
#private;
|
|
3
|
-
constructor();
|
|
4
|
-
/**
|
|
5
|
-
* Get the number that through `expect.assertions` api set.
|
|
6
|
-
*
|
|
7
|
-
* @returns the number that through `expect.assertions` api set.
|
|
8
|
-
*
|
|
9
|
-
* @example Usage
|
|
10
|
-
* ```ts ignore
|
|
11
|
-
* import { AssertionState } from "@std/internal";
|
|
12
|
-
*
|
|
13
|
-
* const assertionState = new AssertionState();
|
|
14
|
-
* assertionState.assertionCount;
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
get assertionCount(): number | undefined;
|
|
18
|
-
/**
|
|
19
|
-
* Get a certain number that assertions were called before.
|
|
20
|
-
*
|
|
21
|
-
* @returns return a certain number that assertions were called before.
|
|
22
|
-
*
|
|
23
|
-
* @example Usage
|
|
24
|
-
* ```ts ignore
|
|
25
|
-
* import { AssertionState } from "@std/internal";
|
|
26
|
-
*
|
|
27
|
-
* const assertionState = new AssertionState();
|
|
28
|
-
* assertionState.assertionTriggeredCount;
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
get assertionTriggeredCount(): number;
|
|
32
|
-
/**
|
|
33
|
-
* If `expect.hasAssertions` called, then through this method to update #state.assertionCheck value.
|
|
34
|
-
*
|
|
35
|
-
* @param val Set #state.assertionCheck's value
|
|
36
|
-
*
|
|
37
|
-
* @example Usage
|
|
38
|
-
* ```ts ignore
|
|
39
|
-
* import { AssertionState } from "@std/internal";
|
|
40
|
-
*
|
|
41
|
-
* const assertionState = new AssertionState();
|
|
42
|
-
* assertionState.setAssertionCheck(true);
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
setAssertionCheck(val: boolean): void;
|
|
46
|
-
/**
|
|
47
|
-
* If any matchers was called, `#state.assertionTriggered` will be set through this method.
|
|
48
|
-
*
|
|
49
|
-
* @param val Set #state.assertionTriggered's value
|
|
50
|
-
*
|
|
51
|
-
* @example Usage
|
|
52
|
-
* ```ts ignore
|
|
53
|
-
* import { AssertionState } from "@std/internal";
|
|
54
|
-
*
|
|
55
|
-
* const assertionState = new AssertionState();
|
|
56
|
-
* assertionState.setAssertionTriggered(true);
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
setAssertionTriggered(val: boolean): void;
|
|
60
|
-
/**
|
|
61
|
-
* If `expect.assertions` called, then through this method to update #state.assertionCheck value.
|
|
62
|
-
*
|
|
63
|
-
* @param num Set #state.assertionCount's value, for example if the value is set 2, that means
|
|
64
|
-
* you must have two assertion matchers call in your test suite.
|
|
65
|
-
*
|
|
66
|
-
* @example Usage
|
|
67
|
-
* ```ts ignore
|
|
68
|
-
* import { AssertionState } from "@std/internal";
|
|
69
|
-
*
|
|
70
|
-
* const assertionState = new AssertionState();
|
|
71
|
-
* assertionState.setAssertionCount(2);
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
setAssertionCount(num: number): void;
|
|
75
|
-
/**
|
|
76
|
-
* If any matchers was called, `#state.assertionTriggeredCount` value will plus one internally.
|
|
77
|
-
*
|
|
78
|
-
* @example Usage
|
|
79
|
-
* ```ts ignore
|
|
80
|
-
* import { AssertionState } from "@std/internal";
|
|
81
|
-
*
|
|
82
|
-
* const assertionState = new AssertionState();
|
|
83
|
-
* assertionState.updateAssertionTriggerCount();
|
|
84
|
-
* ```
|
|
85
|
-
*/
|
|
86
|
-
updateAssertionTriggerCount(): void;
|
|
87
|
-
/**
|
|
88
|
-
* Check Assertion internal state, if `#state.assertionCheck` is set true, but
|
|
89
|
-
* `#state.assertionTriggered` is still false, then should throw an Assertion Error.
|
|
90
|
-
*
|
|
91
|
-
* @returns a boolean value, that the test suite is satisfied with the check. If not,
|
|
92
|
-
* it should throw an AssertionError.
|
|
93
|
-
*
|
|
94
|
-
* @example Usage
|
|
95
|
-
* ```ts ignore
|
|
96
|
-
* import { AssertionState } from "@std/internal";
|
|
97
|
-
*
|
|
98
|
-
* const assertionState = new AssertionState();
|
|
99
|
-
* if (assertionState.checkAssertionErrorState()) {
|
|
100
|
-
* // throw AssertionError("");
|
|
101
|
-
* }
|
|
102
|
-
* ```
|
|
103
|
-
*/
|
|
104
|
-
checkAssertionErrorState(): boolean;
|
|
105
|
-
/**
|
|
106
|
-
* Reset all assertion state when every test suite function ran completely.
|
|
107
|
-
*
|
|
108
|
-
* @example Usage
|
|
109
|
-
* ```ts ignore
|
|
110
|
-
* import { AssertionState } from "@std/internal";
|
|
111
|
-
*
|
|
112
|
-
* const assertionState = new AssertionState();
|
|
113
|
-
* assertionState.resetAssertionState();
|
|
114
|
-
* ```
|
|
115
|
-
*/
|
|
116
|
-
resetAssertionState(): void;
|
|
117
|
-
/**
|
|
118
|
-
* Check Assertion called state, if `#state.assertionCount` is set to a number value, but
|
|
119
|
-
* `#state.assertionTriggeredCount` is less then it, then should throw an assertion error.
|
|
120
|
-
*
|
|
121
|
-
* @returns a boolean value, that the test suite is satisfied with the check. If not,
|
|
122
|
-
* it should throw an AssertionError.
|
|
123
|
-
*
|
|
124
|
-
* @example Usage
|
|
125
|
-
* ```ts ignore
|
|
126
|
-
* import { AssertionState } from "@std/internal";
|
|
127
|
-
*
|
|
128
|
-
* const assertionState = new AssertionState();
|
|
129
|
-
* if (assertionState.checkAssertionCountSatisfied()) {
|
|
130
|
-
* // throw AssertionError("");
|
|
131
|
-
* }
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
checkAssertionCountSatisfied(): boolean;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* return an instance of AssertionState
|
|
138
|
-
*
|
|
139
|
-
* @returns AssertionState
|
|
140
|
-
*
|
|
141
|
-
* @example Usage
|
|
142
|
-
* ```ts ignore
|
|
143
|
-
* import { getAssertionState } from "@std/internal";
|
|
144
|
-
*
|
|
145
|
-
* const assertionState = getAssertionState();
|
|
146
|
-
* assertionState.setAssertionTriggered(true);
|
|
147
|
-
* ```
|
|
148
|
-
*/
|
|
149
|
-
export declare function getAssertionState(): AssertionState;
|
|
150
|
-
//# sourceMappingURL=assertion_state.d.ts.map
|
|
@@ -1 +0,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"}
|