@fluid-internal/mocha-test-setup 2.60.0 → 2.61.0-355516
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/README.md +29 -5
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/tsdoc-metadata.json +1 -1
- package/mocharc-common.cjs +16 -0
- package/package.json +6 -6
- package/src/packageVersion.ts +1 -1
package/README.md
CHANGED
|
@@ -40,8 +40,7 @@ Then put this in a `.mocharc.cjs` file at the root of your package:
|
|
|
40
40
|
|
|
41
41
|
const getFluidTestMochaConfig = require("@fluid-internal/mocha-test-setup/mocharc-common");
|
|
42
42
|
|
|
43
|
-
const
|
|
44
|
-
const config = getFluidTestMochaConfig(packageDir);
|
|
43
|
+
const config = getFluidTestMochaConfig(__dirname);
|
|
45
44
|
module.exports = config;
|
|
46
45
|
```
|
|
47
46
|
|
|
@@ -53,13 +52,24 @@ The default configuration generated by `getFluidTestMochaConfig()` looks like th
|
|
|
53
52
|
|
|
54
53
|
```jsonc
|
|
55
54
|
{
|
|
56
|
-
"exit": true,
|
|
57
55
|
"recursive": true,
|
|
58
|
-
"require": ["
|
|
56
|
+
"require": ["@fluid-internal/mocha-test-setup", "source-map-support/register"], // can be extended by providing additionalRequiredModules to getFluidTestMochaConfig()
|
|
59
57
|
"unhandled-rejections": "strict",
|
|
58
|
+
"node-option": ["conditions=allow-ff-test-exports", "expose-gc"],
|
|
59
|
+
"ignore": [ "**/*.tool.{js,cjs,mjs}" ], // Ignore "tools" which are scripts intended to be run, not part of the test suite.
|
|
60
|
+
"spec": "lib/test" // Defaults to "lib/test" where esm tests typically are. Can be overridden via MOCHA_SPEC.
|
|
60
61
|
};
|
|
61
62
|
```
|
|
62
63
|
|
|
64
|
+
It is recommended that the source for tests files use a file name ending in ".spec.ts", but this is not enforced:
|
|
65
|
+
no file named based filtering of test files is done by default, except for the ignoring of `"**/*.tool.{js,cjs,mjs}"` noted above.
|
|
66
|
+
|
|
67
|
+
Note: some packages do explicitly filter test files to `*.spec.js`: in such packages test files with other names will be silently ignored.
|
|
68
|
+
|
|
69
|
+
## Environment Variables
|
|
70
|
+
|
|
71
|
+
In package.json scripts, environment variables can be set using cross-env, like "cross-env MOCHA_SPEC=lib/mocha/test mocha".
|
|
72
|
+
|
|
63
73
|
The configuration will have additional settings if the following environment variables are present:
|
|
64
74
|
|
|
65
75
|
### FLUID_TEST_TIMEOUT
|
|
@@ -91,6 +101,20 @@ that to override them during execution time:
|
|
|
91
101
|
FLUID_LOGGER_PROPS='{ "hostName": "Benchmark" }'
|
|
92
102
|
```
|
|
93
103
|
|
|
104
|
+
### FLUID_TEST_LOGGER_PKG_SPECIFIER
|
|
105
|
+
|
|
106
|
+
Injects implementation of `createTestLogger`.
|
|
107
|
+
We use it in our pipelines to submit telemetry to internal engineering systems.
|
|
108
|
+
Probably not useful outside of that scenario, except when using it locally to test something related to its use in the pipelines.
|
|
109
|
+
|
|
110
|
+
### MOCHA_SPEC
|
|
111
|
+
|
|
112
|
+
Select the "spec".
|
|
113
|
+
Note that unlike Mocha's built in MOCHA_OPTIONS environment variable,
|
|
114
|
+
this will replace our default spec instead of adding to the spec (See https://mochajs.org/next/running/configuring/#merging).
|
|
115
|
+
Also unlike Mocha's default behavior (see https://mochajs.org/next/running/cli/),
|
|
116
|
+
this configuration defaults spec to `lib/test` (where we place our esm tests) instead of `test`.
|
|
117
|
+
|
|
94
118
|
## Mapping of package paths to account for Lerna hoisting
|
|
95
119
|
|
|
96
120
|
The way we use Lerna to manage our monorepo, package dependencies are sometimes moved out of the `node_modules` folder
|
|
@@ -128,7 +152,7 @@ might behave differently locally and in CI builds, so that's another factor to k
|
|
|
128
152
|
|
|
129
153
|
## Special behavior
|
|
130
154
|
|
|
131
|
-
###
|
|
155
|
+
### Suppress console output by default
|
|
132
156
|
|
|
133
157
|
`console.log()`, `console.warn()` and `console.error()` are disabled by default when using this package.
|
|
134
158
|
They can be re-enabled by setting the `FLUID_TEST_VERBOSE` environment variable to any non-empty value, e.g.
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -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.
|
|
8
|
+
export declare const pkgVersion = "2.61.0-355516";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,qCAAqC,CAAC;AAC1D,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,qCAAqC,CAAC;AAC1D,eAAO,MAAM,UAAU,kBAAkB,CAAC"}
|
package/dist/packageVersion.js
CHANGED
|
@@ -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.
|
|
11
|
+
exports.pkgVersion = "2.61.0-355516";
|
|
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,
|
|
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,eAAe,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.61.0-355516\";\n"]}
|
package/lib/packageVersion.d.ts
CHANGED
|
@@ -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.
|
|
8
|
+
export declare const pkgVersion = "2.61.0-355516";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,qCAAqC,CAAC;AAC1D,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,qCAAqC,CAAC;AAC1D,eAAO,MAAM,UAAU,kBAAkB,CAAC"}
|
package/lib/packageVersion.js
CHANGED
|
@@ -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,
|
|
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,eAAe,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.61.0-355516\";\n"]}
|
package/lib/tsdoc-metadata.json
CHANGED
package/mocharc-common.cjs
CHANGED
|
@@ -8,6 +8,17 @@
|
|
|
8
8
|
const { existsSync } = require("fs");
|
|
9
9
|
const path = require("path");
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Get the mocha configuration for running tests using the conventions followed in the Fluid Framework repository.
|
|
13
|
+
*
|
|
14
|
+
* @param {string} packageDir - the directory of the package, typically set using `__dirname`
|
|
15
|
+
* @param {string[]} additionalRequiredModules - modules to require in addition to the standard set.
|
|
16
|
+
* @param {string} testReportPrefix - prefix for the test output report file names.
|
|
17
|
+
* @remarks
|
|
18
|
+
* Additional configuration can be provided via environment variables: see {@link file://./README.md}.
|
|
19
|
+
*
|
|
20
|
+
* 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
|
+
*/
|
|
11
22
|
function getFluidTestMochaConfig(packageDir, additionalRequiredModules, testReportPrefix) {
|
|
12
23
|
const moduleDir = `${packageDir}/node_modules`;
|
|
13
24
|
|
|
@@ -53,6 +64,10 @@ function getFluidTestMochaConfig(packageDir, additionalRequiredModules, testRepo
|
|
|
53
64
|
"recursive": true,
|
|
54
65
|
"require": requiredModulePaths,
|
|
55
66
|
"unhandled-rejections": "strict",
|
|
67
|
+
ignore: [
|
|
68
|
+
// Ignore "tools" which are scripts intended to be run, not part of the test suite.
|
|
69
|
+
"**/*.tool.{js,cjs,mjs}",
|
|
70
|
+
],
|
|
56
71
|
"node-option": [
|
|
57
72
|
// Allow test-only indexes to be imported. Search the FF repo for package.json files with this condition to see example usage.
|
|
58
73
|
"conditions=allow-ff-test-exports",
|
|
@@ -62,6 +77,7 @@ function getFluidTestMochaConfig(packageDir, additionalRequiredModules, testRepo
|
|
|
62
77
|
// these must be provided here and not via mocha's --v8-expose-gc.
|
|
63
78
|
"expose-gc",
|
|
64
79
|
],
|
|
80
|
+
spec: process.env.MOCHA_SPEC ?? "lib/test",
|
|
65
81
|
};
|
|
66
82
|
|
|
67
83
|
if (process.env.FLUID_TEST_TIMEOUT !== undefined) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-internal/mocha-test-setup",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.61.0-355516",
|
|
4
4
|
"description": "Utilities for Fluid tests",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -30,19 +30,19 @@
|
|
|
30
30
|
"main": "dist/index.js",
|
|
31
31
|
"types": "dist/index.d.ts",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@fluid-internal/test-driver-definitions": "
|
|
34
|
-
"@fluidframework/core-interfaces": "
|
|
33
|
+
"@fluid-internal/test-driver-definitions": "2.61.0-355516",
|
|
34
|
+
"@fluidframework/core-interfaces": "2.61.0-355516",
|
|
35
35
|
"mocha": "^10.8.2",
|
|
36
36
|
"source-map-support": "^0.5.21"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@arethetypeswrong/cli": "^0.17.1",
|
|
40
40
|
"@biomejs/biome": "~1.9.3",
|
|
41
|
-
"@fluid-tools/build-cli": "^0.
|
|
41
|
+
"@fluid-tools/build-cli": "^0.58.1",
|
|
42
42
|
"@fluidframework/build-common": "^2.0.3",
|
|
43
|
-
"@fluidframework/build-tools": "^0.
|
|
43
|
+
"@fluidframework/build-tools": "^0.58.1",
|
|
44
44
|
"@fluidframework/eslint-config-fluid": "^6.0.0",
|
|
45
|
-
"@microsoft/api-extractor": "7.52.
|
|
45
|
+
"@microsoft/api-extractor": "7.52.11",
|
|
46
46
|
"@types/mocha": "^10.0.10",
|
|
47
47
|
"@types/node": "^18.19.0",
|
|
48
48
|
"concurrently": "^8.2.1",
|
package/src/packageVersion.ts
CHANGED