1 import { mkdir } from 'fs/promises'; 2 import { join } from 'path'; 3 import { getGlobalVariable, setGlobalVariable } from '../utils/env'; 4 5 /** 6 * Create a parent directory for test projects to be created within. 7 * Change the cwd() to that directory in preparation for launching the cli. 8 */ 9 export default async function () { 10 const tempRoot: string = getGlobalVariable('tmp-root'); 11 const projectsRoot = join(tempRoot, 'e2e-test'); 12 13 setGlobalVariable('projects-root', projectsRoot); 14 15 await mkdir(projectsRoot); 16 17 console.log(` Using "${projectsRoot}" as temporary directory for a new project.`); 18 process.chdir(projectsRoot); 19 }