FEATURE: Add "Recent Errors" tab and improved error modal (#2169)

This commit is contained in:
Michael Ficocelli
2025-06-16 19:43:21 -04:00
committed by GitHub
parent cf72937faf
commit 18f84396e2
17 changed files with 530 additions and 34 deletions

View File

@@ -16,6 +16,7 @@ import { SpecialServers } from "../../../src/Server/data/SpecialServers";
import { WorkerScript } from "../../../src/Netscript/WorkerScript";
import { NetscriptFunctions } from "../../../src/NetscriptFunctions";
import type { PositiveInteger } from "../../../src/types";
import { ErrorState } from "../../../src/ErrorHandling/ErrorState";
declare const importActual: (typeof EvaluatorConfig)["doImport"];
@@ -118,6 +119,7 @@ const runOptions = {
describe("runScript and runScriptFromScript", () => {
let alertDelete: () => void;
let alerted: Promise<unknown>;
let errorShown: Promise<unknown>;
beforeEach(() => {
setupBasicTestingEnvironment();
@@ -127,6 +129,9 @@ describe("runScript and runScriptFromScript", () => {
alerted = new Promise((resolve) => {
alertDelete = AlertEvents.subscribe((x) => resolve(x));
});
errorShown = new Promise((resolve) => {
ErrorState.ErrorUpdate.subscribe((x) => resolve(x));
});
});
afterEach(() => {
alertDelete();
@@ -215,7 +220,7 @@ describe("runScript and runScriptFromScript", () => {
throw new Error(`Invalid worker script`);
}
const result = await Promise.race([
alerted,
errorShown,
new Promise<void>((resolve) => (workerScript.atExit = new Map([["default", resolve]]))),
]);
expect(result).toBeDefined();