File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 11import { execSync } from "child_process" ;
2+ import { getConfigPath } from "../utils/utils" ;
3+ import fs from "fs" ;
24
35export const cli = ( args : any ) : string => {
6+ // Validate config path exists and a config file is there
7+ // You must have a valid config file before runnning tests!
8+ // If you don't have one, run the CLI to generate it
9+ const configPath = getConfigPath ( ) ;
10+ if ( ! configPath ) throw new Error ( "Could not find config path" ) ;
11+ try {
12+ fs . readFileSync ( configPath ) ;
13+ } catch ( err : any ) {
14+ throw new Error ( err . message + "\nBefore running tests you must have a valid .treerc file - try running the cli first" ) ;
15+ }
16+
417 try {
518 const result = execSync ( `ts-node src/index ${ args . join ( " " ) } ` ) ;
619 return result . toString ( ) ;
Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ import { checkConfig } from "./utils/checkConfig";
2222
2323 // Check if config already exists, if not attempt to create it
2424 await checkConfig ( ) ;
25-
2625 program
2726 . argument ( "[directory]" , "directory to build structure from" , "." )
2827 . option ( "-o, --output <output>" , "location where command output should be stored" )
You can’t perform that action at this time.
0 commit comments