@genesislcap/foundation-testing 14.225.3 → 14.225.4-alpha-9342136.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/dist/cjs/component/fixture.js +2 -2
- package/dist/cjs/playwright/test.js +2 -2
- package/dist/cjs/playwright-bdd/index.js +2 -2
- package/dist/esm/component/fixture.js +2 -2
- package/dist/esm/playwright/test.js +2 -2
- package/dist/esm/playwright-bdd/index.js +2 -2
- package/dist/foundation-testing.api.json +90 -22
- package/dist/tsdoc-metadata.json +1 -1
- package/docs/api/foundation-testing.delayedresolve.md +12 -1
- package/docs/api/foundation-testing.md +2 -2
- package/docs/api/foundation-testing.timeout.md +12 -1
- package/package.json +6 -6
- /package/docs/{api-report.md → api-report.md.api.md} +0 -0
|
@@ -25,8 +25,8 @@ function isElementRegistry(obj) {
|
|
|
25
25
|
* Yields control to the caller one Microtask later, in order to
|
|
26
26
|
* ensure that the DOM has settled. This has changed in the latest version of FAST!
|
|
27
27
|
*/
|
|
28
|
-
function fixture(
|
|
29
|
-
return tslib_1.__awaiter(this,
|
|
28
|
+
function fixture(templateNameOrRegistry_1) {
|
|
29
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* (templateNameOrRegistry, options = {}) {
|
|
30
30
|
const document = options.document || globalThis.document;
|
|
31
31
|
const parent = options.parent || document.createElement('div');
|
|
32
32
|
const source = options.source || {};
|
|
@@ -43,14 +43,14 @@ exports.defaultAuditThresholds = {
|
|
|
43
43
|
exports.test = test_1.test.extend({
|
|
44
44
|
config: [exports.defaultPackageConfig, { option: true, scope: 'worker', timeout: 60000 }],
|
|
45
45
|
port: [
|
|
46
|
-
(
|
|
46
|
+
(_a, use_1) => tslib_1.__awaiter(void 0, [_a, use_1], void 0, function* ({ config }, use) {
|
|
47
47
|
const port = (0, portfinder_sync_1.getPort)((config === null || config === void 0 ? void 0 : config.PORT) || process.env.PORT || exports.defaultPackageConfig.PORT);
|
|
48
48
|
yield use(port);
|
|
49
49
|
}),
|
|
50
50
|
{ scope: 'worker' }, // option: true
|
|
51
51
|
],
|
|
52
52
|
browser: [
|
|
53
|
-
(
|
|
53
|
+
(_b, use_2) => tslib_1.__awaiter(void 0, [_b, use_2], void 0, function* ({ port }, use) {
|
|
54
54
|
const browser = yield test_1.chromium.launch({
|
|
55
55
|
args: [`--remote-debugging-port=${port}`],
|
|
56
56
|
});
|
|
@@ -15,14 +15,14 @@ exports.test = PlaywrightBDD.test;
|
|
|
15
15
|
exports.testConfig = {
|
|
16
16
|
config: [test_2.defaultPackageConfig, { option: true, scope: 'worker', timeout: 60000 }],
|
|
17
17
|
port: [
|
|
18
|
-
(
|
|
18
|
+
(_a, use_1) => tslib_1.__awaiter(void 0, [_a, use_1], void 0, function* ({ config }, use) {
|
|
19
19
|
const port = (0, portfinder_sync_1.getPort)((config === null || config === void 0 ? void 0 : config.PORT) || process.env.PORT || test_2.defaultPackageConfig.PORT);
|
|
20
20
|
yield use(port);
|
|
21
21
|
}),
|
|
22
22
|
{ scope: 'worker' },
|
|
23
23
|
],
|
|
24
24
|
browser: [
|
|
25
|
-
(
|
|
25
|
+
(_b, use_2) => tslib_1.__awaiter(void 0, [_b, use_2], void 0, function* ({ port }, use) {
|
|
26
26
|
const browser = yield test_1.chromium.launch({
|
|
27
27
|
args: [`--remote-debugging-port=${port}`],
|
|
28
28
|
});
|
|
@@ -22,8 +22,8 @@ function isElementRegistry(obj) {
|
|
|
22
22
|
* Yields control to the caller one Microtask later, in order to
|
|
23
23
|
* ensure that the DOM has settled. This has changed in the latest version of FAST!
|
|
24
24
|
*/
|
|
25
|
-
export function fixture(
|
|
26
|
-
return __awaiter(this,
|
|
25
|
+
export function fixture(templateNameOrRegistry_1) {
|
|
26
|
+
return __awaiter(this, arguments, void 0, function* (templateNameOrRegistry, options = {}) {
|
|
27
27
|
const document = options.document || globalThis.document;
|
|
28
28
|
const parent = options.parent || document.createElement('div');
|
|
29
29
|
const source = options.source || {};
|
|
@@ -37,14 +37,14 @@ export const defaultAuditThresholds = {
|
|
|
37
37
|
export const test = base.extend({
|
|
38
38
|
config: [defaultPackageConfig, { option: true, scope: 'worker', timeout: 60000 }],
|
|
39
39
|
port: [
|
|
40
|
-
(
|
|
40
|
+
(_a, use_1) => __awaiter(void 0, [_a, use_1], void 0, function* ({ config }, use) {
|
|
41
41
|
const port = getPort((config === null || config === void 0 ? void 0 : config.PORT) || process.env.PORT || defaultPackageConfig.PORT);
|
|
42
42
|
yield use(port);
|
|
43
43
|
}),
|
|
44
44
|
{ scope: 'worker' }, // option: true
|
|
45
45
|
],
|
|
46
46
|
browser: [
|
|
47
|
-
(
|
|
47
|
+
(_b, use_2) => __awaiter(void 0, [_b, use_2], void 0, function* ({ port }, use) {
|
|
48
48
|
const browser = yield chromium.launch({
|
|
49
49
|
args: [`--remote-debugging-port=${port}`],
|
|
50
50
|
});
|
|
@@ -12,14 +12,14 @@ export const test = PlaywrightBDD.test;
|
|
|
12
12
|
export const testConfig = {
|
|
13
13
|
config: [defaultPackageConfig, { option: true, scope: 'worker', timeout: 60000 }],
|
|
14
14
|
port: [
|
|
15
|
-
(
|
|
15
|
+
(_a, use_1) => __awaiter(void 0, [_a, use_1], void 0, function* ({ config }, use) {
|
|
16
16
|
const port = getPort((config === null || config === void 0 ? void 0 : config.PORT) || process.env.PORT || defaultPackageConfig.PORT);
|
|
17
17
|
yield use(port);
|
|
18
18
|
}),
|
|
19
19
|
{ scope: 'worker' },
|
|
20
20
|
],
|
|
21
21
|
browser: [
|
|
22
|
-
(
|
|
22
|
+
(_b, use_2) => __awaiter(void 0, [_b, use_2], void 0, function* ({ port }, use) {
|
|
23
23
|
const browser = yield chromium.launch({
|
|
24
24
|
args: [`--remote-debugging-port=${port}`],
|
|
25
25
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"metadata": {
|
|
3
3
|
"toolPackage": "@microsoft/api-extractor",
|
|
4
|
-
"toolVersion": "7.
|
|
4
|
+
"toolVersion": "7.48.0",
|
|
5
5
|
"schemaVersion": 1011,
|
|
6
6
|
"oldestForwardsCompatibleVersion": 1001,
|
|
7
7
|
"tsdocConfig": {
|
|
@@ -556,17 +556,33 @@
|
|
|
556
556
|
"name": "createLogicSuite"
|
|
557
557
|
},
|
|
558
558
|
{
|
|
559
|
-
"kind": "
|
|
560
|
-
"canonicalReference": "@genesislcap/foundation-testing!delayedResolve:
|
|
559
|
+
"kind": "Function",
|
|
560
|
+
"canonicalReference": "@genesislcap/foundation-testing!delayedResolve:function(1)",
|
|
561
561
|
"docComment": "/**\n * Delayed resolve utility.\n *\n * @param result - The result of the promise.\n *\n * @param duration - An optional duration in milliseconds. Defaults to 500.\n *\n * @example\n * ```ts\n * test('delayed resolve', async () => {\n * const mockAPI = delayedResolve({ foo: 'bar' }, 2_000);\n * const result = await mockAPI();\n * });\n * ```\n *\n * @public\n */\n",
|
|
562
562
|
"excerptTokens": [
|
|
563
563
|
{
|
|
564
564
|
"kind": "Content",
|
|
565
|
-
"text": "delayedResolve: "
|
|
565
|
+
"text": "delayedResolve: (result: "
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
"kind": "Content",
|
|
569
|
+
"text": "unknown"
|
|
570
|
+
},
|
|
571
|
+
{
|
|
572
|
+
"kind": "Content",
|
|
573
|
+
"text": ", duration?: "
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
"kind": "Content",
|
|
577
|
+
"text": "number"
|
|
566
578
|
},
|
|
567
579
|
{
|
|
568
580
|
"kind": "Content",
|
|
569
|
-
"text": "
|
|
581
|
+
"text": ") => "
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
"kind": "Content",
|
|
585
|
+
"text": "() => "
|
|
570
586
|
},
|
|
571
587
|
{
|
|
572
588
|
"kind": "Reference",
|
|
@@ -579,13 +595,31 @@
|
|
|
579
595
|
}
|
|
580
596
|
],
|
|
581
597
|
"fileUrlPath": "src/utils/promise.ts",
|
|
582
|
-
"
|
|
598
|
+
"returnTypeTokenRange": {
|
|
599
|
+
"startIndex": 5,
|
|
600
|
+
"endIndex": 8
|
|
601
|
+
},
|
|
583
602
|
"releaseTag": "Public",
|
|
584
|
-
"
|
|
585
|
-
"
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
603
|
+
"overloadIndex": 1,
|
|
604
|
+
"parameters": [
|
|
605
|
+
{
|
|
606
|
+
"parameterName": "result",
|
|
607
|
+
"parameterTypeTokenRange": {
|
|
608
|
+
"startIndex": 1,
|
|
609
|
+
"endIndex": 2
|
|
610
|
+
},
|
|
611
|
+
"isOptional": false
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
"parameterName": "duration",
|
|
615
|
+
"parameterTypeTokenRange": {
|
|
616
|
+
"startIndex": 3,
|
|
617
|
+
"endIndex": 4
|
|
618
|
+
},
|
|
619
|
+
"isOptional": true
|
|
620
|
+
}
|
|
621
|
+
],
|
|
622
|
+
"name": "delayedResolve"
|
|
589
623
|
},
|
|
590
624
|
{
|
|
591
625
|
"kind": "TypeAlias",
|
|
@@ -1950,17 +1984,17 @@
|
|
|
1950
1984
|
"name": "testSpy"
|
|
1951
1985
|
},
|
|
1952
1986
|
{
|
|
1953
|
-
"kind": "
|
|
1954
|
-
"canonicalReference": "@genesislcap/foundation-testing!timeout:
|
|
1987
|
+
"kind": "Function",
|
|
1988
|
+
"canonicalReference": "@genesislcap/foundation-testing!timeout:function(1)",
|
|
1955
1989
|
"docComment": "/**\n * Timeout utility.\n *\n * @param callback - The async test function.\n *\n * @param duration - An optional duration in milliseconds. Defaults to 5_000.\n *\n * @example\n *\n * A promise that never ends.\n * ```ts\n * test(\n * 'should fail',\n * timeout(async () => {\n * await new Promise(() => {});\n * assert.ok(true);\n * }, 5_000),\n * );\n * ```\n *\n * @example\n *\n * A slow API.\n * ```ts\n * test(\n * 'should fail',\n * timeout(async () => {\n * const slowMockAPI = delayedResolve({ foo: 'bar' }, 4_000);\n * await slowMockAPI();\n * assert.unreachable('should have timed out');\n * }, 2_000),\n * );\n * ```\n *\n * @public\n */\n",
|
|
1956
1990
|
"excerptTokens": [
|
|
1957
1991
|
{
|
|
1958
1992
|
"kind": "Content",
|
|
1959
|
-
"text": "timeout: "
|
|
1993
|
+
"text": "timeout: (callback: "
|
|
1960
1994
|
},
|
|
1961
1995
|
{
|
|
1962
1996
|
"kind": "Content",
|
|
1963
|
-
"text": "(
|
|
1997
|
+
"text": "(context: any) => "
|
|
1964
1998
|
},
|
|
1965
1999
|
{
|
|
1966
2000
|
"kind": "Reference",
|
|
@@ -1969,7 +2003,23 @@
|
|
|
1969
2003
|
},
|
|
1970
2004
|
{
|
|
1971
2005
|
"kind": "Content",
|
|
1972
|
-
"text": "<any
|
|
2006
|
+
"text": "<any>"
|
|
2007
|
+
},
|
|
2008
|
+
{
|
|
2009
|
+
"kind": "Content",
|
|
2010
|
+
"text": ", duration?: "
|
|
2011
|
+
},
|
|
2012
|
+
{
|
|
2013
|
+
"kind": "Content",
|
|
2014
|
+
"text": "number"
|
|
2015
|
+
},
|
|
2016
|
+
{
|
|
2017
|
+
"kind": "Content",
|
|
2018
|
+
"text": ") => "
|
|
2019
|
+
},
|
|
2020
|
+
{
|
|
2021
|
+
"kind": "Content",
|
|
2022
|
+
"text": "(context: any) => "
|
|
1973
2023
|
},
|
|
1974
2024
|
{
|
|
1975
2025
|
"kind": "Reference",
|
|
@@ -1982,13 +2032,31 @@
|
|
|
1982
2032
|
}
|
|
1983
2033
|
],
|
|
1984
2034
|
"fileUrlPath": "src/uvu/uvu.ts",
|
|
1985
|
-
"
|
|
2035
|
+
"returnTypeTokenRange": {
|
|
2036
|
+
"startIndex": 7,
|
|
2037
|
+
"endIndex": 10
|
|
2038
|
+
},
|
|
1986
2039
|
"releaseTag": "Public",
|
|
1987
|
-
"
|
|
1988
|
-
"
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
2040
|
+
"overloadIndex": 1,
|
|
2041
|
+
"parameters": [
|
|
2042
|
+
{
|
|
2043
|
+
"parameterName": "callback",
|
|
2044
|
+
"parameterTypeTokenRange": {
|
|
2045
|
+
"startIndex": 1,
|
|
2046
|
+
"endIndex": 4
|
|
2047
|
+
},
|
|
2048
|
+
"isOptional": false
|
|
2049
|
+
},
|
|
2050
|
+
{
|
|
2051
|
+
"parameterName": "duration",
|
|
2052
|
+
"parameterTypeTokenRange": {
|
|
2053
|
+
"startIndex": 5,
|
|
2054
|
+
"endIndex": 6
|
|
2055
|
+
},
|
|
2056
|
+
"isOptional": true
|
|
2057
|
+
}
|
|
2058
|
+
],
|
|
2059
|
+
"name": "timeout"
|
|
1992
2060
|
},
|
|
1993
2061
|
{
|
|
1994
2062
|
"kind": "TypeAlias",
|
package/dist/tsdoc-metadata.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[Home](./index.md) > [@genesislcap/foundation-testing](./foundation-testing.md) > [delayedResolve](./foundation-testing.delayedresolve.md)
|
|
4
4
|
|
|
5
|
-
## delayedResolve
|
|
5
|
+
## delayedResolve() function
|
|
6
6
|
|
|
7
7
|
Delayed resolve utility.
|
|
8
8
|
|
|
@@ -12,6 +12,17 @@ Delayed resolve utility.
|
|
|
12
12
|
delayedResolve: (result: unknown, duration?: number) => () => Promise<unknown>
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
| Parameter | Type | Description |
|
|
18
|
+
| --- | --- | --- |
|
|
19
|
+
| result | unknown | The result of the promise. |
|
|
20
|
+
| duration | number | _(Optional)_ An optional duration in milliseconds. Defaults to 500. |
|
|
21
|
+
|
|
22
|
+
**Returns:**
|
|
23
|
+
|
|
24
|
+
() => Promise<unknown>
|
|
25
|
+
|
|
15
26
|
## Example
|
|
16
27
|
|
|
17
28
|
|
|
@@ -10,11 +10,13 @@
|
|
|
10
10
|
| --- | --- |
|
|
11
11
|
| [createComponentSuite(title, elementNameOrGetter, context, registrations)](./foundation-testing.createcomponentsuite.md) | Create component test suite. |
|
|
12
12
|
| [createLogicSuite(title, context)](./foundation-testing.createlogicsuite.md) | Create logic test suite. |
|
|
13
|
+
| [delayedResolve(result, duration)](./foundation-testing.delayedresolve.md) | Delayed resolve utility. |
|
|
13
14
|
| [fixture(templateNameOrRegistry, options)](./foundation-testing.fixture.md) | Creates a test fixture suitable for testing custom elements, templates, and bindings. |
|
|
14
15
|
| [resetTestHarness(wrapper)](./foundation-testing.resettestharness.md) | Resets the history of the spied functions on the objects so previous running tests don't affect the current test. Must be called at the end of every test even if not asserting on the spies. |
|
|
15
16
|
| [restoreTestHarness(wrapper)](./foundation-testing.restoretestharness.md) | Restores the spied functions back to the original functions without the spies. |
|
|
16
17
|
| [runCases(fn, cases, assertion)](./foundation-testing.runcases.md) | Assert a set of test cases. |
|
|
17
18
|
| [testSpy(constructor)](./foundation-testing.testspy.md) | Decorator: Used on a test harness class based on a <code>FoundationElement</code> to give it extra functionality which can be used during testing. \*Important\* this is to be used on a parent element compared to the element under test. |
|
|
19
|
+
| [timeout(callback, duration)](./foundation-testing.timeout.md) | Timeout utility. |
|
|
18
20
|
|
|
19
21
|
## Interfaces
|
|
20
22
|
|
|
@@ -29,9 +31,7 @@
|
|
|
29
31
|
|
|
30
32
|
| Variable | Description |
|
|
31
33
|
| --- | --- |
|
|
32
|
-
| [delayedResolve](./foundation-testing.delayedresolve.md) | Delayed resolve utility. |
|
|
33
34
|
| [logger](./foundation-testing.logger.md) | Test logger |
|
|
34
|
-
| [timeout](./foundation-testing.timeout.md) | Timeout utility. |
|
|
35
35
|
|
|
36
36
|
## Type Aliases
|
|
37
37
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[Home](./index.md) > [@genesislcap/foundation-testing](./foundation-testing.md) > [timeout](./foundation-testing.timeout.md)
|
|
4
4
|
|
|
5
|
-
## timeout
|
|
5
|
+
## timeout() function
|
|
6
6
|
|
|
7
7
|
Timeout utility.
|
|
8
8
|
|
|
@@ -12,6 +12,17 @@ Timeout utility.
|
|
|
12
12
|
timeout: (callback: (context: any) => Promise<any>, duration?: number) => (context: any) => Promise<any>
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
| Parameter | Type | Description |
|
|
18
|
+
| --- | --- | --- |
|
|
19
|
+
| callback | (context: any) => Promise<any> | The async test function. |
|
|
20
|
+
| duration | number | _(Optional)_ An optional duration in milliseconds. Defaults to 5\_000. |
|
|
21
|
+
|
|
22
|
+
**Returns:**
|
|
23
|
+
|
|
24
|
+
(context: any) => Promise<any>
|
|
25
|
+
|
|
15
26
|
## Example 1
|
|
16
27
|
|
|
17
28
|
A promise that never ends.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-testing",
|
|
3
3
|
"description": "Genesis Foundation Testing",
|
|
4
|
-
"version": "14.225.
|
|
4
|
+
"version": "14.225.4-alpha-9342136.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -72,14 +72,14 @@
|
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@esbuild-kit/cjs-loader": "2.4.2",
|
|
74
74
|
"@microsoft/api-documenter": "^7.19.13",
|
|
75
|
-
"@microsoft/api-extractor": "7.
|
|
75
|
+
"@microsoft/api-extractor": "7.48.0",
|
|
76
76
|
"@types/node": "^20.8.7",
|
|
77
77
|
"@types/sinon": "^10.0.13",
|
|
78
78
|
"rimraf": "^5.0.0",
|
|
79
|
-
"typescript": "
|
|
79
|
+
"typescript": "5.4.2"
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@genesislcap/foundation-logger": "14.225.
|
|
82
|
+
"@genesislcap/foundation-logger": "14.225.4-alpha-9342136.0",
|
|
83
83
|
"@microsoft/fast-element": "1.14.0",
|
|
84
84
|
"@microsoft/fast-foundation": "2.49.6",
|
|
85
85
|
"@playwright/test": "^1.46.1",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"playwright-lighthouse": "^2.2.2",
|
|
90
90
|
"portfinder-sync": "^0.0.2",
|
|
91
91
|
"sinon": "^17.0.1",
|
|
92
|
-
"tslib": "
|
|
92
|
+
"tslib": "2.8.1",
|
|
93
93
|
"tsm": "^2.2.1",
|
|
94
94
|
"uvu": "0.5.4"
|
|
95
95
|
},
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"publishConfig": {
|
|
102
102
|
"access": "public"
|
|
103
103
|
},
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "fc6d550b6235df216dc52fc120675e1a0cde3d1e"
|
|
105
105
|
}
|
|
File without changes
|