mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-13 08:33:01 -04:00
ci: Automated plugin test with puppeteer
This commit is contained in:
parent
8ba9c96f20
commit
a26f636c9b
4 changed files with 241 additions and 7 deletions
|
@ -16,8 +16,6 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import React from "react";
|
||||
|
||||
import gitHash from "~git-hash";
|
||||
|
||||
import { Devs } from "../utils/constants";
|
||||
|
|
|
@ -65,7 +65,7 @@ function patchPush() {
|
|||
const originalMod = mod;
|
||||
const patchedBy = new Set();
|
||||
|
||||
modules[id] = function (module, exports, require) {
|
||||
const factory = modules[id] = function (module, exports, require) {
|
||||
try {
|
||||
mod(module, exports, require);
|
||||
} catch (err) {
|
||||
|
@ -118,10 +118,14 @@ function patchPush() {
|
|||
logger.error("Error while firing callback for webpack chunk", err);
|
||||
}
|
||||
}
|
||||
};
|
||||
} as any as { toString: () => string, original: any, (...args: any[]): void; };
|
||||
|
||||
modules[id].toString = () => mod.toString();
|
||||
modules[id].original = originalMod;
|
||||
// for some reason throws some error on which calling .toString() leads to infinite recursion
|
||||
// when you force load all chunks???
|
||||
try {
|
||||
factory.toString = () => mod.toString();
|
||||
factory.original = originalMod;
|
||||
} catch { }
|
||||
|
||||
for (let i = 0; i < patches.length; i++) {
|
||||
const patch = patches[i];
|
||||
|
@ -147,7 +151,7 @@ function patchPush() {
|
|||
mod = (0, eval)(`// Webpack Module ${id} - Patched by ${[...patchedBy].join(", ")}\n${newCode}\n//# sourceURL=WebpackModule${id}`);
|
||||
}
|
||||
} catch (err) {
|
||||
logger.error(`Failed to apply patch ${replacement.match} of ${patch.plugin} to ${id}:\n`, err);
|
||||
logger.error(`Patch by ${patch.plugin} errored (Module id is ${id}): ${replacement.match}\n`, err);
|
||||
|
||||
if (IS_DEV) {
|
||||
const changeSize = code.length - lastCode.length;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue