@fluid-internal/mocha-test-setup 2.92.0 → 2.93.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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluid-internal/mocha-test-setup
2
2
 
3
+ ## 2.93.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.92.0
4
8
 
5
9
  Dependency updates only.
package/README.md CHANGED
@@ -144,7 +144,7 @@ required packages that you can pass to `getFluidTestMochaConfig()`.
144
144
  For example, the path to a reporter file:
145
145
 
146
146
  ```console
147
- mocha --require @fluid-internal/mocha-test-setup --reporter @fluid-tools/benchmark/dist/MochaReporter.js
147
+ mocha --require @fluid-internal/mocha-test-setup --reporter @fluid-tools/benchmark/dist/mocha/Reporter.js
148
148
  ```
149
149
 
150
150
  Depending on where that file is coming from, you'll need to be careful with how that path is specified.
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluid-internal/mocha-test-setup";
8
- export declare const pkgVersion = "2.92.0";
8
+ export declare const pkgVersion = "2.93.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluid-internal/mocha-test-setup";
11
- exports.pkgVersion = "2.92.0";
11
+ exports.pkgVersion = "2.93.0";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,kCAAkC,CAAC;AAC7C,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluid-internal/mocha-test-setup\";\nexport const pkgVersion = \"2.92.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,kCAAkC,CAAC;AAC7C,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluid-internal/mocha-test-setup\";\nexport const pkgVersion = \"2.93.0\";\n"]}
package/eslint.config.mts CHANGED
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import type { Linter } from "eslint";
7
- import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts";
7
+ import { recommended } from "@fluidframework/eslint-config-fluid/flat.mts";
8
8
 
9
9
  const config: Linter.Config[] = [
10
10
  ...recommended,
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluid-internal/mocha-test-setup";
8
- export declare const pkgVersion = "2.92.0";
8
+ export declare const pkgVersion = "2.93.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluid-internal/mocha-test-setup";
8
- export const pkgVersion = "2.92.0";
8
+ export const pkgVersion = "2.93.0";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,kCAAkC,CAAC;AAC1D,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluid-internal/mocha-test-setup\";\nexport const pkgVersion = \"2.92.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,kCAAkC,CAAC;AAC1D,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluid-internal/mocha-test-setup\";\nexport const pkgVersion = \"2.93.0\";\n"]}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.52.11"
8
+ "packageVersion": "7.58.1"
9
9
  }
10
10
  ]
11
11
  }
@@ -5,7 +5,6 @@
5
5
 
6
6
  "use strict";
7
7
 
8
- const { existsSync } = require("fs");
9
8
  const path = require("path");
10
9
 
11
10
  /**
@@ -20,8 +19,6 @@ const path = require("path");
20
19
  * Users desiring exact control over the `spec` from the CLI should delete or replace the spec from the returned config, since mocha's behavior is to extend it, not override it.
21
20
  */
