Skip to content

Commit 2fc1113

Browse files
committed
cleanup output text ui
Signed-off-by: shmck <[email protected]>
1 parent abd46f1 commit 2fc1113

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

src/utils/exec.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,14 @@ export function createCommandRunner(cwd: string) {
4343
let errors = [];
4444
for (const command of commands) {
4545
try {
46-
console.log(`> ${command}`);
46+
console.log(`--> ${command}`);
4747
let cwdDir = cwd;
4848
if (dir) {
4949
cwdDir = path.join(cwd, dir);
5050
}
5151
const { stdout, stderr } = await createExec(cwdDir)(command);
5252

5353
console.warn(stderr);
54-
console.log(stdout);
5554
} catch (e) {
5655
console.error(`Command failed: "${command}"`);
5756
console.warn(e.message);

src/validate.ts

+19-14
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,15 @@ async function validate(args: string[]) {
5858
const runTest = createTestRunner(tmpDir, skeleton.config.testRunner);
5959

6060
// setup
61+
console.info("* Setup");
6162
if (commits.INIT) {
6263
// load commits
63-
console.info("Loading setup commits...");
64+
console.info("-- Loading commits...");
6465
await cherryPick(commits.INIT);
6566

6667
// run commands
6768
if (skeleton.config?.testRunner?.setup?.commands) {
68-
console.info("Running setup commands...");
69+
console.info("-- Running commands...");
6970

7071
await runCommands(
7172
skeleton.config?.testRunner?.setup?.commands,
@@ -76,30 +77,32 @@ async function validate(args: string[]) {
7677
}
7778

7879
for (const level of skeleton.levels) {
80+
console.info(`* ${level.id}`);
7981
if (level?.setup) {
8082
// load commits
8183
if (commits[`${level.id}`]) {
82-
console.log(`Loading ${level.id} commits...`);
84+
console.log(`-- Loading commits...`);
8385
await cherryPick(commits[level.id]);
8486
}
8587
// run commands
8688
if (level.setup?.commands) {
87-
console.log(`Running ${level.id} commands...`);
89+
console.log(`-- Running commands...`);
8890
await runCommands(level.setup.commands);
8991
}
9092
}
9193
// steps
9294
if (level.steps) {
9395
for (const step of level.steps) {
96+
console.info(`** ${step.id}`);
9497
// load commits
9598
const stepSetupCommits = commits[`${step.id}Q`];
9699
if (stepSetupCommits) {
97-
console.info(`Loading ${step.id} setup commits...`);
100+
console.info(`--- Loading setup commits...`);
98101
await cherryPick(stepSetupCommits);
99102
}
100103
// run commands
101104
if (step.setup.commands) {
102-
console.info(`Running ${step.id} setup commands...`);
105+
console.info(`--- Running setup commands...`);
103106
await runCommands(step.setup.commands);
104107
}
105108

@@ -109,47 +112,49 @@ async function validate(args: string[]) {
109112
// ignore running tests on steps with no solution
110113
if (hasSolution) {
111114
// run test
112-
console.info("Running setup test");
115+
console.info("--- Running setup test...");
113116
// expect fail
114117
const { stdout, stderr } = await runTest();
115118
if (stdout) {
116119
console.error(
117-
`Expected ${step.id} setup tests to fail, but passed`
120+
`--- Expected ${step.id} setup tests to fail, but passed`
118121
);
122+
// log tests
119123
console.log(stdout);
120124
}
121125
}
122126

123127
if (stepSolutionCommits) {
124-
console.info(`Loading ${step.id} solution commits...`);
128+
console.info(`--- Loading solution commits...`);
125129
await cherryPick(stepSolutionCommits);
126130
}
127131

128132
// run commands
129133
if (step?.solution?.commands) {
130-
console.info(`Running ${step.id} solution commands...`);
134+
console.info(`--- Running solution commands...`);
131135
await runCommands(step.solution.commands);
132136
}
133137

134138
if (hasSolution) {
135139
// run test
136-
console.info("Running solution test");
140+
console.info("--- Running solution test...");
137141
// expect pass
138142
const { stdout, stderr } = await runTest();
139143
if (stderr) {
140144
console.error(
141-
`Expected ${step.id} solution tests to pass, but failed`
145+
`--- Expected ${step.id} solution tests to pass, but failed`
142146
);
147+
// log tests
143148
console.log(stderr);
144149
}
145150
}
146151
}
147152
}
148153
}
149154

150-
// log level/step
151-
// on error, show level/step & error message
155+
console.info(`\n✔ Success!`);
152156
} catch (e) {
157+
console.error("\n✘ Fail!");
153158
console.error(e.message);
154159
} finally {
155160
// cleanup

0 commit comments

Comments
 (0)