@@ -3,7 +3,7 @@ import * as fs from "fs-extra";
33import * as yamlParser from "js-yaml" ;
44import { getArg } from "./utils/args" ;
55import gitP , { SimpleGit } from "simple-git/promise" ;
6- import { gitPCherryPick } from "./utils/cherryPick " ;
6+ import { createCommandRunner , createCherryPick } from "./utils/exec " ;
77import { getCommits , CommitLogObject } from "./utils/commits" ;
88
99async function validate ( args :string [ ] ) {
@@ -23,8 +23,6 @@ async function validate(args: string[]) {
2323try {
2424skeleton = yamlParser . load ( _yaml ) ;
2525
26- console . log ( "config" , skeleton ) ;
27- // TODO: validate yaml
2826if ( ! skeleton ) {
2927throw new Error ( "Invalid yaml file contents" ) ;
3028}
@@ -37,7 +35,6 @@ async function validate(args: string[]) {
3735
3836// validate commits
3937const commits :CommitLogObject = await getCommits ( { localDir, codeBranch} ) ;
40- console . log ( "commits" , commits ) ;
4138
4239// setup tmp dir
4340const tmpDir = path . join ( localDir , ".tmp" ) ;
@@ -48,17 +45,23 @@ async function validate(args: string[]) {
4845}
4946const tempGit :SimpleGit = gitP ( tmpDir ) ;
5047
51- console . log ( Object . keys ( gitP ) ) ;
52-
5348await tempGit . init ( ) ;
5449await tempGit . addRemote ( "origin" , skeleton . config . repo . uri ) ;
5550await tempGit . fetch ( "origin" , skeleton . config . repo . branch ) ;
5651// no js cherry pick implementation
57- const cherryPick = gitPCherryPick ( tmpDir ) ;
52+ const cherryPick = createCherryPick ( tmpDir ) ;
53+ const runCommands = createCommandRunner ( tmpDir ) ;
5854
5955// VALIDATE TUTORIAL TESTS
6056if ( commits . INIT ) {
57+ // load commits
58+ console . info ( "Loading setup commits..." ) ;
6159cherryPick ( commits . INIT ) ;
60+
61+ // run commands
62+ if ( skeleton . config ?. testRunner ?. setup ?. commands ) {
63+ runCommands ( skeleton . config ?. testRunner ?. setup ?. commands ) ;
64+ }
6265}
6366
6467// run test runner setup command(s)