22
21
  function getFluidTestMochaConfig(packageDir, additionalRequiredModules, testReportPrefix) {
23
- const moduleDir = `${packageDir}/node_modules`;
24
-
25
22
  const requiredModules = [
26
23
  // General mocha setup e.g. suppresses console.log,
27
24
  // This has to be before others (except logger) so that registerMochaTestWrapperFuncs is available
@@ -30,34 +27,9 @@ function getFluidTestMochaConfig(packageDir, additionalRequiredModules, testRepo
30
27
  ...(additionalRequiredModules ? additionalRequiredModules : []),
31
28
  ];
32
29
 
33
- // mocha install node_modules directory might not be the same as the module required because of hoisting
34
- // We need to give the full path in that case.
35
- // TODO: this path mapping might not be necessary once we move to pnpm, since it sets up node_modules differently
36
- // from what Lerna does (all dependencies of a given package show up in its own node_modules folder and just symlink
37
- // to the actual location of the installed package, instead of common dependencies being hoisted to a parent
38
- // node_modules folder and not being present at all in the package's own node_modules).
39
- const requiredModulePaths = requiredModules.map((mod) => {
40
- // Just return if it is path already
41
- if (existsSync(mod) || existsSync(`${mod}.js`)) {
42
- return mod;
43
- }
44
-
45
- // Try to find it in the test package's directory
46
- const modulePath = path.join(moduleDir, mod);
47
- if (existsSync(modulePath)) {
48
- return modulePath;
49
- }
50
-
51
- // Otherwise keep it as is
52
- return mod;
53
- });
54
-
55
30
  if (process.env.FLUID_TEST_LOGGER_PKG_SPECIFIER) {
56
- const modulePath = path.join(moduleDir, process.env.FLUID_TEST_LOGGER_PKG_SPECIFIER);
57
31
  // Inject implementation of createTestLogger, put it first before mocha-test-setup
58
- if (existsSync(modulePath)) {
59
- requiredModulePaths.unshift(modulePath);
60
- }
32
+ requiredModules.unshift(process.env.FLUID_TEST_LOGGER_PKG_SPECIFIER);
61
33
  }
62
34
 
63
35
  let defaultSpec = "lib/test";
@@ -70,7 +42,7 @@ function getFluidTestMochaConfig(packageDir, additionalRequiredModules, testRepo
70
42
 
71
43
  const config = {
72
44
  "recursive": true,
73
- "require": requiredModulePaths,
45
+ "require": requiredModules,
74
46
  "unhandled-rejections": "strict",
75
47
  // Fail the test run if no tests are found/run. This catches cases where test files fail to
76
48
  // load silently (e.g. due to broken imports), which would otherwise produce a green "0 passing"
@@ -92,29 +64,56 @@ function getFluidTestMochaConfig(packageDir, additionalRequiredModules, testRepo
92
64
  spec: process.env.MOCHA_SPEC ?? defaultSpec,
93
65
  };
94
66
 
95
- if (process.env.FLUID_TEST_TIMEOUT !== undefined) {
96
- config["timeout"] = process.env.FLUID_TEST_TIMEOUT;
67
+ // This approach to checking for this flag is consistant with some (buyt not all) others in this file,
68
+ // but not with tools/benchmark/src/Configuration.ts.
69
+ // For now, undefined, "1" and "true" should work consistantly across all known use, and "1" is the main form we explicitly use.
70
+ // All these should be made to match, see AB#69054.
71
+ if (process.env.FLUID_TEST_PERF_MODE !== undefined) {
72
+ if (!process.env.SILENT_TEST_OUTPUT) {
73
+ console.log(`Running performance tests...`);
74
+ }
75
+
76
+ // Some perf tests are often quite slow, and we don't want to lose the data by hitting a timeout.
77
+ // This is 1000 seconds, so ~16 minutes.
78
+ // This can be overridden by setting FLUID_TEST_TIMEOUT to a different value if desired.
79
+ config["timeout"] = 1_000_000;
80
+
81
+ // If there is no filter specified, limit to benchmarks.
82
+ // If mocha allowed multiple filters to all be applied to further narrow results, we would do this unconditionally.
83
+ if (!(process.argv.includes("--fgrep") || process.argv.includes("--grep"))) {
84
+ config["fgrep"] = ["@Benchmark"];
85
+ }
86
+
87
+ config["reporter"] = "@fluid-tools/benchmark/dist/mocha/Reporter.js";
88
+ if (!process.argv.includes("--reporterOptions")) {
89
+ // If report options were not specified, default to:
90
+ config["reporterOptions"] = ["reportFile=./benchmarkOutput.json"];
91
+ }
92
+ } else {
93
+ const packageJson = require(`${packageDir}/package.json`);
94
+ config["reporter"] = `mocha-multi-reporters`;
95
+ // See https://www.npmjs.com/package/mocha-multi-reporters#cmroutput-option
96
+ const outputFilePrefix = testReportPrefix !== undefined ? `${testReportPrefix}-` : "";
97
+ if (!process.env.SILENT_TEST_OUTPUT) {
98
+ console.log(
99
+ `Writing test results relative to package to nyc/${outputFilePrefix}junit-report.xml`,
100
+ );
101
+ }
102
+ const suiteName =
103
+ testReportPrefix !== undefined
104
+ ? `${packageJson.name} - ${testReportPrefix}`
105
+ : packageJson.name;
106
+ config["reporter-options"] = [
107
+ `configFile=${path.join(
108
+ __dirname,
109
+ "test-config.json",
110
+ )},cmrOutput=xunit+output+${outputFilePrefix}:xunit+suiteName+${suiteName}`,
111
+ ];
97
112
  }
98
113
 
99
- const packageJson = require(`${packageDir}/package.json`);
100
- config["reporter"] = `mocha-multi-reporters`;
101
- // See https://www.npmjs.com/package/mocha-multi-reporters#cmroutput-option
102
- const outputFilePrefix = testReportPrefix !== undefined ? `${testReportPrefix}-` : "";
103
- if (!process.env.SILENT_TEST_OUTPUT) {
104
- console.log(
105
- `Writing test results relative to package to nyc/${outputFilePrefix}junit-report.xml`,
106
- );
114
+ if (process.env.FLUID_TEST_TIMEOUT !== undefined) {
115
+ config["timeout"] = process.env.FLUID_TEST_TIMEOUT;
107
116
  }
108
- const suiteName =
109
- testReportPrefix !== undefined
110
- ? `${packageJson.name} - ${testReportPrefix}`
111
- : packageJson.name;
112
- config["reporter-options"] = [
113
- `configFile=${path.join(
114
- __dirname,
115
- "test-config.json",
116
- )},cmrOutput=xunit+output+${outputFilePrefix}:xunit+suiteName+${suiteName}`,
117
- ];
118
117
 
119
118
  if (process.env.FLUID_TEST_FORBID_ONLY !== undefined) {
120
119
  config["forbid-only"] = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-internal/mocha-test-setup",
3
- "version": "2.92.0",
3
+ "version": "2.93.0",
4
4
  "description": "Utilities for Fluid tests",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -30,8 +30,8 @@
30
30
  "main": "dist/index.js",
31
31
  "types": "dist/index.d.ts",
32
32
  "dependencies": {
33
- "@fluid-internal/test-driver-definitions": "~2.92.0",
34
- "@fluidframework/core-interfaces": "~2.92.0",
33
+ "@fluid-internal/test-driver-definitions": "~2.93.0",
34
+ "@fluidframework/core-interfaces": "~2.93.0",
35
35
  "mocha": "^11.7.5",
36
36
  "source-map-support": "^0.5.21"
37
37
  },
@@ -42,9 +42,9 @@
42
42
  "@fluidframework/build-common": "^2.0.3",
43
43
  "@fluidframework/build-tools": "^0.64.0",
44
44
  "@fluidframework/eslint-config-fluid": "^9.0.0",
45
- "@microsoft/api-extractor": "7.52.11",
45
+ "@microsoft/api-extractor": "7.58.1",
46
46
  "@types/mocha": "^10.0.10",
47
- "@types/node": "~20.19.30",
47
+ "@types/node": "~22.19.17",
48
48
  "concurrently": "^9.2.1",
49
49
  "copyfiles": "^2.4.1",
50
50
  "eslint": "~9.39.1",
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluid-internal/mocha-test-setup";
9
- export const pkgVersion = "2.92.0";
9
+ export const pkgVersion = "2.93.0";