@genesislcap/foundation-testing 14.237.1 → 14.237.2-alpha-78ebbc0.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 +57 -60
- package/dist/cjs/component/index.js +15 -2
- package/dist/cjs/index.js +18 -5
- package/dist/cjs/jsdom/setup.js +4 -5
- package/dist/cjs/playwright/index.js +16 -3
- package/dist/cjs/playwright/setup.js +2 -7
- package/dist/cjs/playwright/test.js +33 -11
- package/dist/cjs/playwright-bdd/index.js +31 -9
- package/dist/cjs/suite/index.js +15 -2
- package/dist/cjs/suite/suite.js +24 -12
- package/dist/cjs/utils/harness.js +4 -2
- package/dist/cjs/utils/index.js +18 -5
- package/dist/cjs/utils/promise.js +3 -4
- package/dist/cjs/uvu/index.js +15 -2
- package/dist/cjs/uvu/uvu.js +24 -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/tsconfig.cjs.json +3 -1
- /package/docs/{api-report.md → api-report.md.api.md} +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fixture = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const fast_element_1 = require("@microsoft/fast-element");
|
|
6
5
|
const fast_foundation_1 = require("@microsoft/fast-foundation");
|
|
7
6
|
function findElement(view) {
|
|
@@ -25,66 +24,64 @@ function isElementRegistry(obj) {
|
|
|
25
24
|
* Yields control to the caller one Microtask later, in order to
|
|
26
25
|
* ensure that the DOM has settled. This has changed in the latest version of FAST!
|
|
27
26
|
*/
|
|
28
|
-
function fixture(templateNameOrRegistry, options = {}) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
27
|
+
async function fixture(templateNameOrRegistry, options = {}) {
|
|
28
|
+
const document = options.document || globalThis.document;
|
|
29
|
+
const parent = options.parent || document.createElement('div');
|
|
30
|
+
const source = options.source || {};
|
|
31
|
+
const context = options.context || fast_element_1.defaultExecutionContext;
|
|
32
|
+
if (typeof templateNameOrRegistry === 'string') {
|
|
33
|
+
const html = `<${templateNameOrRegistry}></${templateNameOrRegistry}>`;
|
|
34
|
+
templateNameOrRegistry = new fast_element_1.ViewTemplate(html, []);
|
|
35
|
+
}
|
|
36
|
+
else if (isElementRegistry(templateNameOrRegistry)) {
|
|
37
|
+
templateNameOrRegistry = [templateNameOrRegistry];
|
|
38
|
+
}
|
|
39
|
+
if (Array.isArray(templateNameOrRegistry)) {
|
|
40
|
+
const first = templateNameOrRegistry[0];
|
|
41
|
+
const ds = options.designSystem || fast_foundation_1.DesignSystem.getOrCreate(parent);
|
|
42
|
+
let prefix = '';
|
|
43
|
+
ds.register(templateNameOrRegistry, {
|
|
44
|
+
register(container, dsContext) {
|
|
45
|
+
prefix = dsContext.elementPrefix;
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
const elementName = `${prefix}-${first.definition.baseName}`;
|
|
49
|
+
const html = `<${elementName}></${elementName}>`;
|
|
50
|
+
templateNameOrRegistry = new fast_element_1.ViewTemplate(html, []);
|
|
51
|
+
}
|
|
52
|
+
const view = templateNameOrRegistry.create();
|
|
53
|
+
const element = findElement(view);
|
|
54
|
+
let isConnected = false;
|
|
55
|
+
view.bind(source, context);
|
|
56
|
+
view.appendTo(parent);
|
|
57
|
+
customElements.upgrade(parent);
|
|
58
|
+
// Hook into the Microtask Queue to ensure the DOM is settled
|
|
59
|
+
// before yielding control to the caller.
|
|
60
|
+
await Promise.resolve();
|
|
61
|
+
const connect = async () => {
|
|
62
|
+
if (isConnected) {
|
|
63
|
+
return;
|
|
40
64
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
const elementName = `${prefix}-${first.definition.baseName}`;
|
|
51
|
-
const html = `<${elementName}></${elementName}>`;
|
|
52
|
-
templateNameOrRegistry = new fast_element_1.ViewTemplate(html, []);
|
|
65
|
+
isConnected = true;
|
|
66
|
+
document.body.appendChild(parent);
|
|
67
|
+
await Promise.resolve();
|
|
68
|
+
};
|
|
69
|
+
const disconnect = async () => {
|
|
70
|
+
if (!isConnected) {
|
|
71
|
+
return;
|
|
53
72
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
isConnected = true;
|
|
68
|
-
document.body.appendChild(parent);
|
|
69
|
-
yield Promise.resolve();
|
|
70
|
-
});
|
|
71
|
-
const disconnect = () => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
if (!isConnected) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
isConnected = false;
|
|
76
|
-
document.body.removeChild(parent);
|
|
77
|
-
yield Promise.resolve();
|
|
78
|
-
});
|
|
79
|
-
return {
|
|
80
|
-
document,
|
|
81
|
-
template: templateNameOrRegistry,
|
|
82
|
-
view,
|
|
83
|
-
parent,
|
|
84
|
-
element,
|
|
85
|
-
connect,
|
|
86
|
-
disconnect,
|
|
87
|
-
};
|
|
88
|
-
});
|
|
73
|
+
isConnected = false;
|
|
74
|
+
document.body.removeChild(parent);
|
|
75
|
+
await Promise.resolve();
|
|
76
|
+
};
|
|
77
|
+
return {
|
|
78
|
+
document,
|
|
79
|
+
template: templateNameOrRegistry,
|
|
80
|
+
view,
|
|
81
|
+
parent,
|
|
82
|
+
element,
|
|
83
|
+
connect,
|
|
84
|
+
disconnect,
|
|
85
|
+
};
|
|
89
86
|
}
|
|
90
87
|
exports.fixture = fixture;
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
tslib_1.__exportStar(require("./fixture"), exports);
|
|
17
|
+
__exportStar(require("./fixture"), exports);
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
17
|
exports.Registration = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
18
|
/**
|
|
6
19
|
* Implemented by objects that wish to register dependencies in the container
|
|
7
20
|
* by creating resolvers.
|
|
@@ -9,7 +22,7 @@ const tslib_1 = require("tslib");
|
|
|
9
22
|
*/
|
|
10
23
|
var fast_foundation_1 = require("@microsoft/fast-foundation");
|
|
11
24
|
Object.defineProperty(exports, "Registration", { enumerable: true, get: function () { return fast_foundation_1.Registration; } });
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
25
|
+
__exportStar(require("./component"), exports);
|
|
26
|
+
__exportStar(require("./suite"), exports);
|
|
27
|
+
__exportStar(require("./utils"), exports);
|
|
28
|
+
__exportStar(require("./uvu"), exports);
|
package/dist/cjs/jsdom/setup.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.teardown = exports.setup = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const jsdom_1 = require("jsdom");
|
|
6
5
|
const utils_1 = require("../utils");
|
|
7
6
|
/**
|
|
@@ -25,7 +24,7 @@ function mockDialog(jsdomWindow) {
|
|
|
25
24
|
* Jsdom setup.
|
|
26
25
|
* @public
|
|
27
26
|
*/
|
|
28
|
-
const setup = () =>
|
|
27
|
+
const setup = async () => {
|
|
29
28
|
const { window } = new jsdom_1.JSDOM('<!DOCTYPE html><html lang="en"><head></head><body></body></html>', {
|
|
30
29
|
pretendToBeVisual: true,
|
|
31
30
|
url: 'https://localhost',
|
|
@@ -116,7 +115,7 @@ const setup = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
|
116
115
|
globalThis.DEFAULT_ORGANISATION = '';
|
|
117
116
|
globalThis.DEFAULT_PASSWORD = '';
|
|
118
117
|
globalThis.DEFAULT_USER = '';
|
|
119
|
-
}
|
|
118
|
+
};
|
|
120
119
|
exports.setup = setup;
|
|
121
120
|
/**
|
|
122
121
|
* Jsdom teardown / cleanup.
|
|
@@ -125,7 +124,7 @@ exports.setup = setup;
|
|
|
125
124
|
* This strictly is not required, but may be useful for certain test runs. If used, be mindful that you will need to
|
|
126
125
|
* call setup again before the next test run.
|
|
127
126
|
*/
|
|
128
|
-
const teardown = () =>
|
|
127
|
+
const teardown = async () => {
|
|
129
128
|
delete window.matchMedia;
|
|
130
129
|
delete globalThis.window;
|
|
131
130
|
delete globalThis.customElements;
|
|
@@ -173,7 +172,7 @@ const teardown = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
|
173
172
|
* Cancel all timers etc.
|
|
174
173
|
*/
|
|
175
174
|
window.close();
|
|
176
|
-
}
|
|
175
|
+
};
|
|
177
176
|
exports.teardown = teardown;
|
|
178
177
|
/**
|
|
179
178
|
* Run setup on import by default.
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
17
|
/**
|
|
5
18
|
* Do not export setup
|
|
6
19
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
20
|
+
__exportStar(require("./config"), exports);
|
|
21
|
+
__exportStar(require("./test"), exports);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
3
|
/**
|
|
5
4
|
* @param config - A playwright configuration object.
|
|
6
5
|
* @returns A teardown function.
|
|
@@ -23,11 +22,7 @@ const tslib_1 = require("tslib");
|
|
|
23
22
|
* }
|
|
24
23
|
* ```
|
|
25
24
|
*/
|
|
26
|
-
function setup(config) {
|
|
27
|
-
return
|
|
28
|
-
return function teardown() {
|
|
29
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () { });
|
|
30
|
-
};
|
|
31
|
-
});
|
|
25
|
+
async function setup(config) {
|
|
26
|
+
return async function teardown() { };
|
|
32
27
|
}
|
|
33
28
|
exports.default = setup;
|
|
@@ -1,7 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.test = exports.defaultAuditThresholds = exports.defaultPackageConfig = exports.DEFAULT_PORT = exports.playAudit = exports.base = exports.expect = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
27
|
const test_1 = require("@playwright/test");
|
|
6
28
|
const portfinder_sync_1 = require("portfinder-sync");
|
|
7
29
|
var test_2 = require("@playwright/test");
|
|
@@ -14,10 +36,10 @@ Object.defineProperty(exports, "base", { enumerable: true, get: function () { re
|
|
|
14
36
|
* @returns The lighthouse audit results
|
|
15
37
|
* @public
|
|
16
38
|
*/
|
|
17
|
-
const playAudit = (playwrightLHConfiguration) =>
|
|
18
|
-
const { playAudit: lighthousePlayAudit } =
|
|
39
|
+
const playAudit = async (playwrightLHConfiguration) => {
|
|
40
|
+
const { playAudit: lighthousePlayAudit } = await Promise.resolve().then(() => __importStar(require('playwright-lighthouse')));
|
|
19
41
|
return lighthousePlayAudit(playwrightLHConfiguration);
|
|
20
|
-
}
|
|
42
|
+
};
|
|
21
43
|
exports.playAudit = playAudit;
|
|
22
44
|
exports.DEFAULT_PORT = 5030;
|
|
23
45
|
exports.defaultPackageConfig = {
|
|
@@ -43,19 +65,19 @@ exports.defaultAuditThresholds = {
|
|
|
43
65
|
exports.test = test_1.test.extend({
|
|
44
66
|
config: [exports.defaultPackageConfig, { option: true, scope: 'worker', timeout: 60000 }],
|
|
45
67
|
port: [
|
|
46
|
-
({ config }, use) =>
|
|
68
|
+
async ({ config }, use) => {
|
|
47
69
|
const port = (0, portfinder_sync_1.getPort)((config === null || config === void 0 ? void 0 : config.PORT) || process.env.PORT || exports.defaultPackageConfig.PORT);
|
|
48
|
-
|
|
49
|
-
}
|
|
70
|
+
await use(port);
|
|
71
|
+
},
|
|
50
72
|
{ scope: 'worker' }, // option: true
|
|
51
73
|
],
|
|
52
74
|
browser: [
|
|
53
|
-
({ port }, use) =>
|
|
54
|
-
const browser =
|
|
75
|
+
async ({ port }, use) => {
|
|
76
|
+
const browser = await test_1.chromium.launch({
|
|
55
77
|
args: [`--remote-debugging-port=${port}`],
|
|
56
78
|
});
|
|
57
|
-
|
|
58
|
-
}
|
|
79
|
+
await use(browser);
|
|
80
|
+
},
|
|
59
81
|
{ scope: 'worker' },
|
|
60
82
|
],
|
|
61
83
|
audit: [exports.defaultAuditThresholds, { option: true, scope: 'worker' }], // TODO: These are not being used from other test setups extending this.
|
|
@@ -1,9 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.testConfig = exports.test = exports.PlaywrightBDD = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
27
|
const test_1 = require("@playwright/test");
|
|
6
|
-
const PlaywrightBDD =
|
|
28
|
+
const PlaywrightBDD = __importStar(require("playwright-bdd"));
|
|
7
29
|
exports.PlaywrightBDD = PlaywrightBDD;
|
|
8
30
|
const portfinder_sync_1 = require("portfinder-sync");
|
|
9
31
|
const test_2 = require("../playwright/test");
|
|
@@ -15,19 +37,19 @@ exports.test = PlaywrightBDD.test;
|
|
|
15
37
|
exports.testConfig = {
|
|
16
38
|
config: [test_2.defaultPackageConfig, { option: true, scope: 'worker', timeout: 60000 }],
|
|
17
39
|
port: [
|
|
18
|
-
({ config }, use) =>
|
|
40
|
+
async ({ config }, use) => {
|
|
19
41
|
const port = (0, portfinder_sync_1.getPort)((config === null || config === void 0 ? void 0 : config.PORT) || process.env.PORT || test_2.defaultPackageConfig.PORT);
|
|
20
|
-
|
|
21
|
-
}
|
|
42
|
+
await use(port);
|
|
43
|
+
},
|
|
22
44
|
{ scope: 'worker' },
|
|
23
45
|
],
|
|
24
46
|
browser: [
|
|
25
|
-
({ port }, use) =>
|
|
26
|
-
const browser =
|
|
47
|
+
async ({ port }, use) => {
|
|
48
|
+
const browser = await test_1.chromium.launch({
|
|
27
49
|
args: [`--remote-debugging-port=${port}`],
|
|
28
50
|
});
|
|
29
|
-
|
|
30
|
-
}
|
|
51
|
+
await use(browser);
|
|
52
|
+
},
|
|
31
53
|
{ scope: 'worker' },
|
|
32
54
|
],
|
|
33
55
|
audit: [test_2.defaultAuditThresholds, { option: true, scope: 'worker' }],
|
package/dist/cjs/suite/index.js
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
tslib_1.__exportStar(require("./suite"), exports);
|
|
17
|
+
__exportStar(require("./suite"), exports);
|
package/dist/cjs/suite/suite.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.createLogicSuite = exports.createComponentSuite = exports.runCases = exports.sinon = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
7
|
const fast_foundation_1 = require("@microsoft/fast-foundation");
|
|
6
8
|
const component_1 = require("../component");
|
|
7
9
|
const utils_1 = require("../utils");
|
|
8
10
|
const uvu_1 = require("../uvu");
|
|
9
11
|
var sinon_1 = require("sinon");
|
|
10
|
-
Object.defineProperty(exports, "sinon", { enumerable: true, get: function () { return
|
|
12
|
+
Object.defineProperty(exports, "sinon", { enumerable: true, get: function () { return __importDefault(sinon_1).default; } });
|
|
11
13
|
/**
|
|
12
14
|
* Assert a set of test cases.
|
|
13
15
|
* @param fn - The function to test.
|
|
@@ -92,8 +94,15 @@ exports.runCases = runCases;
|
|
|
92
94
|
* Used to test function output given certain input arguments.
|
|
93
95
|
*/
|
|
94
96
|
function createComponentSuite(title, elementNameOrGetter, context, registrations = []) {
|
|
95
|
-
const Suite = (0, uvu_1.suite)(title,
|
|
96
|
-
|
|
97
|
+
const Suite = (0, uvu_1.suite)(title, {
|
|
98
|
+
element: undefined,
|
|
99
|
+
disconnect: undefined,
|
|
100
|
+
designSystem: undefined,
|
|
101
|
+
container: undefined,
|
|
102
|
+
runCases: undefined,
|
|
103
|
+
...context,
|
|
104
|
+
});
|
|
105
|
+
Suite.before.each(async (c) => {
|
|
97
106
|
try {
|
|
98
107
|
const parent = document.createElement('div');
|
|
99
108
|
const designSystem = fast_foundation_1.DesignSystem.getOrCreate(parent).register(...registrations);
|
|
@@ -106,24 +115,24 @@ function createComponentSuite(title, elementNameOrGetter, context, registrations
|
|
|
106
115
|
* We might need to spread element getters for some test case, for example look at the following Fast test:
|
|
107
116
|
* packages/web-components/fast-foundation/src/picker/picker.spec.ts
|
|
108
117
|
*/
|
|
109
|
-
const { element, connect, disconnect } =
|
|
118
|
+
const { element, connect, disconnect } = await (0, component_1.fixture)(typeof elementNameOrGetter === 'string' ? elementNameOrGetter : elementNameOrGetter(), fixtureOptions);
|
|
110
119
|
c.element = element;
|
|
111
120
|
c.disconnect = disconnect;
|
|
112
121
|
c.designSystem = designSystem;
|
|
113
122
|
c.container = container;
|
|
114
123
|
c.runCases = runCases.bind(Suite);
|
|
115
|
-
|
|
124
|
+
await connect();
|
|
116
125
|
}
|
|
117
126
|
catch (e) {
|
|
118
127
|
utils_1.logger.error(e);
|
|
119
128
|
throw e;
|
|
120
129
|
}
|
|
121
|
-
})
|
|
130
|
+
});
|
|
122
131
|
/* eslint-disable require-atomic-updates */
|
|
123
|
-
Suite.after.each((c) =>
|
|
132
|
+
Suite.after.each(async (c) => {
|
|
124
133
|
try {
|
|
125
134
|
if (c.disconnect) {
|
|
126
|
-
|
|
135
|
+
await c.disconnect();
|
|
127
136
|
}
|
|
128
137
|
c.element = undefined;
|
|
129
138
|
c.disconnect = undefined;
|
|
@@ -135,7 +144,7 @@ function createComponentSuite(title, elementNameOrGetter, context, registrations
|
|
|
135
144
|
utils_1.logger.error(e);
|
|
136
145
|
throw e;
|
|
137
146
|
}
|
|
138
|
-
})
|
|
147
|
+
});
|
|
139
148
|
return Suite;
|
|
140
149
|
}
|
|
141
150
|
exports.createComponentSuite = createComponentSuite;
|
|
@@ -172,10 +181,13 @@ exports.createComponentSuite = createComponentSuite;
|
|
|
172
181
|
* Used to test function output given certain input arguments.
|
|
173
182
|
*/
|
|
174
183
|
function createLogicSuite(title, context) {
|
|
175
|
-
const Suite = (0, uvu_1.suite)(title,
|
|
184
|
+
const Suite = (0, uvu_1.suite)(title, {
|
|
185
|
+
runCases: (fn, cases) => {
|
|
176
186
|
uvu_1.assert.type(fn, 'function');
|
|
177
187
|
cases.forEach(([actual, expects, msg]) => uvu_1.assert.is(fn(...actual), expects, msg));
|
|
178
|
-
}
|
|
188
|
+
},
|
|
189
|
+
...context,
|
|
190
|
+
});
|
|
179
191
|
return Suite;
|
|
180
192
|
}
|
|
181
193
|
exports.createLogicSuite = createLogicSuite;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.restoreTestHarness = exports.resetTestHarness = exports.testSpy = void 0;
|
|
4
|
-
const
|
|
5
|
-
const sinon_1 = tslib_1.__importDefault(require("sinon"));
|
|
7
|
+
const sinon_1 = __importDefault(require("sinon"));
|
|
6
8
|
/**
|
|
7
9
|
* Predicate function used to check whether the object's value is a function
|
|
8
10
|
* we want to spy on. We want to spy on all functions, except the constructor
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
tslib_1.__exportStar(require("./types"), exports);
|
|
17
|
+
__exportStar(require("./logger"), exports);
|
|
18
|
+
__exportStar(require("./harness"), exports);
|
|
19
|
+
__exportStar(require("./promise"), exports);
|
|
20
|
+
__exportStar(require("./types"), exports);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.delayedResolve = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
/**
|
|
6
5
|
* Delayed resolve utility.
|
|
7
6
|
*
|
|
@@ -16,10 +15,10 @@ const tslib_1 = require("tslib");
|
|
|
16
15
|
* @param duration - An optional duration in milliseconds. Defaults to 500.
|
|
17
16
|
* @public
|
|
18
17
|
*/
|
|
19
|
-
const delayedResolve = (result, duration = 500) => () =>
|
|
20
|
-
|
|
18
|
+
const delayedResolve = (result, duration = 500) => async () => {
|
|
19
|
+
await new Promise((resolve) => {
|
|
21
20
|
setTimeout(resolve, duration);
|
|
22
21
|
});
|
|
23
22
|
return result;
|
|
24
|
-
}
|
|
23
|
+
};
|
|
25
24
|
exports.delayedResolve = delayedResolve;
|
package/dist/cjs/uvu/index.js
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
tslib_1.__exportStar(require("./uvu"), exports);
|
|
17
|
+
__exportStar(require("./uvu"), exports);
|
package/dist/cjs/uvu/uvu.js
CHANGED
|
@@ -1,11 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.timeout = exports.test = exports.suite = exports.assert = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
27
|
const uvu_1 = require("uvu");
|
|
6
28
|
Object.defineProperty(exports, "suite", { enumerable: true, get: function () { return uvu_1.suite; } });
|
|
7
29
|
Object.defineProperty(exports, "test", { enumerable: true, get: function () { return uvu_1.test; } });
|
|
8
|
-
const assert =
|
|
30
|
+
const assert = __importStar(require("uvu/assert"));
|
|
9
31
|
exports.assert = assert;
|
|
10
32
|
/**
|
|
11
33
|
* Timeout utility.
|
|
@@ -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.237.
|
|
4
|
+
"version": "14.237.2-alpha-78ebbc0.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.237.
|
|
82
|
+
"@genesislcap/foundation-logger": "14.237.2-alpha-78ebbc0.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": "ab5fa0da6c1d82b0d69754c35801e2b17ae7d018"
|
|
105
105
|
}
|
package/tsconfig.cjs.json
CHANGED
|
File without changes
|