Improve desktop script runs with timestamps & logs
Improve script execution in the desktop app by introducing timestamped filenames and detailed logging. These changes aim to facilitate easier debugging, auditing and overall better user experience. Key changes: - Add timestamps in filenames for temporary files to aid in troubleshooting and auditing. - Add application logging throughout the script execution process to enhance troubleshooting capabilities. Other supporting changes: - Refactor `TemporaryFileCodeRunner` with subfunctions for improved readability, maintenance, reusability and extensibility. - Refactor unit tests for `TemporaryFileCodeRunner` for improved granularity and simplicity. - Create centralized definition of supported operating systems by privacy.sexy to ensure robust and consistent test case creation. - Simplify the `runCode` method by removing the file extension parameter; now handled internally by `FileNameGenerator`.
This commit is contained in:
@@ -8,6 +8,8 @@ export class LocationOpsStub
|
||||
|
||||
private scenarios = new Map<string, string>();
|
||||
|
||||
private defaultSeparator = `/[${LocationOpsStub.name}]PATH-SEGMENT-SEPARATOR/`;
|
||||
|
||||
public withJoinResult(returnValue: string, ...paths: string[]): this {
|
||||
this.scenarios.set(LocationOpsStub.getScenarioKey(paths), returnValue);
|
||||
return this;
|
||||
@@ -19,6 +21,11 @@ export class LocationOpsStub
|
||||
return this;
|
||||
}
|
||||
|
||||
public withDefaultSeparator(defaultSeparator: string): this {
|
||||
this.defaultSeparator = defaultSeparator;
|
||||
return this;
|
||||
}
|
||||
|
||||
public combinePaths(...pathSegments: string[]): string {
|
||||
this.registerMethodCall({
|
||||
methodName: 'combinePaths',
|
||||
@@ -33,7 +40,7 @@ export class LocationOpsStub
|
||||
if (foundScenario) {
|
||||
return foundScenario;
|
||||
}
|
||||
return pathSegments.join('/PATH-SEGMENT-SEPARATOR/');
|
||||
return pathSegments.join(this.defaultSeparator);
|
||||
}
|
||||
|
||||
private static getScenarioKey(paths: string[]): string {
|
||||
|
||||
Reference in New Issue
Block a user