@fluidframework/test-utils 2.41.0-338401 → 2.41.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/test-utils",
3
- "version": "2.41.0-338401",
3
+ "version": "2.41.0",
4
4
  "description": "Utilities for Fluid tests",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -67,26 +67,26 @@
67
67
  "temp-directory": "nyc/.nyc_output"
68
68
  },
69
69
  "dependencies": {
70
- "@fluid-internal/test-driver-definitions": "2.41.0-338401",
71
- "@fluidframework/container-definitions": "2.41.0-338401",
72
- "@fluidframework/container-loader": "2.41.0-338401",
73
- "@fluidframework/container-runtime": "2.41.0-338401",
74
- "@fluidframework/container-runtime-definitions": "2.41.0-338401",
75
- "@fluidframework/core-interfaces": "2.41.0-338401",
76
- "@fluidframework/core-utils": "2.41.0-338401",
77
- "@fluidframework/datastore": "2.41.0-338401",
78
- "@fluidframework/datastore-definitions": "2.41.0-338401",
79
- "@fluidframework/driver-definitions": "2.41.0-338401",
80
- "@fluidframework/driver-utils": "2.41.0-338401",
81
- "@fluidframework/local-driver": "2.41.0-338401",
82
- "@fluidframework/map": "2.41.0-338401",
83
- "@fluidframework/odsp-driver": "2.41.0-338401",
84
- "@fluidframework/request-handler": "2.41.0-338401",
85
- "@fluidframework/routerlicious-driver": "2.41.0-338401",
86
- "@fluidframework/runtime-definitions": "2.41.0-338401",
87
- "@fluidframework/runtime-utils": "2.41.0-338401",
88
- "@fluidframework/shared-object-base": "2.41.0-338401",
89
- "@fluidframework/telemetry-utils": "2.41.0-338401",
70
+ "@fluid-internal/test-driver-definitions": "~2.41.0",
71
+ "@fluidframework/container-definitions": "~2.41.0",
72
+ "@fluidframework/container-loader": "~2.41.0",
73
+ "@fluidframework/container-runtime": "~2.41.0",
74
+ "@fluidframework/container-runtime-definitions": "~2.41.0",
75
+ "@fluidframework/core-interfaces": "~2.41.0",
76
+ "@fluidframework/core-utils": "~2.41.0",
77
+ "@fluidframework/datastore": "~2.41.0",
78
+ "@fluidframework/datastore-definitions": "~2.41.0",
79
+ "@fluidframework/driver-definitions": "~2.41.0",
80
+ "@fluidframework/driver-utils": "~2.41.0",
81
+ "@fluidframework/local-driver": "~2.41.0",
82
+ "@fluidframework/map": "~2.41.0",
83
+ "@fluidframework/odsp-driver": "~2.41.0",
84
+ "@fluidframework/request-handler": "~2.41.0",
85
+ "@fluidframework/routerlicious-driver": "~2.41.0",
86
+ "@fluidframework/runtime-definitions": "~2.41.0",
87
+ "@fluidframework/runtime-utils": "~2.41.0",
88
+ "@fluidframework/shared-object-base": "~2.41.0",
89
+ "@fluidframework/telemetry-utils": "~2.41.0",
90
90
  "best-random": "^1.0.0",
91
91
  "debug": "^4.3.4",
92
92
  "mocha": "^10.8.2",
@@ -95,11 +95,11 @@
95
95
  "devDependencies": {
96
96
  "@arethetypeswrong/cli": "^0.17.1",
97
97
  "@biomejs/biome": "~1.9.3",
98
- "@fluid-internal/mocha-test-setup": "2.41.0-338401",
98
+ "@fluid-internal/mocha-test-setup": "~2.41.0",
99
99
  "@fluid-tools/build-cli": "^0.55.0",
100
100
  "@fluidframework/build-common": "^2.0.3",
101
101
  "@fluidframework/build-tools": "^0.55.0",
102
- "@fluidframework/eslint-config-fluid": "^5.7.3",
102
+ "@fluidframework/eslint-config-fluid": "^5.7.4",
103
103
  "@fluidframework/test-utils-previous": "npm:@fluidframework/test-utils@2.40.0",
104
104
  "@microsoft/api-extractor": "7.52.8",
105
105
  "@types/debug": "^4.1.5",
@@ -51,7 +51,7 @@ async function getSummarizerBackCompat(container: IContainer): Promise<ISummariz
51
51
  if (container.getEntryPoint !== undefined) {
52
52
  const entryPoint = await container.getEntryPoint();
53
53
  // Note: We need to also check if the result of `getEntryPoint()` is defined. This is because when running
54
- // cross version compat testing scenarios, if we create with 1.X container and load with 2.X then the
54
+ // cross-client compat testing scenarios, if we create with 1.X container and load with 2.X then the
55
55
  // function container.getEntryPoint will be defined for the 2.X container. However, it will not return undefined
56
56
  // since the container's runtime will be on version 1.X, which does not have an entry point defined.
57
57
  if (entryPoint !== undefined) {
@@ -71,7 +71,7 @@ export async function getContainerEntryPointBackCompat<T>(container: IContainer)
71
71
  if (container.getEntryPoint !== undefined) {
72
72
  const entryPoint = await container.getEntryPoint();
73
73
  // Note: We need to also check if the result of `getEntryPoint()` is defined. This is because when running
74
- // cross version compat testing scenarios, if we create with 1.X container and load with 2.X then the
74
+ // cross-client compat testing scenarios, if we create with 1.X container and load with 2.X then the
75
75
  // function container.getEntryPoint will be defined for the 2.X container. However, it will not return undefined
76
76
  // since the container's runtime will be on version 1.X, which does not have an entry point defined.
77
77
  if (entryPoint !== undefined) {
@@ -200,6 +200,9 @@ export class LoaderContainerTracker implements IOpProcessingController {
200
200
  this.lastProposalSeqNum = 0;
201
201
  for (const container of this.containers.keys()) {
202
202
  container.close();
203
+ // Optional chaining here is because containers made with LTS loaders don't have a dispose method or process
204
+ // and this package is used with various previous versions of Fluid layers in our compat testing.
205
+ container.dispose?.();
203
206
  }
204
207
  this.containers.clear();
205
208
 
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/test-utils";
9
- export const pkgVersion = "2.41.0-338401";
9
+ export const pkgVersion = "2.41.0";
@@ -19,17 +19,14 @@ class TestTimeout {
19
19
  private deferred: Deferred<void> = new Deferred<void>();
20
20
 
21
21
  private static instance: TestTimeout = new TestTimeout();
22
- public static reset(runnable: Mocha.Runnable) {
23
- TestTimeout.clear();
22
+ public static updateOnYield(runnable: Mocha.Runnable) {
23
+ TestTimeout.instance.clearTimer();
24
24
  TestTimeout.instance.resetTimer(runnable);
25
25
  }
26
26
 
27
- public static clear() {
28
- if (TestTimeout.instance.deferred.isCompleted) {
29
- TestTimeout.instance = new TestTimeout();
30
- } else {
31
- TestTimeout.instance.clearTimer();
32
- }
27
+ public static reset() {
28
+ TestTimeout.instance.clearTimer();
29
+ TestTimeout.instance = new TestTimeout();
33
30
  }
34
31
 
35
32
  public static getInstance() {
@@ -83,14 +80,25 @@ if (globalThis.getMochaModule !== undefined) {
83
80
  const runnablePrototype = mochaModule.Runnable.prototype;
84
81
  // eslint-disable-next-line @typescript-eslint/unbound-method
85
82
  const oldResetTimeoutFunc = runnablePrototype.resetTimeout;
83
+ let resetTimeoutCallDepth = 0;
84
+ // Mocha invokes resetTimeout after each async yield a test performs.
86
85
  runnablePrototype.resetTimeout = function (this: Mocha.Runnable) {
87
- oldResetTimeoutFunc.call(this);
88
- TestTimeout.reset(this);
86
+ resetTimeoutCallDepth++;
87
+ try {
88
+ oldResetTimeoutFunc.call(this);
89
+ } finally {
90
+ resetTimeoutCallDepth--;
91
+ }
92
+ TestTimeout.updateOnYield(this);
89
93
  };
90
94
  // eslint-disable-next-line @typescript-eslint/unbound-method
91
95
  const oldClearTimeoutFunc = runnablePrototype.clearTimeout;
92
96
  runnablePrototype.clearTimeout = function (this: Mocha.Runnable) {
93
- TestTimeout.clear();
97
+ if (resetTimeoutCallDepth === 0) {
98
+ // Mocha's runnable invokes clearTimeout as part of its resetTimeout as well as at the end of Runnables.
99
+ // We only want to fully reset the TestTimeout instance at the end of each runnable, not on JS turn boundaries.
100
+ TestTimeout.reset();
101
+ }
94
102
  oldClearTimeoutFunc.call(this);
95
103
  };
96
104
  }