Reporter: Add framework for automatic testing of Discord updates (#3208)

This commit is contained in:
v 2025-02-09 01:46:08 +01:00 committed by GitHub
parent e8639e2e16
commit 5d482ff3bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 156 additions and 96 deletions

View file

@ -442,11 +442,12 @@ function patchFactory(id: PropertyKey, factory: AnyModuleFactory): [patchedFacto
continue;
}
const buildNumber = getBuildNumber();
const shouldCheckBuildId = !Settings.eagerPatches && buildNumber !== -1;
// Reporter eagerly patches and cannot retrieve the build number because this code runs before the module for it is loaded
const buildNumber = IS_REPORTER ? -1 : getBuildNumber();
const shouldCheckBuildNumber = !Settings.eagerPatches && buildNumber !== -1;
if (
shouldCheckBuildId &&
shouldCheckBuildNumber &&
(patch.fromBuild != null && buildNumber < patch.fromBuild) ||
(patch.toBuild != null && buildNumber > patch.toBuild)
) {
@ -468,7 +469,7 @@ function patchFactory(id: PropertyKey, factory: AnyModuleFactory): [patchedFacto
// We change all patch.replacement to array in plugins/index
for (const replacement of patch.replacement as PatchReplacement[]) {
if (
shouldCheckBuildId &&
shouldCheckBuildNumber &&
(replacement.fromBuild != null && buildNumber < replacement.fromBuild) ||
(replacement.toBuild != null && buildNumber > replacement.toBuild)
) {