mirror of
https://github.com/zsviczian/obsidian-excalidraw-plugin.git
synced 2026-12-03 06:43:35 +00:00
Add core native, device, frozen-workspace and CI test lanes (#3022)
This commit is contained in:
1 parent
62a3f430fb
commit
680e8a54e0
48 files changed
+1579
-181
No files matched your search
@@ -23,8 +23,12 @@ test("owned console and exception capture is removed with its exact attachment",
|
||||
const { cli, commands, debuggerInstance, context } = host();
|
||||
const session = acquireDebuggerSession(cli);
|
||||
debuggerInstance.emit("message", null, "Runtime.consoleAPICalled", { type: "error", args: [{ description: "actual failure" }] });
|
||||
debuggerInstance.emit("message", null, "Runtime.exceptionThrown", { exceptionDetails: { text: "exception" } });
|
||||
debuggerInstance.emit("message", null, "Runtime.executionContextCreated", {context:{id:4,name:'owned test context'}});
|
||||
debuggerInstance.emit("message", null, "Runtime.exceptionThrown", { exceptionDetails: {executionContextId:4,text:"Uncaught",exception:{type:'string',value:'actual primitive exception'}} });
|
||||
assert.equal(session.read().length, 2);
|
||||
assert.equal(session.read()[1].messages[0],"actual primitive exception");
|
||||
assert.equal(session.read()[1].context.name,"owned test context");
|
||||
assert.ok(commands.findIndex(command=>command.includes("method=Runtime.disable"))<commands.findIndex(command=>command.includes("method=Runtime.enable")));
|
||||
session.dispose(); session.dispose();
|
||||
assert.equal(debuggerInstance.listenerCount("message"), 0);
|
||||
assert.equal(Object.keys(context).some(key => key.startsWith("__excalidrawTestConsole_")), false);
|
||||
@@ -38,3 +42,10 @@ test("expected fault injection cannot hide another error or an incorrect count",
|
||||
assert.equal(unexpectedConsoleErrors([], expected).length, 1);
|
||||
assert.equal(unexpectedConsoleErrors([error, { ...error, kind: "exception" }], expected).length, 1);
|
||||
});
|
||||
|
||||
test('lost console controller fails cleanup but still releases our debugger attachment', () => {
|
||||
const {cli,commands,context}=host();const session=acquireDebuggerSession(cli);
|
||||
const key=Object.keys(context).find(key=>key.startsWith('__excalidrawTestConsole_'));assert.ok(key);vm.runInContext('delete globalThis['+JSON.stringify(key)+']',context);
|
||||
assert.throws(()=>session.dispose(),/controller disappeared/);
|
||||
assert.equal(commands.filter(command=>command[0]==='dev:debug'&&command[1]==='off').length,1);
|
||||
});
|
||||
Reference in new issue
Block a user