Skip to content

Commit

Permalink
Add CLI option to disable the progressbar. Closes #58
Browse files Browse the repository at this point in the history
  • Loading branch information
sarimarton committed Aug 24, 2023
1 parent e69de9a commit 4024631
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/core/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ const hRule = chalk.gray('─'.repeat(process.stdout.columns));

const CONFIG_FILENAME = 'smashtest.json';

const PROGRESS_BAR_ON = true;
let fullRun = false;

console.log(hRule);
Expand Down Expand Up @@ -183,6 +182,7 @@ Options
--no-debug Fail if there are any $'s or ~'s. Useful to prevent debugging in CI.
--output-errors=<true/false> Whether to output all errors to console
--p:<name>="<value>" Set a persistent variable
--progress-bar=<true/false> Whether to output a progress bar
--random=<true/false> Whether to randomize the order of branches
--recursive Scan the current directory and subdirectories for .smash files
--repl Open the REPL (drive Smashtest from command line) (-r)
Expand Down Expand Up @@ -240,6 +240,10 @@ Options
runner.persistent[matches.groups.varName] = value;
break;

case 'progress-bar':
runner.showProgressBar = boolValue();
break;

case 'random':
runner.random = boolValue();
break;
Expand Down Expand Up @@ -824,7 +828,7 @@ function plural(count: number) {
// ***************************************
fullRun = true;
if (PROGRESS_BAR_ON) {
if (runner.showProgressBar) {
// Progress bar
progressBar = generateProgressBar(true);
progressBar.start(tree.counts.totalSteps, tree.counts.totalStepsComplete);
Expand All @@ -837,7 +841,7 @@ function plural(count: number) {
}
}
catch (e) {
onError(e, fullRun && PROGRESS_BAR_ON);
onError(e, fullRun && runner.showProgressBar);
}
/**
Expand Down
1 change: 1 addition & 0 deletions src/core/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Runner {
minFrequency?: Frequency; // Only run branches at or above this frequency, no restrictions if this is undefined
noDebug = false; // If true, a compile error will occur if a $, ~, or ~~ is present anywhere in the tree
outputErrors = true; // If true, output errors to console
showProgressBar = true; // If true, shows progress bar in the output of the console.
random = true; // If true, randomize the order of branches
screenshots = false; // If true, take screenshots before and after each step
skipPassed?: boolean; // If true, carry over branches that passed last time
Expand Down

0 comments on commit 4024631

Please sign in to comment.