Reduce mock test flake on CI
This commit is contained in:
parent
62040e5c1a
commit
e41973c238
4 changed files with 41 additions and 3 deletions
25
ts/test-mock/setup-ci.ts
Normal file
25
ts/test-mock/setup-ci.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
// Copyright 2023 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import createDebug from 'debug';
|
||||
|
||||
import { Bootstrap } from './bootstrap';
|
||||
|
||||
const debug = createDebug('mock:test:setup-ci');
|
||||
|
||||
// Sadly, we can reduce flakiness in CI by launching the app once first
|
||||
export async function mochaGlobalSetup(): Promise<void> {
|
||||
if (!process.env.CI) {
|
||||
return;
|
||||
}
|
||||
|
||||
debug('Launching app before running all tests');
|
||||
const bootstrap = new Bootstrap();
|
||||
await bootstrap.init();
|
||||
const app = await bootstrap.link();
|
||||
|
||||
debug('Closing app before running all tests');
|
||||
await app.close();
|
||||
await bootstrap.teardown();
|
||||
debug('Done');
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue