diff --git a/.github/workflows/e2e-matrix.yml b/.github/workflows/e2e-matrix.yml index 6d1b744d23..1223a4a74f 100644 --- a/.github/workflows/e2e-matrix.yml +++ b/.github/workflows/e2e-matrix.yml @@ -414,7 +414,7 @@ jobs: npm_config_registry: http://localhost:4872 YARN_REGISTRY: http://localhost:4872 NX_CACHE_DIRECTORY: 'tmp' - NX_E2E_SKIP_BUILD_CLEANUP: 'true' + NX_E2E_SKIP_CLEANUP: 'true' NX_E2E_RUN_E2E: 'true' NX_E2E_VERBOSE_LOGGING: 'true' NX_PERF_LOGGING: 'false' diff --git a/.github/workflows/e2e-windows.yml b/.github/workflows/e2e-windows.yml index 4165c5faab..7bb81bd8f8 100644 --- a/.github/workflows/e2e-windows.yml +++ b/.github/workflows/e2e-windows.yml @@ -302,7 +302,7 @@ jobs: SELECTED_PM: ${{ matrix.package_manager }} npm_config_registry: http://localhost:4872 NX_CACHE_DIRECTORY: 'tmp' - NX_E2E_SKIP_BUILD_CLEANUP: 'true' + NX_E2E_SKIP_CLEANUP: 'true' NX_E2E_RUN_E2E: 'true' NX_E2E_VERBOSE_LOGGING: 'true' NX_PERF_LOGGING: 'false' diff --git a/e2e/utils/global-setup.ts b/e2e/utils/global-setup.ts index 5f78d7e7db..3dc2e9e40f 100644 --- a/e2e/utils/global-setup.ts +++ b/e2e/utils/global-setup.ts @@ -2,8 +2,10 @@ import { startLocalRegistry } from '@nx/js/plugins/jest/local-registry'; import { join } from 'path'; import { exec } from 'child_process'; import { tmpdir } from 'tmp'; -import { existsSync } from 'fs-extra'; +import { existsSync, removeSync } from 'fs-extra'; import { Config } from '@jest/types'; +import { e2eCwd } from './get-env-info'; +import * as isCI from 'is-ci'; export default async function (globalConfig: Config.ConfigGlobals) { const isVerbose: boolean = @@ -19,10 +21,10 @@ export default async function (globalConfig: Config.ConfigGlobals) { storage: storageLocation, }); - if ( - process.env.NX_E2E_SKIP_BUILD_CLEANUP !== 'true' || - !existsSync('./build') - ) { + if (process.env.NX_E2E_SKIP_CLEANUP !== 'true' || !existsSync('./build')) { + if (!isCI) { + removeSync(e2eCwd); + } console.log('Publishing packages to local registry'); const publishVersion = process.env.PUBLISHED_VERSION ?? 'major'; await new Promise((res, rej) => {