mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2026-01-24 13:30:59 -08:00
Separate logs by test scenario for easier debugging
This commit is contained in:
parent
98fe79482f
commit
197af220ed
1 changed files with 22 additions and 0 deletions
|
|
@ -58,4 +58,26 @@ After(async function(this: ApplicationWorld, { pickle }) {
|
|||
if (pickle.tags.some((tag) => tag.name === '@subwiki')) {
|
||||
await clearSubWikiRoutingTestData();
|
||||
}
|
||||
|
||||
// Separate logs by test scenario for easier debugging
|
||||
try {
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
const wikiLogFile = `${logsDirectory}/wiki-${today}.log`;
|
||||
const tidgiLogFile = `${logsDirectory}/TidGi-${today}.log`;
|
||||
|
||||
// Create a sanitized scenario name for the log files
|
||||
const scenarioName = pickle.name.replace(/[^a-z0-9]/gi, '_').substring(0, 50);
|
||||
|
||||
if (await fs.pathExists(wikiLogFile)) {
|
||||
const targetWikiLog = `${logsDirectory}/${scenarioName}_wiki.log`;
|
||||
await fs.move(wikiLogFile, targetWikiLog, { overwrite: true });
|
||||
}
|
||||
|
||||
if (await fs.pathExists(tidgiLogFile)) {
|
||||
const targetTidgiLog = `${logsDirectory}/${scenarioName}_TidGi.log`;
|
||||
await fs.move(tidgiLogFile, targetTidgiLog, { overwrite: true });
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error moving log files:', error);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue