From 5bdcc97792d8ce24724c1598b76e72335ce82b75 Mon Sep 17 00:00:00 2001 From: sliptype Date: Thu, 11 Apr 2024 22:37:49 -0500 Subject: [PATCH] Remove utils --- .../tests/integration/use-temp-dir.ts | 24 -------- .../tests/integration/utils.ts | 59 ------------------- 2 files changed, 83 deletions(-) delete mode 100644 packages/create-audius-app/tests/integration/use-temp-dir.ts delete mode 100644 packages/create-audius-app/tests/integration/utils.ts diff --git a/packages/create-audius-app/tests/integration/use-temp-dir.ts b/packages/create-audius-app/tests/integration/use-temp-dir.ts deleted file mode 100644 index 7195446299c..00000000000 --- a/packages/create-audius-app/tests/integration/use-temp-dir.ts +++ /dev/null @@ -1,24 +0,0 @@ -import fs from 'fs-extra' -import os from 'os' -import path from 'path' - -export async function useTempDir( - fn: (folder: string) => void | Promise, - mode?: string | number -) { - const folder = path.join( - os.tmpdir(), - 'create-audius-app-test-' + Math.random().toString(36).slice(2) - ) - await fs.mkdirp(folder) - - if (mode) { - await fs.chmod(folder, mode) - } - - try { - await fn(folder) - } finally { - await fs.remove(folder) - } -} diff --git a/packages/create-audius-app/tests/integration/utils.ts b/packages/create-audius-app/tests/integration/utils.ts deleted file mode 100644 index 0d5629e2ef3..00000000000 --- a/packages/create-audius-app/tests/integration/utils.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { existsSync } from 'fs' -import { resolve } from 'path' -import glob from 'glob' -import { expect } from 'vitest' - -export interface DefaultTemplateOptions { - cwd: string - projectName?: string -} - -export interface ProjectFiles extends DefaultTemplateOptions { - files: string[] -} - -export interface ProjectDeps extends DefaultTemplateOptions { - type: 'dependencies' | 'devDependencies' - deps: string[] -} - -export const projectFilesShouldExist = ({ - cwd, - projectName = '.', - files -}: ProjectFiles) => { - const projectRoot = resolve(cwd, projectName) - for (const file of files) { - try { - const path = resolve(projectRoot, file) - expect(existsSync(path)).toBe(true) - } catch (err) { - require('console').error( - `missing expected file ${file}`, - glob.sync('**/*', { cwd, ignore: '**/node_modules/**' }), - files - ) - throw err - } - } -} - -export const projectFilesShouldNotExist = ({ - cwd, - projectName = '.', - files -}: ProjectFiles) => { - const projectRoot = resolve(cwd, projectName) - for (const file of files) { - try { - expect(existsSync(resolve(projectRoot, file))).toBe(false) - } catch (err) { - require('console').error( - `unexpected file present ${file}`, - glob.sync('**/*', { cwd, ignore: '**/node_modules/**' }), - files - ) - throw err - } - } -}