chore(repo): use same cleanup function for lerna e2e (#14747)

This commit is contained in:
Miroslav Jonaš 2023-02-01 20:18:41 +01:00 committed by GitHub
parent c23b74ef89
commit 8614f3ac62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 12 deletions

View File

@ -4,7 +4,7 @@
*/
import {
cleanupLernaWorkspace,
cleanupProject,
newLernaWorkspace,
runLernaCLI,
tmpProjPath,
@ -32,7 +32,7 @@ expect.addSnapshotSerializer({
describe('Lerna Smoke Tests', () => {
beforeAll(() => newLernaWorkspace());
afterAll(() => cleanupLernaWorkspace());
afterAll(() => cleanupProject({ skipReset: true }));
// `lerna repair` builds on top of `nx repair` and runs all of its generators
describe('lerna repair', () => {

View File

@ -511,18 +511,15 @@ export async function killPorts(port?: number): Promise<boolean> {
}
// Useful in order to cleanup space during CI to prevent `No space left on device` exceptions
export async function cleanupProject(opts?: RunCmdOpts) {
export function cleanupProject({
skipReset,
...opts
}: RunCmdOpts & { skipReset?: boolean } = {}) {
if (isCI) {
// Stopping the daemon is not required for tests to pass, but it cleans up background processes
runCLI('reset', opts);
try {
removeSync(tmpProjPath());
} catch (e) {}
}
}
export function cleanupLernaWorkspace() {
if (isCI) {
if (!skipReset) {
runCLI('reset', opts);
}
try {
removeSync(tmpProjPath());
} catch (e) {}