import { promisify } from 'util' ; import { exec } from 'child_process' ; import rimraf from 'rimraf' ; import fs from 'fs' ; import path from 'path' ; import os from 'os' ; describe ( 'create-goji-app' , ( ) => { jest . setTimeout ( 5 * 60 * 1000 ) ; it . skip ( 'create project' , async ( ) => { const binPath = require . resolve ( '../../bin/create-goji-app' ) ; const workDir = path . join ( os . tmpdir ( ) , '.create-goji-app' ) ; await promisify ( rimraf ) ( workDir ) ; await fs . promises . mkdir ( workDir , { recursive : true } ) ; const projectName = 'my-goji-app' ; const projectDir = path . join ( workDir , projectName ) ; await promisify ( exec ) ( `node ${ binPath } ${ projectName }` , { cwd : workDir } ) ; expect ( await fs . promises . stat ( path . join ( projectDir , 'package.json' ) ) ) . toBeTruthy ( ) ; expect ( require ( path . join ( projectDir , 'package.json' ) ) . dependencies [ '@goji/core' ] ) . toBe ( `^${ require ( '../../package.json' ) . version }` ) ; await promisify ( exec ) ( 'yarn' , { cwd : projectDir } ) ; await promisify ( exec ) ( 'yarn build' , { cwd : projectDir } ) ; } ) ; } ) ;