Skip to content

Commit 985ae6b

Browse files
Simplify mocha nodeOptions (#25293)
## Description Remove unnecessary mocha config logic that's already in the base config.
1 parent 8324170 commit 985ae6b

File tree

3 files changed

+3
-26
lines changed

3 files changed

+3
-26
lines changed

examples/benchmarks/tablebench/.mocharc.customBenchmarks.cjs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,11 @@ const getFluidTestMochaConfig = require("@fluid-internal/mocha-test-setup/mochar
1313
const packageDir = __dirname;
1414
const baseConfig = getFluidTestMochaConfig(packageDir);
1515

16-
const nodeOptions =
17-
baseConfig["node-option"] !== undefined
18-
? Array.isArray(baseConfig["node-option"])
19-
? baseConfig["node-option"]
20-
: [baseConfig["node-option"]] // If string, wrap as array to use spread operator
21-
: []; // If undefined, use an empty array
22-
23-
nodeOptions.push("expose-gc", "gc-global", "unhandled-rejections=strict");
16+
baseConfig["node-option"].push("gc-global");
2417

2518
module.exports = {
2619
...baseConfig,
2720
"fgrep": ["@CustomBenchmark"],
28-
"node-option": nodeOptions, // without leading "--"
2921
"recursive": true,
3022
"reporter": "@fluid-tools/benchmark/dist/MochaReporter.js",
3123
"reporterOptions": ["reportDir=.customBenchmarksOutput/"],

packages/dds/tree/.mocharc.customBenchmarks.cjs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,11 @@ const getFluidTestMochaConfig = require("@fluid-internal/mocha-test-setup/mochar
1313
const packageDir = __dirname;
1414
const baseConfig = getFluidTestMochaConfig(packageDir);
1515

16-
const nodeOptions =
17-
baseConfig["node-option"] !== undefined
18-
? Array.isArray(baseConfig["node-option"])
19-
? baseConfig["node-option"]
20-
: [baseConfig["node-option"]] // If string, wrap as array to use spread operator
21-
: []; // If undefined, use an empty array
22-
23-
nodeOptions.push("expose-gc", "gc-global", "unhandled-rejections=strict");
16+
baseConfig["node-option"].push("gc-global");
2417

2518
module.exports = {
2619
...baseConfig,
2720
"fgrep": ["@CustomBenchmark"],
28-
"node-option": nodeOptions, // without leading "--"
2921
"recursive": true,
3022
"reporter": "@fluid-tools/benchmark/dist/MochaReporter.js",
3123
"reporterOptions": ["reportDir=.customBenchmarksOutput/"],

packages/dds/tree/src/test/memory/.mocharc.cjs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,11 @@
88
*/
99

1010
const baseConfig = require("../../../.mocharc.cjs");
11-
12-
const baseNodeOptions =
13-
baseConfig["node-option"] !== undefined
14-
? Array.isArray(baseConfig["node-option"])
15-
? baseConfig["node-option"]
16-
: [baseConfig["node-option"]] // If string, wrap as array to use spread operator
17-
: []; // If undefined, use an empty array
11+
baseConfig["node-option"].push("gc-global");
1812

1913
const extendedConfig = {
2014
...baseConfig,
2115
"fgrep": ["@Benchmark", "@MemoryUsage"],
22-
"node-option": [...baseNodeOptions, "expose-gc", "gc-global", "unhandled-rejections=strict"], // without leading "--"
2316
"reporter": "@fluid-tools/benchmark/dist/MochaReporter.js",
2417
"reporterOptions": ["reportDir=.memoryTestsOutput/"],
2518
};

0 commit comments

Comments
 (0)