Skip to content

Commit

Permalink
ci: test perf
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Oct 19, 2023
1 parent e607a77 commit e270ed3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
23 changes: 13 additions & 10 deletions test/integration/install.integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -16,9 +15,10 @@ describe('install/uninstall integration tests', () => {
let sandbox: SinonSandbox
let stubs: ReturnType<typeof ux.makeStubs>

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))
Expand All @@ -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 {}
})

Expand Down
17 changes: 11 additions & 6 deletions test/integration/sf.integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand Down

0 comments on commit e270ed3

Please sign in to comment.