From e270ed3804e98fd4da75e29bc3060dfa0f006194 Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Thu, 19 Oct 2023 15:14:53 -0600 Subject: [PATCH] ci: test perf --- test/integration/install.integration.ts | 23 +++++++++++++---------- test/integration/sf.integration.ts | 17 +++++++++++------ 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/test/integration/install.integration.ts b/test/integration/install.integration.ts index 1c2c7205..0c20f3f3 100644 --- a/test/integration/install.integration.ts +++ b/test/integration/install.integration.ts @@ -4,8 +4,7 @@ import {expect} from 'chai' import chalk from 'chalk' import {existsSync} from 'node:fs' import {rm} from 'node:fs/promises' -import {tmpdir} from 'node:os' -import {join} from 'node:path' +import {join, resolve} from 'node:path' import {SinonSandbox, createSandbox, match} from 'sinon' import PluginsIndex from '../../src/commands/plugins/index.js' @@ -16,9 +15,10 @@ describe('install/uninstall integration tests', () => { let sandbox: SinonSandbox let stubs: ReturnType - const cacheDir = join(tmpdir(), 'plugin-plugins-tests', 'cache') - const configDir = join(tmpdir(), 'plugin-plugins-tests', 'config') - const dataDir = join(tmpdir(), 'plugin-plugins-tests', 'data') + const tmp = resolve('tmp', 'install-integration') + const cacheDir = join(tmp, 'plugin-plugins-tests', 'cache') + const configDir = join(tmp, 'plugin-plugins-tests', 'config') + const dataDir = join(tmp, 'plugin-plugins-tests', 'data') console.log('process.env.MYCLI_DATA_DIR:', chalk.dim(dataDir)) console.log('process.env.MYCLI_CACHE_DIR:', chalk.dim(cacheDir)) @@ -28,11 +28,14 @@ describe('install/uninstall integration tests', () => { before(async () => { try { - await Promise.all([ - rm(cacheDir, {force: true, recursive: true}), - rm(configDir, {force: true, recursive: true}), - rm(dataDir, {force: true, recursive: true}), - ]) + // no need to clear out directories in CI since they'll always be empty + if (process.env.CI) { + await Promise.all([ + rm(cacheDir, {force: true, recursive: true}), + rm(configDir, {force: true, recursive: true}), + rm(dataDir, {force: true, recursive: true}), + ]) + } } catch {} }) diff --git a/test/integration/sf.integration.ts b/test/integration/sf.integration.ts index c4d33050..b8654170 100644 --- a/test/integration/sf.integration.ts +++ b/test/integration/sf.integration.ts @@ -30,7 +30,7 @@ describe('sf Integration', () => { before(async () => { await ensureSfExists() - const tmp = resolve('tmp') + const tmp = resolve('tmp', 'sf-integration') process.env.SF_DATA_DIR = join(tmp, 'data') process.env.SF_CACHE_DIR = join(tmp, 'cache') process.env.SF_CONFIG_DIR = join(tmp, 'config') @@ -39,11 +39,16 @@ describe('sf Integration', () => { console.log('process.env.SF_CACHE_DIR:', chalk.dim(process.env.SF_CACHE_DIR)) console.log('process.env.SF_CONFIG_DIR:', chalk.dim(process.env.SF_CONFIG_DIR)) - await Promise.all([ - rm(process.env.SF_DATA_DIR, {force: true, recursive: true}), - rm(process.env.SF_CACHE_DIR, {force: true, recursive: true}), - rm(process.env.SF_CONFIG_DIR, {force: true, recursive: true}), - ]) + // no need to clear out directories in CI since they'll always be empty + try { + if (process.env.CI) { + await Promise.all([ + rm(process.env.SF_DATA_DIR, {force: true, recursive: true}), + rm(process.env.SF_CACHE_DIR, {force: true, recursive: true}), + rm(process.env.SF_CONFIG_DIR, {force: true, recursive: true}), + ]) + } + } catch {} await exec('sf plugins link') const {stdout} = await exec('sf plugins --core')