@fluidframework/test-utils 2.0.0-dev-rc.3.0.0.250606 → 2.0.0-dev-rc.3.0.0.253463
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/api-report/test-utils.api.md +35 -35
- package/dist/DriverWrappers.d.ts +1 -1
- package/dist/DriverWrappers.d.ts.map +1 -1
- package/dist/DriverWrappers.js.map +1 -1
- package/dist/TestSummaryUtils.d.ts +4 -4
- package/dist/TestSummaryUtils.d.ts.map +1 -1
- package/dist/TestSummaryUtils.js +12 -12
- package/dist/TestSummaryUtils.js.map +1 -1
- package/dist/containerUtils.d.ts +2 -2
- package/dist/containerUtils.d.ts.map +1 -1
- package/dist/containerUtils.js +3 -3
- package/dist/containerUtils.js.map +1 -1
- package/dist/debug.d.ts.map +1 -1
- package/dist/debug.js.map +1 -1
- package/dist/interfaces.d.ts +1 -1
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/loaderContainerTracker.d.ts +1 -1
- package/dist/loaderContainerTracker.d.ts.map +1 -1
- package/dist/loaderContainerTracker.js +13 -13
- package/dist/loaderContainerTracker.js.map +1 -1
- package/dist/localCodeLoader.d.ts +3 -3
- package/dist/localCodeLoader.d.ts.map +1 -1
- package/dist/localCodeLoader.js +4 -4
- package/dist/localCodeLoader.js.map +1 -1
- package/dist/localLoader.d.ts +2 -2
- package/dist/localLoader.d.ts.map +1 -1
- package/dist/localLoader.js +2 -2
- package/dist/localLoader.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/retry.js +2 -2
- package/dist/retry.js.map +1 -1
- package/dist/test-utils-alpha.d.ts +35 -37
- package/dist/test-utils-beta.d.ts +35 -37
- package/dist/test-utils-public.d.ts +35 -37
- package/dist/test-utils-untrimmed.d.ts +35 -35
- package/dist/testContainerRuntimeFactory.d.ts +5 -5
- package/dist/testContainerRuntimeFactory.d.ts.map +1 -1
- package/dist/testContainerRuntimeFactory.js +15 -13
- package/dist/testContainerRuntimeFactory.js.map +1 -1
- package/dist/testContainerRuntimeFactoryWithDefaultDataStore.d.ts +5 -5
- package/dist/testContainerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -1
- package/dist/testContainerRuntimeFactoryWithDefaultDataStore.js +2 -2
- package/dist/testContainerRuntimeFactoryWithDefaultDataStore.js.map +1 -1
- package/dist/testFluidObject.d.ts +2 -2
- package/dist/testFluidObject.d.ts.map +1 -1
- package/dist/testFluidObject.js +7 -7
- package/dist/testFluidObject.js.map +1 -1
- package/dist/testObjectProvider.d.ts +5 -5
- package/dist/testObjectProvider.d.ts.map +1 -1
- package/dist/testObjectProvider.js +9 -9
- package/dist/testObjectProvider.js.map +1 -1
- package/dist/timeoutUtils.js +4 -4
- package/dist/timeoutUtils.js.map +1 -1
- package/lib/DriverWrappers.d.ts +1 -1
- package/lib/DriverWrappers.d.ts.map +1 -1
- package/lib/DriverWrappers.js.map +1 -1
- package/lib/TestSummaryUtils.d.ts +4 -4
- package/lib/TestSummaryUtils.d.ts.map +1 -1
- package/lib/TestSummaryUtils.js +4 -4
- package/lib/TestSummaryUtils.js.map +1 -1
- package/lib/containerUtils.d.ts +2 -2
- package/lib/containerUtils.d.ts.map +1 -1
- package/lib/containerUtils.js +1 -1
- package/lib/containerUtils.js.map +1 -1
- package/lib/debug.d.ts.map +1 -1
- package/lib/debug.js.map +1 -1
- package/lib/interfaces.d.ts +1 -1
- package/lib/interfaces.d.ts.map +1 -1
- package/lib/interfaces.js.map +1 -1
- package/lib/loaderContainerTracker.d.ts +1 -1
- package/lib/loaderContainerTracker.d.ts.map +1 -1
- package/lib/loaderContainerTracker.js +2 -2
- package/lib/loaderContainerTracker.js.map +1 -1
- package/lib/localCodeLoader.d.ts +3 -3
- package/lib/localCodeLoader.d.ts.map +1 -1
- package/lib/localCodeLoader.js +2 -2
- package/lib/localCodeLoader.js.map +1 -1
- package/lib/localLoader.d.ts +2 -2
- package/lib/localLoader.d.ts.map +1 -1
- package/lib/localLoader.js +1 -1
- package/lib/localLoader.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/retry.js +1 -1
- package/lib/retry.js.map +1 -1
- package/lib/test-utils-alpha.d.ts +35 -37
- package/lib/test-utils-beta.d.ts +35 -37
- package/lib/test-utils-public.d.ts +35 -37
- package/lib/test-utils-untrimmed.d.ts +35 -35
- package/lib/testContainerRuntimeFactory.d.ts +5 -5
- package/lib/testContainerRuntimeFactory.d.ts.map +1 -1
- package/lib/testContainerRuntimeFactory.js +9 -5
- package/lib/testContainerRuntimeFactory.js.map +1 -1
- package/lib/testContainerRuntimeFactoryWithDefaultDataStore.d.ts +5 -5
- package/lib/testContainerRuntimeFactoryWithDefaultDataStore.d.ts.map +1 -1
- package/lib/testContainerRuntimeFactoryWithDefaultDataStore.js +1 -1
- package/lib/testContainerRuntimeFactoryWithDefaultDataStore.js.map +1 -1
- package/lib/testFluidObject.d.ts +2 -2
- package/lib/testFluidObject.d.ts.map +1 -1
- package/lib/testFluidObject.js +3 -3
- package/lib/testFluidObject.js.map +1 -1
- package/lib/testObjectProvider.d.ts +5 -5
- package/lib/testObjectProvider.d.ts.map +1 -1
- package/lib/testObjectProvider.js +2 -2
- package/lib/testObjectProvider.js.map +1 -1
- package/lib/timeoutUtils.js +1 -1
- package/lib/timeoutUtils.js.map +1 -1
- package/lib/tsdoc-metadata.json +11 -0
- package/package.json +22 -34
- package/src/DriverWrappers.ts +1 -1
- package/src/TestSummaryUtils.ts +11 -6
- package/src/containerUtils.ts +4 -3
- package/src/debug.ts +1 -0
- package/src/interfaces.ts +1 -1
- package/src/loaderContainerTracker.ts +5 -3
- package/src/localCodeLoader.ts +6 -5
- package/src/localLoader.ts +4 -3
- package/src/packageVersion.ts +1 -1
- package/src/retry.ts +1 -1
- package/src/testContainerRuntimeFactory.ts +13 -8
- package/src/testContainerRuntimeFactoryWithDefaultDataStore.ts +5 -5
- package/src/testFluidObject.ts +5 -4
- package/src/testObjectProvider.ts +8 -10
- package/src/timeoutUtils.ts +1 -1
- package/lib/test/timeoutUtils.spec.js +0 -165
- package/lib/test/timeoutUtils.spec.js.map +0 -1
- package/lib/test/types/validateTestUtilsPrevious.generated.js +0 -90
- package/lib/test/types/validateTestUtilsPrevious.generated.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/test-utils",
|
|
3
|
-
"version": "2.0.0-dev-rc.3.0.0.
|
|
3
|
+
"version": "2.0.0-dev-rc.3.0.0.253463",
|
|
4
4
|
"description": "Utilities for Fluid tests",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -14,16 +14,6 @@
|
|
|
14
14
|
"type": "module",
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
17
|
-
"import": {
|
|
18
|
-
"types": "./lib/index.d.ts",
|
|
19
|
-
"default": "./lib/index.js"
|
|
20
|
-
},
|
|
21
|
-
"require": {
|
|
22
|
-
"types": "./dist/index.d.ts",
|
|
23
|
-
"default": "./dist/index.js"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
"./public": {
|
|
27
17
|
"import": {
|
|
28
18
|
"types": "./lib/test-utils-public.d.ts",
|
|
29
19
|
"default": "./lib/index.js"
|
|
@@ -77,35 +67,35 @@
|
|
|
77
67
|
"temp-directory": "nyc/.nyc_output"
|
|
78
68
|
},
|
|
79
69
|
"dependencies": {
|
|
80
|
-
"@
|
|
81
|
-
"@fluidframework/
|
|
82
|
-
"@fluidframework/container-
|
|
83
|
-
"@fluidframework/container-
|
|
84
|
-
"@fluidframework/container-runtime
|
|
85
|
-
"@fluidframework/
|
|
86
|
-
"@fluidframework/core-
|
|
87
|
-
"@fluidframework/
|
|
88
|
-
"@fluidframework/datastore
|
|
89
|
-
"@fluidframework/
|
|
90
|
-
"@fluidframework/driver-
|
|
91
|
-
"@fluidframework/
|
|
92
|
-
"@fluidframework/
|
|
70
|
+
"@fluid-internal/test-driver-definitions": "2.0.0-dev-rc.3.0.0.253463",
|
|
71
|
+
"@fluidframework/aqueduct": "2.0.0-dev-rc.3.0.0.253463",
|
|
72
|
+
"@fluidframework/container-definitions": "2.0.0-dev-rc.3.0.0.253463",
|
|
73
|
+
"@fluidframework/container-loader": "2.0.0-dev-rc.3.0.0.253463",
|
|
74
|
+
"@fluidframework/container-runtime": "2.0.0-dev-rc.3.0.0.253463",
|
|
75
|
+
"@fluidframework/container-runtime-definitions": "2.0.0-dev-rc.3.0.0.253463",
|
|
76
|
+
"@fluidframework/core-interfaces": "2.0.0-dev-rc.3.0.0.253463",
|
|
77
|
+
"@fluidframework/core-utils": "2.0.0-dev-rc.3.0.0.253463",
|
|
78
|
+
"@fluidframework/datastore": "2.0.0-dev-rc.3.0.0.253463",
|
|
79
|
+
"@fluidframework/datastore-definitions": "2.0.0-dev-rc.3.0.0.253463",
|
|
80
|
+
"@fluidframework/driver-definitions": "2.0.0-dev-rc.3.0.0.253463",
|
|
81
|
+
"@fluidframework/driver-utils": "2.0.0-dev-rc.3.0.0.253463",
|
|
82
|
+
"@fluidframework/local-driver": "2.0.0-dev-rc.3.0.0.253463",
|
|
83
|
+
"@fluidframework/map": "2.0.0-dev-rc.3.0.0.253463",
|
|
93
84
|
"@fluidframework/protocol-definitions": "^3.2.0",
|
|
94
|
-
"@fluidframework/request-handler": "2.0.0-dev-rc.3.0.0.
|
|
95
|
-
"@fluidframework/routerlicious-driver": "2.0.0-dev-rc.3.0.0.
|
|
96
|
-
"@fluidframework/runtime-definitions": "2.0.0-dev-rc.3.0.0.
|
|
97
|
-
"@fluidframework/runtime-utils": "2.0.0-dev-rc.3.0.0.
|
|
98
|
-
"@fluidframework/telemetry-utils": "2.0.0-dev-rc.3.0.0.
|
|
99
|
-
"@fluidframework/test-driver-definitions": "2.0.0-dev-rc.3.0.0.250606",
|
|
85
|
+
"@fluidframework/request-handler": "2.0.0-dev-rc.3.0.0.253463",
|
|
86
|
+
"@fluidframework/routerlicious-driver": "2.0.0-dev-rc.3.0.0.253463",
|
|
87
|
+
"@fluidframework/runtime-definitions": "2.0.0-dev-rc.3.0.0.253463",
|
|
88
|
+
"@fluidframework/runtime-utils": "2.0.0-dev-rc.3.0.0.253463",
|
|
89
|
+
"@fluidframework/telemetry-utils": "2.0.0-dev-rc.3.0.0.253463",
|
|
100
90
|
"best-random": "^1.0.0",
|
|
101
91
|
"debug": "^4.3.4",
|
|
102
92
|
"mocha": "^10.2.0",
|
|
103
93
|
"uuid": "^9.0.0"
|
|
104
94
|
},
|
|
105
95
|
"devDependencies": {
|
|
106
|
-
"@arethetypeswrong/cli": "^0.
|
|
96
|
+
"@arethetypeswrong/cli": "^0.15.2",
|
|
107
97
|
"@biomejs/biome": "^1.6.2",
|
|
108
|
-
"@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.3.0.0.
|
|
98
|
+
"@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.3.0.0.253463",
|
|
109
99
|
"@fluid-tools/build-cli": "^0.34.0",
|
|
110
100
|
"@fluidframework/build-common": "^2.0.3",
|
|
111
101
|
"@fluidframework/build-tools": "^0.34.0",
|
|
@@ -176,7 +166,6 @@
|
|
|
176
166
|
"build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
|
|
177
167
|
"build:test:esm": "tsc --project ./src/test/tsconfig.json",
|
|
178
168
|
"check:are-the-types-wrong": "attw --pack . --entrypoints .",
|
|
179
|
-
"check:biome": "biome check .",
|
|
180
169
|
"check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
|
181
170
|
"check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
|
|
182
171
|
"ci:build:docs": "api-extractor run",
|
|
@@ -184,7 +173,6 @@
|
|
|
184
173
|
"eslint": "eslint --format stylish src",
|
|
185
174
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
186
175
|
"format": "fluid-build --task format .",
|
|
187
|
-
"format:biome": "biome check --apply .",
|
|
188
176
|
"format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
189
177
|
"lint": "fluid-build . --task lint",
|
|
190
178
|
"lint:fix": "fluid-build . --task eslint:fix --task format",
|
package/src/DriverWrappers.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
IDocumentStorageService,
|
|
11
11
|
IResolvedUrl,
|
|
12
12
|
ISummaryContext,
|
|
13
|
-
} from "@fluidframework/driver-definitions";
|
|
13
|
+
} from "@fluidframework/driver-definitions/internal";
|
|
14
14
|
import { ISummaryTree } from "@fluidframework/protocol-definitions";
|
|
15
15
|
|
|
16
16
|
/**
|
package/src/TestSummaryUtils.ts
CHANGED
|
@@ -3,26 +3,31 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { ContainerRuntimeFactoryWithDefaultDataStore } from "@fluidframework/aqueduct";
|
|
7
|
-
import {
|
|
6
|
+
import { ContainerRuntimeFactoryWithDefaultDataStore } from "@fluidframework/aqueduct/internal";
|
|
7
|
+
import {
|
|
8
|
+
IContainer,
|
|
9
|
+
IHostLoader,
|
|
10
|
+
LoaderHeader,
|
|
11
|
+
} from "@fluidframework/container-definitions/internal";
|
|
8
12
|
import {
|
|
9
13
|
IOnDemandSummarizeOptions,
|
|
10
14
|
ISummarizer,
|
|
11
15
|
ISummaryRuntimeOptions,
|
|
12
|
-
} from "@fluidframework/container-runtime";
|
|
16
|
+
} from "@fluidframework/container-runtime/internal";
|
|
13
17
|
import {
|
|
14
18
|
IConfigProviderBase,
|
|
15
19
|
IRequest,
|
|
16
20
|
IResponse,
|
|
17
21
|
ITelemetryBaseLogger,
|
|
18
22
|
} from "@fluidframework/core-interfaces";
|
|
19
|
-
import { assert } from "@fluidframework/core-utils";
|
|
20
|
-
import { DriverHeader } from "@fluidframework/driver-definitions";
|
|
23
|
+
import { assert } from "@fluidframework/core-utils/internal";
|
|
24
|
+
import { DriverHeader } from "@fluidframework/driver-definitions/internal";
|
|
21
25
|
import { ISummaryTree } from "@fluidframework/protocol-definitions";
|
|
22
26
|
import {
|
|
23
27
|
IFluidDataStoreFactory,
|
|
24
28
|
NamedFluidDataStoreRegistryEntries,
|
|
25
|
-
} from "@fluidframework/runtime-definitions";
|
|
29
|
+
} from "@fluidframework/runtime-definitions/internal";
|
|
30
|
+
|
|
26
31
|
import { createTestConfigProvider } from "./TestConfigs.js";
|
|
27
32
|
import { waitForContainerConnection } from "./containerUtils.js";
|
|
28
33
|
import { createContainerRuntimeFactoryWithDefaultDataStore } from "./testContainerRuntimeFactoryWithDefaultDataStore.js";
|
package/src/containerUtils.ts
CHANGED
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { IContainer } from "@fluidframework/container-definitions";
|
|
6
|
+
import { IContainer } from "@fluidframework/container-definitions/internal";
|
|
7
7
|
import { ConnectionState } from "@fluidframework/container-loader";
|
|
8
8
|
import { IResponse } from "@fluidframework/core-interfaces";
|
|
9
|
-
import { assert } from "@fluidframework/core-utils";
|
|
10
|
-
import { IDataStore } from "@fluidframework/runtime-definitions";
|
|
9
|
+
import { assert } from "@fluidframework/core-utils/internal";
|
|
10
|
+
import { IDataStore } from "@fluidframework/runtime-definitions/internal";
|
|
11
|
+
|
|
11
12
|
import { PromiseExecutor, TimeoutWithError, timeoutPromise } from "./timeoutUtils.js";
|
|
12
13
|
|
|
13
14
|
/**
|
package/src/debug.ts
CHANGED
package/src/interfaces.ts
CHANGED
|
@@ -3,20 +3,22 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { IDeltaQueue } from "@fluidframework/container-definitions";
|
|
7
|
+
import { IContainer, IHostLoader } from "@fluidframework/container-definitions/internal";
|
|
7
8
|
import { ConnectionState } from "@fluidframework/container-loader";
|
|
8
9
|
import {
|
|
9
10
|
IContainerCreateProps,
|
|
10
11
|
IContainerLoadProps,
|
|
11
12
|
// eslint-disable-next-line import/no-internal-modules
|
|
12
13
|
} from "@fluidframework/container-loader/test/container";
|
|
13
|
-
import { assert } from "@fluidframework/core-utils";
|
|
14
|
-
import { canBeCoalescedByService } from "@fluidframework/driver-utils";
|
|
14
|
+
import { assert } from "@fluidframework/core-utils/internal";
|
|
15
|
+
import { canBeCoalescedByService } from "@fluidframework/driver-utils/internal";
|
|
15
16
|
import {
|
|
16
17
|
IDocumentMessage,
|
|
17
18
|
ISequencedDocumentMessage,
|
|
18
19
|
MessageType,
|
|
19
20
|
} from "@fluidframework/protocol-definitions";
|
|
21
|
+
|
|
20
22
|
import { waitForContainerConnection } from "./containerUtils.js";
|
|
21
23
|
import { debug } from "./debug.js";
|
|
22
24
|
import { IOpProcessingController } from "./testObjectProvider.js";
|
package/src/localCodeLoader.ts
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import assert from "assert";
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
import { ContainerRuntimeFactoryWithDefaultDataStore } from "@fluidframework/aqueduct/internal";
|
|
8
9
|
import {
|
|
9
10
|
ICodeDetailsLoader,
|
|
10
11
|
IFluidCodeDetails,
|
|
@@ -12,13 +13,13 @@ import {
|
|
|
12
13
|
IFluidModuleWithDetails,
|
|
13
14
|
IProvideFluidCodeDetailsComparer,
|
|
14
15
|
IProvideRuntimeFactory,
|
|
15
|
-
} from "@fluidframework/container-definitions";
|
|
16
|
-
import { IContainerRuntimeOptions } from "@fluidframework/container-runtime";
|
|
16
|
+
} from "@fluidframework/container-definitions/internal";
|
|
17
|
+
import { IContainerRuntimeOptions } from "@fluidframework/container-runtime/internal";
|
|
17
18
|
import {
|
|
18
19
|
IProvideFluidDataStoreFactory,
|
|
19
20
|
IProvideFluidDataStoreRegistry,
|
|
20
|
-
} from "@fluidframework/runtime-definitions";
|
|
21
|
-
import { createDataStoreFactory } from "@fluidframework/runtime-utils";
|
|
21
|
+
} from "@fluidframework/runtime-definitions/internal";
|
|
22
|
+
import { createDataStoreFactory } from "@fluidframework/runtime-utils/internal";
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* @internal
|
package/src/localLoader.ts
CHANGED
|
@@ -9,10 +9,11 @@ import {
|
|
|
9
9
|
IFluidCodeDetails,
|
|
10
10
|
IHostLoader,
|
|
11
11
|
ILoaderOptions,
|
|
12
|
-
} from "@fluidframework/container-definitions";
|
|
13
|
-
import { Loader } from "@fluidframework/container-loader";
|
|
12
|
+
} from "@fluidframework/container-definitions/internal";
|
|
13
|
+
import { Loader } from "@fluidframework/container-loader/internal";
|
|
14
14
|
import { IRequest, ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
15
|
-
import { IDocumentServiceFactory, IUrlResolver } from "@fluidframework/driver-definitions";
|
|
15
|
+
import { IDocumentServiceFactory, IUrlResolver } from "@fluidframework/driver-definitions/internal";
|
|
16
|
+
|
|
16
17
|
import { LocalCodeLoader, fluidEntryPoint } from "./localCodeLoader.js";
|
|
17
18
|
|
|
18
19
|
/**
|
package/src/packageVersion.ts
CHANGED
package/src/retry.ts
CHANGED
|
@@ -3,27 +3,30 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { IContainerContext, IRuntime } from "@fluidframework/container-definitions";
|
|
6
|
+
import { IContainerContext, IRuntime } from "@fluidframework/container-definitions/internal";
|
|
7
7
|
import {
|
|
8
8
|
ContainerRuntime,
|
|
9
9
|
DefaultSummaryConfiguration,
|
|
10
10
|
IContainerRuntimeOptions,
|
|
11
|
-
} from "@fluidframework/container-runtime";
|
|
12
|
-
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
11
|
+
} from "@fluidframework/container-runtime/internal";
|
|
12
|
+
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
|
|
13
13
|
import {
|
|
14
14
|
FluidObject,
|
|
15
15
|
IFluidHandleContext,
|
|
16
16
|
IRequest,
|
|
17
17
|
IResponse,
|
|
18
18
|
} from "@fluidframework/core-interfaces";
|
|
19
|
-
import { assert } from "@fluidframework/core-utils";
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
import { assert } from "@fluidframework/core-utils/internal";
|
|
20
|
+
import {
|
|
21
|
+
RuntimeRequestHandler,
|
|
22
|
+
// eslint-disable-next-line import/no-deprecated
|
|
23
|
+
buildRuntimeRequestHandler,
|
|
24
|
+
} from "@fluidframework/request-handler/internal";
|
|
22
25
|
import {
|
|
23
26
|
IFluidDataStoreFactory,
|
|
24
27
|
NamedFluidDataStoreRegistryEntries,
|
|
25
|
-
} from "@fluidframework/runtime-definitions";
|
|
26
|
-
import { RequestParser, RuntimeFactoryHelper } from "@fluidframework/runtime-utils";
|
|
28
|
+
} from "@fluidframework/runtime-definitions/internal";
|
|
29
|
+
import { RequestParser, RuntimeFactoryHelper } from "@fluidframework/runtime-utils/internal";
|
|
27
30
|
|
|
28
31
|
interface backCompat_IFluidRouter {
|
|
29
32
|
IFluidRouter?: backCompat_IFluidRouter;
|
|
@@ -130,6 +133,7 @@ export const createTestContainerRuntimeFactory = (
|
|
|
130
133
|
["default", Promise.resolve(this.dataStoreFactory)],
|
|
131
134
|
[this.type, Promise.resolve(this.dataStoreFactory)],
|
|
132
135
|
],
|
|
136
|
+
// eslint-disable-next-line import/no-deprecated
|
|
133
137
|
buildRuntimeRequestHandler(
|
|
134
138
|
backCompat_DefaultRouteRequestHandler("default"),
|
|
135
139
|
...this.requestHandlers,
|
|
@@ -163,6 +167,7 @@ export const createTestContainerRuntimeFactory = (
|
|
|
163
167
|
["default", Promise.resolve(this.dataStoreFactory)],
|
|
164
168
|
[this.type, Promise.resolve(this.dataStoreFactory)],
|
|
165
169
|
],
|
|
170
|
+
// eslint-disable-next-line import/no-deprecated
|
|
166
171
|
requestHandler: buildRuntimeRequestHandler(
|
|
167
172
|
getDefaultObject,
|
|
168
173
|
...this.requestHandlers,
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { ContainerRuntimeFactoryWithDefaultDataStore } from "@fluidframework/aqueduct";
|
|
7
|
-
import { IContainerRuntimeOptions } from "@fluidframework/container-runtime";
|
|
8
|
-
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
|
|
6
|
+
import { ContainerRuntimeFactoryWithDefaultDataStore } from "@fluidframework/aqueduct/internal";
|
|
7
|
+
import { IContainerRuntimeOptions } from "@fluidframework/container-runtime/internal";
|
|
8
|
+
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions/internal";
|
|
9
9
|
import { FluidObject } from "@fluidframework/core-interfaces";
|
|
10
|
-
import { RuntimeRequestHandler } from "@fluidframework/request-handler";
|
|
10
|
+
import { RuntimeRequestHandler } from "@fluidframework/request-handler/internal";
|
|
11
11
|
import {
|
|
12
12
|
IFluidDataStoreFactory,
|
|
13
13
|
NamedFluidDataStoreRegistryEntries,
|
|
14
|
-
} from "@fluidframework/runtime-definitions";
|
|
14
|
+
} from "@fluidframework/runtime-definitions/internal";
|
|
15
15
|
|
|
16
16
|
const getDefaultFluidObject = async (runtime: IContainerRuntime) => {
|
|
17
17
|
const entryPoint = await runtime.getAliasedDataStoreEntryPoint("default");
|
package/src/testFluidObject.ts
CHANGED
|
@@ -4,20 +4,21 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { IFluidHandle, IRequest, IResponse } from "@fluidframework/core-interfaces";
|
|
7
|
-
import { assert } from "@fluidframework/core-utils";
|
|
7
|
+
import { assert } from "@fluidframework/core-utils/internal";
|
|
8
8
|
import {
|
|
9
9
|
FluidDataStoreRuntime,
|
|
10
10
|
FluidObjectHandle,
|
|
11
11
|
mixinRequestHandler,
|
|
12
|
-
} from "@fluidframework/datastore";
|
|
12
|
+
} from "@fluidframework/datastore/internal";
|
|
13
13
|
import { IChannelFactory, IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions";
|
|
14
14
|
import { ISharedMap, SharedMap } from "@fluidframework/map";
|
|
15
15
|
import {
|
|
16
16
|
IFluidDataStoreChannel,
|
|
17
17
|
IFluidDataStoreContext,
|
|
18
18
|
IFluidDataStoreFactory,
|
|
19
|
-
} from "@fluidframework/runtime-definitions";
|
|
20
|
-
import { create404Response } from "@fluidframework/runtime-utils";
|
|
19
|
+
} from "@fluidframework/runtime-definitions/internal";
|
|
20
|
+
import { create404Response } from "@fluidframework/runtime-utils/internal";
|
|
21
|
+
|
|
21
22
|
import { ITestFluidObject } from "./interfaces.js";
|
|
22
23
|
|
|
23
24
|
/**
|
|
@@ -3,18 +3,19 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { ITestDriver, TestDriverTypes } from "@fluid-internal/test-driver-definitions";
|
|
6
7
|
import {
|
|
7
8
|
IContainer,
|
|
8
9
|
IFluidCodeDetails,
|
|
9
10
|
IHostLoader,
|
|
10
11
|
ILoader,
|
|
11
|
-
} from "@fluidframework/container-definitions";
|
|
12
|
+
} from "@fluidframework/container-definitions/internal";
|
|
12
13
|
import {
|
|
13
14
|
ILoaderProps,
|
|
14
15
|
Loader,
|
|
15
16
|
waitContainerToCatchUp as waitContainerToCatchUp_original,
|
|
16
|
-
} from "@fluidframework/container-loader";
|
|
17
|
-
import { IContainerRuntimeOptions } from "@fluidframework/container-runtime";
|
|
17
|
+
} from "@fluidframework/container-loader/internal";
|
|
18
|
+
import { IContainerRuntimeOptions } from "@fluidframework/container-runtime/internal";
|
|
18
19
|
import {
|
|
19
20
|
IRequestHeader,
|
|
20
21
|
ITelemetryBaseEvent,
|
|
@@ -24,14 +25,11 @@ import {
|
|
|
24
25
|
IDocumentServiceFactory,
|
|
25
26
|
IResolvedUrl,
|
|
26
27
|
IUrlResolver,
|
|
27
|
-
} from "@fluidframework/driver-definitions";
|
|
28
|
-
import {
|
|
29
|
-
|
|
30
|
-
createChildLogger,
|
|
31
|
-
createMultiSinkLogger,
|
|
32
|
-
} from "@fluidframework/telemetry-utils";
|
|
33
|
-
import { ITestDriver, TestDriverTypes } from "@fluidframework/test-driver-definitions";
|
|
28
|
+
} from "@fluidframework/driver-definitions/internal";
|
|
29
|
+
import { type ITelemetryGenericEventExt } from "@fluidframework/telemetry-utils";
|
|
30
|
+
import { createChildLogger, createMultiSinkLogger } from "@fluidframework/telemetry-utils/internal";
|
|
34
31
|
import { v4 as uuid } from "uuid";
|
|
32
|
+
|
|
35
33
|
import { LoaderContainerTracker } from "./loaderContainerTracker.js";
|
|
36
34
|
import { LocalCodeLoader, fluidEntryPoint } from "./localCodeLoader.js";
|
|
37
35
|
import { createAndAttachContainer } from "./localLoader.js";
|
package/src/timeoutUtils.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { assert, Deferred } from "@fluidframework/core-utils";
|
|
6
|
+
import { assert, Deferred } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import type * as Mocha from "mocha";
|
|
8
8
|
|
|
9
9
|
// @deprecated this value is no longer used
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { strict as assert } from "assert";
|
|
6
|
-
import { timeoutPromise } from "../timeoutUtils.js";
|
|
7
|
-
describe("TimeoutPromise", () => {
|
|
8
|
-
beforeEach(async () => {
|
|
9
|
-
// Make sure there are no timeout set left behind, wait larger then the test timeout
|
|
10
|
-
await timeoutPromise((resolve) => setTimeout(resolve, 50));
|
|
11
|
-
});
|
|
12
|
-
afterEach(async () => {
|
|
13
|
-
// Make sure there are no timeout set left behind, wait larger then the test timeout
|
|
14
|
-
await timeoutPromise((resolve) => setTimeout(resolve, 50));
|
|
15
|
-
});
|
|
16
|
-
let runCount = 0;
|
|
17
|
-
it("No timeout", async () => {
|
|
18
|
-
if (runCount++ !== 1) {
|
|
19
|
-
// only timeout the first time to test, but pass the second one,
|
|
20
|
-
// to test the behavior of test timed out by mocha
|
|
21
|
-
// to ensure that we reset the timeoutPromise state.
|
|
22
|
-
const value = await timeoutPromise((resolve) => {
|
|
23
|
-
resolve(3);
|
|
24
|
-
});
|
|
25
|
-
assert(value === 3, "Value not returned");
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
.timeout(25)
|
|
29
|
-
.retries(1);
|
|
30
|
-
it("Timeout", async () => {
|
|
31
|
-
if (runCount++ !== 1) {
|
|
32
|
-
// only timeout the first time to test, but pass the second one,
|
|
33
|
-
// to test the behavior of test timed out by mocha
|
|
34
|
-
// to ensure that we reset the timeoutPromise state.
|
|
35
|
-
return new Promise(() => { });
|
|
36
|
-
}
|
|
37
|
-
})
|
|
38
|
-
.timeout(25)
|
|
39
|
-
.retries(1);
|
|
40
|
-
it("Timeout with no options", async () => {
|
|
41
|
-
try {
|
|
42
|
-
await timeoutPromise(() => { });
|
|
43
|
-
assert(false, "should have timed out");
|
|
44
|
-
}
|
|
45
|
-
catch (e) {
|
|
46
|
-
assert(e.message.startsWith("Test timed out ("), `expected timeout error message: got ${e.message}`);
|
|
47
|
-
}
|
|
48
|
-
}).timeout(25);
|
|
49
|
-
it("Timeout with no duration", async () => {
|
|
50
|
-
try {
|
|
51
|
-
await timeoutPromise(() => { }, {});
|
|
52
|
-
assert(false, "should have timed out");
|
|
53
|
-
}
|
|
54
|
-
catch (e) {
|
|
55
|
-
assert(e.message.startsWith("Test timed out ("), `expected timeout error message: got ${e.message}`);
|
|
56
|
-
}
|
|
57
|
-
}).timeout(25);
|
|
58
|
-
it("Timeout with duration", async () => {
|
|
59
|
-
try {
|
|
60
|
-
await timeoutPromise(() => { }, { durationMs: 1 });
|
|
61
|
-
assert(false, "should have timed out");
|
|
62
|
-
}
|
|
63
|
-
catch (e) {
|
|
64
|
-
assert(e.message.startsWith("Timed out ("), `expected timeout error message: got ${e.message}`);
|
|
65
|
-
}
|
|
66
|
-
}).timeout(25);
|
|
67
|
-
it("No timeout with zero duration", async () => {
|
|
68
|
-
try {
|
|
69
|
-
await timeoutPromise((resolve) => {
|
|
70
|
-
setTimeout(resolve, 10);
|
|
71
|
-
}, { durationMs: 0 });
|
|
72
|
-
}
|
|
73
|
-
catch (e) {
|
|
74
|
-
assert(false, `should not have timed out: ${e.message}`);
|
|
75
|
-
}
|
|
76
|
-
}).timeout(25);
|
|
77
|
-
it("No timeout with negative duration", async function () {
|
|
78
|
-
// Make sure resetTimeout in the test works
|
|
79
|
-
this.timeout(100);
|
|
80
|
-
try {
|
|
81
|
-
await timeoutPromise((resolve) => {
|
|
82
|
-
setTimeout(resolve, 50);
|
|
83
|
-
}, { durationMs: -1 });
|
|
84
|
-
}
|
|
85
|
-
catch (e) {
|
|
86
|
-
assert(false, `should not have timed out: ${e.message}`);
|
|
87
|
-
}
|
|
88
|
-
}).timeout(25);
|
|
89
|
-
it("No timeout with Infinity duration", async function () {
|
|
90
|
-
// Make sure resetTimeout in the test works
|
|
91
|
-
this.timeout(100);
|
|
92
|
-
try {
|
|
93
|
-
await timeoutPromise((resolve) => {
|
|
94
|
-
setTimeout(resolve, 50);
|
|
95
|
-
}, { durationMs: Infinity });
|
|
96
|
-
}
|
|
97
|
-
catch (e) {
|
|
98
|
-
assert(false, `should not have timed out: ${e.message}`);
|
|
99
|
-
}
|
|
100
|
-
}).timeout(25);
|
|
101
|
-
it("No timeout with valid duration", async function () {
|
|
102
|
-
// Make sure resetTimeout in the test works
|
|
103
|
-
this.timeout(100);
|
|
104
|
-
try {
|
|
105
|
-
await timeoutPromise((resolve) => {
|
|
106
|
-
setTimeout(resolve, 50);
|
|
107
|
-
}, { durationMs: 75 });
|
|
108
|
-
}
|
|
109
|
-
catch (e) {
|
|
110
|
-
assert(false, `should not have timed out: ${e.message}`);
|
|
111
|
-
}
|
|
112
|
-
}).timeout(25);
|
|
113
|
-
it("No timeout with throw", async function () {
|
|
114
|
-
// Make sure resetTimeout in the test works
|
|
115
|
-
this.timeout(100);
|
|
116
|
-
try {
|
|
117
|
-
await timeoutPromise((resolve, reject) => {
|
|
118
|
-
reject(new Error("blah"));
|
|
119
|
-
});
|
|
120
|
-
assert(false, "should have thrown");
|
|
121
|
-
}
|
|
122
|
-
catch (e) {
|
|
123
|
-
assert(e.message === "blah", `should not have timed out: ${e.message}`);
|
|
124
|
-
}
|
|
125
|
-
}).timeout(25);
|
|
126
|
-
it("Timeout with valid duration", async function () {
|
|
127
|
-
// Make sure resetTimeout in the test works
|
|
128
|
-
this.timeout(100);
|
|
129
|
-
try {
|
|
130
|
-
await timeoutPromise((resolve) => {
|
|
131
|
-
setTimeout(resolve, 75);
|
|
132
|
-
}, { durationMs: 50 });
|
|
133
|
-
assert(false, "should have timed out");
|
|
134
|
-
}
|
|
135
|
-
catch (e) {
|
|
136
|
-
assert(e.message.startsWith("Timed out ("), "expected timeout error message");
|
|
137
|
-
}
|
|
138
|
-
}).timeout(25);
|
|
139
|
-
it("Timeout with no reject option", async () => {
|
|
140
|
-
try {
|
|
141
|
-
const value = await timeoutPromise(() => { }, {
|
|
142
|
-
durationMs: 1,
|
|
143
|
-
reject: false,
|
|
144
|
-
value: 1,
|
|
145
|
-
});
|
|
146
|
-
assert(value === 1, "expect timeout to return value given in option");
|
|
147
|
-
}
|
|
148
|
-
catch (e) {
|
|
149
|
-
assert(false, `should not have timed out: ${e.message}`);
|
|
150
|
-
}
|
|
151
|
-
}).timeout(25);
|
|
152
|
-
it("Timeout rejection with error option", async () => {
|
|
153
|
-
try {
|
|
154
|
-
await timeoutPromise(() => { }, {
|
|
155
|
-
durationMs: 1,
|
|
156
|
-
errorMsg: "hello",
|
|
157
|
-
});
|
|
158
|
-
assert(false, "should have timed out");
|
|
159
|
-
}
|
|
160
|
-
catch (e) {
|
|
161
|
-
assert(e.message.startsWith("hello"), "expected timeout reject error message given in option");
|
|
162
|
-
}
|
|
163
|
-
}).timeout(25);
|
|
164
|
-
});
|
|
165
|
-
//# sourceMappingURL=timeoutUtils.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"timeoutUtils.spec.js","sourceRoot":"","sources":["../../src/test/timeoutUtils.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC/B,UAAU,CAAC,KAAK,IAAI,EAAE;QACrB,oFAAoF;QACpF,MAAM,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,KAAK,IAAI,EAAE;QACpB,oFAAoF;QACpF,MAAM,cAAc,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,IAAI,QAAQ,GAAG,CAAC,CAAC;IAEjB,EAAE,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE;QAC3B,IAAI,QAAQ,EAAE,KAAK,CAAC,EAAE;YACrB,gEAAgE;YAChE,kDAAkD;YAClD,oDAAoD;YACpD,MAAM,KAAK,GAAG,MAAM,cAAc,CAAS,CAAC,OAAO,EAAE,EAAE;gBACtD,OAAO,CAAC,CAAC,CAAC,CAAC;YACZ,CAAC,CAAC,CAAC;YACH,MAAM,CAAC,KAAK,KAAK,CAAC,EAAE,oBAAoB,CAAC,CAAC;SAC1C;IACF,CAA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M,EAAE;YAChB,MAAM,CACL,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,EAC7B,uDAAuD,CACvD,CAAC;SACF;IACF,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AAChB,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"assert\";\nimport { timeoutPromise } from \"../timeoutUtils.js\";\n\ndescribe(\"TimeoutPromise\", () => {\n\tbeforeEach(async () => {\n\t\t// Make sure there are no timeout set left behind, wait larger then the test timeout\n\t\tawait timeoutPromise((resolve) => setTimeout(resolve, 50));\n\t});\n\n\tafterEach(async () => {\n\t\t// Make sure there are no timeout set left behind, wait larger then the test timeout\n\t\tawait timeoutPromise((resolve) => setTimeout(resolve, 50));\n\t});\n\n\tlet runCount = 0;\n\n\tit(\"No timeout\", async () => {\n\t\tif (runCount++ !== 1) {\n\t\t\t// only timeout the first time to test, but pass the second one,\n\t\t\t// to test the behavior of test timed out by mocha\n\t\t\t// to ensure that we reset the timeoutPromise state.\n\t\t\tconst value = await timeoutPromise<number>((resolve) => {\n\t\t\t\tresolve(3);\n\t\t\t});\n\t\t\tassert(value === 3, \"Value not returned\");\n\t\t}\n\t})\n\t\t.timeout(25)\n\t\t.retries(1);\n\n\tit(\"Timeout\", async () => {\n\t\tif (runCount++ !== 1) {\n\t\t\t// only timeout the first time to test, but pass the second one,\n\t\t\t// to test the behavior of test timed out by mocha\n\t\t\t// to ensure that we reset the timeoutPromise state.\n\t\t\treturn new Promise(() => {});\n\t\t}\n\t})\n\t\t.timeout(25)\n\t\t.retries(1);\n\n\tit(\"Timeout with no options\", async () => {\n\t\ttry {\n\t\t\tawait timeoutPromise(() => {});\n\t\t\tassert(false, \"should have timed out\");\n\t\t} catch (e: any) {\n\t\t\tassert(\n\t\t\t\te.message.startsWith(\"Test timed out (\"),\n\t\t\t\t`expected timeout error message: got ${e.message}`,\n\t\t\t);\n\t\t}\n\t}).timeout(25);\n\n\tit(\"Timeout with no duration\", async () => {\n\t\ttry {\n\t\t\tawait timeoutPromise(() => {}, {});\n\t\t\tassert(false, \"should have timed out\");\n\t\t} catch (e: any) {\n\t\t\tassert(\n\t\t\t\te.message.startsWith(\"Test timed out (\"),\n\t\t\t\t`expected timeout error message: got ${e.message}`,\n\t\t\t);\n\t\t}\n\t}).timeout(25);\n\n\tit(\"Timeout with duration\", async () => {\n\t\ttry {\n\t\t\tawait timeoutPromise(() => {}, { durationMs: 1 });\n\t\t\tassert(false, \"should have timed out\");\n\t\t} catch (e: any) {\n\t\t\tassert(\n\t\t\t\te.message.startsWith(\"Timed out (\"),\n\t\t\t\t`expected timeout error message: got ${e.message}`,\n\t\t\t);\n\t\t}\n\t}).timeout(25);\n\n\tit(\"No timeout with zero duration\", async () => {\n\t\ttry {\n\t\t\tawait timeoutPromise(\n\t\t\t\t(resolve) => {\n\t\t\t\t\tsetTimeout(resolve, 10);\n\t\t\t\t},\n\t\t\t\t{ durationMs: 0 },\n\t\t\t);\n\t\t} catch (e: any) {\n\t\t\tassert(false, `should not have timed out: ${e.message}`);\n\t\t}\n\t}).timeout(25);\n\n\tit(\"No timeout with negative duration\", async function () {\n\t\t// Make sure resetTimeout in the test works\n\t\tthis.timeout(100);\n\t\ttry {\n\t\t\tawait timeoutPromise(\n\t\t\t\t(resolve) => {\n\t\t\t\t\tsetTimeout(resolve, 50);\n\t\t\t\t},\n\t\t\t\t{ durationMs: -1 },\n\t\t\t);\n\t\t} catch (e: any) {\n\t\t\tassert(false, `should not have timed out: ${e.message}`);\n\t\t}\n\t}).timeout(25);\n\n\tit(\"No timeout with Infinity duration\", async function () {\n\t\t// Make sure resetTimeout in the test works\n\t\tthis.timeout(100);\n\t\ttry {\n\t\t\tawait timeoutPromise(\n\t\t\t\t(resolve) => {\n\t\t\t\t\tsetTimeout(resolve, 50);\n\t\t\t\t},\n\t\t\t\t{ durationMs: Infinity },\n\t\t\t);\n\t\t} catch (e: any) {\n\t\t\tassert(false, `should not have timed out: ${e.message}`);\n\t\t}\n\t}).timeout(25);\n\n\tit(\"No timeout with valid duration\", async function () {\n\t\t// Make sure resetTimeout in the test works\n\t\tthis.timeout(100);\n\t\ttry {\n\t\t\tawait timeoutPromise(\n\t\t\t\t(resolve) => {\n\t\t\t\t\tsetTimeout(resolve, 50);\n\t\t\t\t},\n\t\t\t\t{ durationMs: 75 },\n\t\t\t);\n\t\t} catch (e: any) {\n\t\t\tassert(false, `should not have timed out: ${e.message}`);\n\t\t}\n\t}).timeout(25);\n\n\tit(\"No timeout with throw\", async function () {\n\t\t// Make sure resetTimeout in the test works\n\t\tthis.timeout(100);\n\t\ttry {\n\t\t\tawait timeoutPromise((resolve, reject) => {\n\t\t\t\treject(new Error(\"blah\"));\n\t\t\t});\n\t\t\tassert(false, \"should have thrown\");\n\t\t} catch (e: any) {\n\t\t\tassert(e.message === \"blah\", `should not have timed out: ${e.message}`);\n\t\t}\n\t}).timeout(25);\n\n\tit(\"Timeout with valid duration\", async function () {\n\t\t// Make sure resetTimeout in the test works\n\t\tthis.timeout(100);\n\t\ttry {\n\t\t\tawait timeoutPromise(\n\t\t\t\t(resolve) => {\n\t\t\t\t\tsetTimeout(resolve, 75);\n\t\t\t\t},\n\t\t\t\t{ durationMs: 50 },\n\t\t\t);\n\t\t\tassert(false, \"should have timed out\");\n\t\t} catch (e: any) {\n\t\t\tassert(e.message.startsWith(\"Timed out (\"), \"expected timeout error message\");\n\t\t}\n\t}).timeout(25);\n\n\tit(\"Timeout with no reject option\", async () => {\n\t\ttry {\n\t\t\tconst value = await timeoutPromise(() => {}, {\n\t\t\t\tdurationMs: 1,\n\t\t\t\treject: false,\n\t\t\t\tvalue: 1,\n\t\t\t});\n\t\t\tassert(value === 1, \"expect timeout to return value given in option\");\n\t\t} catch (e: any) {\n\t\t\tassert(false, `should not have timed out: ${e.message}`);\n\t\t}\n\t}).timeout(25);\n\n\tit(\"Timeout rejection with error option\", async () => {\n\t\ttry {\n\t\t\tawait timeoutPromise(() => {}, {\n\t\t\t\tdurationMs: 1,\n\t\t\t\terrorMsg: \"hello\",\n\t\t\t});\n\t\t\tassert(false, \"should have timed out\");\n\t\t} catch (e: any) {\n\t\t\tassert(\n\t\t\t\te.message.startsWith(\"hello\"),\n\t\t\t\t\"expected timeout reject error message given in option\",\n\t\t\t);\n\t\t}\n\t}).timeout(25);\n});\n"]}
|