fix(scenario-logs): fix out-of-order run log persistence
- Add seq column assigned in call order to fix logs racing each other as fire-and-forget writes (e.g. a snippet's "started" entry could be saved after its "finished" entry) - Log snippet start/finish/failure via context.runSnippet, matching existing step start/pass/fail logging - Rework Markdown log export to per-entry sections instead of a table - Version bump: 1.10.0 -> 1.10.1
This commit is contained in:
1 parent
540a7ec96b
commit
385f51f3ba
6 files changed
+53
-16
No files matched your search
@@ -199,6 +199,7 @@ export class CodeExecutorService {
|
||||
if (snippetCode == null) {
|
||||
throw new Error(`Snippet alias "${alias}" not found`);
|
||||
}
|
||||
scriptLog("log", `Snippet "${alias}" started`);
|
||||
const snippetFn = new Function(
|
||||
"context",
|
||||
"console",
|
||||
@@ -206,7 +207,22 @@ export class CodeExecutorService {
|
||||
"expect",
|
||||
`return (async (context, ...args) => { ${snippetCode} })(context, ...snippetArgs)`,
|
||||
);
|
||||
return snippetFn(scriptContext, fakeConsole, args, playwrightExpect);
|
||||
try {
|
||||
const snippetResult = await snippetFn(
|
||||
scriptContext,
|
||||
fakeConsole,
|
||||
args,
|
||||
playwrightExpect,
|
||||
);
|
||||
scriptLog("log", `Snippet "${alias}" finished`);
|
||||
return snippetResult;
|
||||
} catch (err) {
|
||||
scriptLog(
|
||||
"error",
|
||||
`Snippet "${alias}" failed: ${(err as Error).message}`,
|
||||
);
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
getScenarioFiles: async (opts?: { limit?: number; offset?: number }) => {
|
||||
if (!fileService || !scenarioId) {
|
||||
|
||||
Reference in new issue
Block a user