Reset app storage on mock-test failure to start app
This commit is contained in:
parent
051fb98e55
commit
f057bc560f
1 changed files with 13 additions and 2 deletions
|
@ -266,7 +266,11 @@ export class Bootstrap {
|
||||||
return path.join(this.backupPath, fileName);
|
return path.join(this.backupPath, fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async unlink(): Promise<void> {
|
public unlink(): Promise<void> {
|
||||||
|
return this.resetAppStorage();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async resetAppStorage(): Promise<void> {
|
||||||
assert(
|
assert(
|
||||||
this.storagePath !== undefined,
|
this.storagePath !== undefined,
|
||||||
'Bootstrap has to be initialized first, see: bootstrap.init()'
|
'Bootstrap has to be initialized first, see: bootstrap.init()'
|
||||||
|
@ -349,7 +353,6 @@ export class Bootstrap {
|
||||||
debug('starting the app');
|
debug('starting the app');
|
||||||
|
|
||||||
const { port } = this.server.address();
|
const { port } = this.server.address();
|
||||||
const config = await this.generateConfig(port, extraConfig);
|
|
||||||
|
|
||||||
let startAttempts = 0;
|
let startAttempts = 0;
|
||||||
const MAX_ATTEMPTS = 4;
|
const MAX_ATTEMPTS = 4;
|
||||||
|
@ -361,11 +364,16 @@ export class Bootstrap {
|
||||||
`App failed to start after ${MAX_ATTEMPTS} times, giving up`
|
`App failed to start after ${MAX_ATTEMPTS} times, giving up`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-await-in-loop
|
||||||
|
const config = await this.generateConfig(port, extraConfig);
|
||||||
|
|
||||||
const startedApp = new App({
|
const startedApp = new App({
|
||||||
main: ELECTRON,
|
main: ELECTRON,
|
||||||
args: [CI_SCRIPT],
|
args: [CI_SCRIPT],
|
||||||
config,
|
config,
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// eslint-disable-next-line no-await-in-loop
|
// eslint-disable-next-line no-await-in-loop
|
||||||
await startedApp.start();
|
await startedApp.start();
|
||||||
|
@ -375,6 +383,9 @@ export class Bootstrap {
|
||||||
`Failed to start the app, attempt ${startAttempts}, retrying`,
|
`Failed to start the app, attempt ${startAttempts}, retrying`,
|
||||||
error
|
error
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-await-in-loop
|
||||||
|
await this.resetAppStorage();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue