Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

test(launch): the launchers print every warning and error, and count a logged error

esengine01b64510c783
diff --git a/tools/launchers/launch-export.mjs b/tools/launchers/launch-export.mjs
index 2b309e73e..e0b349d2e 100644
--- a/tools/launchers/launch-export.mjs
+++ b/tools/launchers/launch-export.mjs
@@ -250,11 +250,15 @@ const SCENE = flag('scene', '');
// Every line, not just the angry ones: when a package never draws, what it got
// through before stopping is the whole diagnosis, and none of it says "error".
const recent = [];
- const stop = onRendererConsole(win.webContents, (msg) => {
+ const stop = onRendererConsole(win.webContents, (msg, level) => {
recent.push(msg.slice(0, 200));
if (recent.length > 12) recent.shift();
- if (/error|uncaught|failed/i.test(msg)) errors.push(msg.slice(0, 300));
- if (msg.startsWith('[engine]') || logRe?.test(msg)) console.log(` ${msg}`);
+ if (level === 'error' || /error|uncaught|failed/i.test(msg)) errors.push(msg.slice(0, 300));
+ // Every warning and error is printed: a verdict reads only the frame, and
+ // what the game complained about on the way there is the rest of the story.
+ if (level === 'warning' || level === 'error' || msg.startsWith('[engine]') || logRe?.test(msg)) {
+ console.log(` ${msg.slice(0, 400)}`);
+ }
});
win.webContents.on('render-process-gone', (_e, d) => errors.push(`render process gone: ${d.reason}`));
diff --git a/tools/launchers/launch-minigame.mjs b/tools/launchers/launch-minigame.mjs
index 7044ffb04..e93f7d383 100644
--- a/tools/launchers/launch-minigame.mjs
+++ b/tools/launchers/launch-minigame.mjs
@@ -136,14 +136,16 @@ async function main() {
});
const errors = [];
- const stop = onRendererConsole(win.webContents, (msg) => {
- // `[estella]` is the PACKAGE's own voice — the generated entry says why a 分包
- // did not come down, which is the diagnosis a silent black frame is missing.
- if (/\[minigame\] boot failed|\[estella\]|uncaught|is not a function|no such file/i.test(msg)) {
+ const stop = onRendererConsole(win.webContents, (msg, level) => {
+ // `[estella]` is the package's own voice (why a 分包 did not come down). Any
+ // logged error counts too: a system that throws every frame still paints.
+ if (level === 'error' || /\[minigame\] boot failed|\[estella\]|uncaught|is not a function|no such file/i.test(msg)) {
errors.push(msg.slice(0, 400));
}
// The engine names the GL path it took; a check about EmscriptenGLX reads it.
- if (/^\[(minigame|engine|estella)\]|rendering through /.test(msg)) console.log(` ${msg}`);
+ if (level === 'warning' || level === 'error' || /^\[(minigame|engine|estella)\]|rendering through /.test(msg)) {
+ console.log(` ${msg.slice(0, 400)}`);
+ }
});
win.webContents.on('render-process-gone', (_e, d) => errors.push(`render process gone: ${d.reason}`));