test(client): distinguish variant test cases#25503
Merged
Conversation
Several test suites run with varying environments but report tests the same way (most meaningfully by name) that are tracked as the same by infrastructure. Update default setup to prefix test case names by variance when it is present. Reconfigure CommonJS testing as a variant and replace MOCHA_SPEC using new FLUID_TEST_MODULE_SYSTEM environment variable. CommonJS test cases are prefixed by `[CJS]`. ESM tests remain unprefixed. `@fluidframework/core-interfaces` which is unable to leverage `@fluid-internal/mocha-test-setup` has a cloned subset of logic and now generates reports. Its test spec was restored to `*.spec.*js` which allowed `src/test/types/fluidObjectTypes.ts` to be restored from #25292 changes.
477e766 to
1bcd572
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR standardizes test case identification by introducing a new environment variable FLUID_TEST_MODULE_SYSTEM to replace MOCHA_SPEC for CommonJS testing and implementing test case prefixing to distinguish test variants in reporting infrastructure.
Key changes:
- Replace
MOCHA_SPEC=dist/testwithFLUID_TEST_MODULE_SYSTEM=CJSacross all package.json files - Add automatic
[CJS]prefixing to CommonJS test case names - Configure
@fluidframework/core-interfacesto generate test reports with variant tracking
Reviewed Changes
Copilot reviewed 70 out of 70 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/test/mocha-test-setup/src/mochaHooks.ts | Add logic to prefix test titles with variant when FLUID_TEST_MODULE_SYSTEM is set |
| packages/test/mocha-test-setup/mocharc-common.cjs | Implement CJS detection and automatic spec/prefix configuration |
| packages/test/mocha-test-setup/README.md | Document new FLUID_TEST_MODULE_SYSTEM environment variable |
| packages/common/core-interfaces/.mocharc.cjs | Add mocha configuration for test reporting with variant support |
| packages/common/core-interfaces/src/test/mochaHooks.ts | Add minimal hook for CJS test prefixing |
| packages/common/core-interfaces/test-config.json | Add test reporter configuration |
| packages/common/core-interfaces/src/test/types/fluidObjectTypes.ts | Remove unnecessary conditional wrapper around type tests |
| packages/common/core-interfaces/package.json | Update test scripts to use new environment variable pattern |
| Multiple package.json files | Replace MOCHA_SPEC with FLUID_TEST_MODULE_SYSTEM=CJS in test:mocha:cjs scripts |
instead of overriding all modules; specify additional as additional to config helper.
alexvy86
reviewed
Sep 22, 2025
alexvy86
reviewed
Sep 22, 2025
alexvy86
reviewed
Sep 22, 2025
alexvy86
approved these changes
Sep 24, 2025
Contributor
|
🔗 No broken links found! ✅ Your attention to detail is admirable. linkcheck output |
Contributor
Author
|
I made silly mistake of trying to run performance pipeline against the test branch which gets picked up by our checks. It is failing per current dependency issues. |
anthony-murphy-agent
pushed a commit
to anthony-murphy-agent/FluidFramework
that referenced
this pull request
Jan 14, 2026
Several test suites run with varying environments, but report tests the same way (most meaningfully by name) that are tracked as the same by infrastructure. Update default setup to prefix test case names by variance when it is present. Reconfigure CommonJS testing as a variant and replace MOCHA_SPEC using new FLUID_TEST_MODULE_SYSTEM environment variable. CommonJS test cases and report file are prefixed by `[CJS]`. ESM tests remain unprefixed. - This "adds" 773 test cases. - The 130 test cases from `@fluidframework/routerlicious-driver` are effectively renamed as it only tests CommonJS. Correct `@fluid-internal/devtools-browser-extension` mocha configuration also use `@fluid-internal/mocha-test-setup` specified modules instead of ignoring them with complete `require` property override. Will now report package tests in telemetry and suppress console output by default (in addition to respecting the test case variant renaming). `@fluidframework/core-interfaces` which is unable to leverage `@fluid-internal/mocha-test-setup` has a cloned subset of logic and now generates reports. (Its test spec was restored to `*.spec.*js` which allowed `src/test/types/fluidObjectTypes.ts` to be restored from microsoft#25292 changes.) - This adds 770 test cases to tracking. Note: packages `@fluidframework/driver-definitions` and `@fluid-internal/test-driver-definitions` are also used by `@fluid-internal/mocha-test-setup`. They were not updated like `@fluidframework/core-interfaces` as they have no runtime tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Several test suites run with varying environments, but report tests the same way (most meaningfully by name) that are tracked as the same by infrastructure.
Update default setup to prefix test case names by variance when it is present.
Reconfigure CommonJS testing as a variant and replace MOCHA_SPEC using new FLUID_TEST_MODULE_SYSTEM environment variable. CommonJS test cases and report file are prefixed by
[CJS]. ESM tests remain unprefixed.@fluidframework/routerlicious-driverare effectively renamed as it only tests CommonJS.Correct
@fluid-internal/devtools-browser-extensionmocha configuration also use@fluid-internal/mocha-test-setupspecified modules instead of ignoring them with completerequireproperty override. Will now report package tests in telemetry and suppress console output by default (in addition to respecting the test case variant renaming).@fluidframework/core-interfaceswhich is unable to leverage@fluid-internal/mocha-test-setuphas a cloned subset of logic and now generates reports. (Its test spec was restored to*.spec.*jswhich allowedsrc/test/types/fluidObjectTypes.tsto be restored from #25292 changes.)Note: packages
@fluidframework/driver-definitionsand@fluid-internal/test-driver-definitionsare also used by@fluid-internal/mocha-test-setup. They were not updated like@fluidframework/core-interfacesas they have no runtime tests.