Skip to content

Commit

Permalink
Improve debug toggling
Browse files Browse the repository at this point in the history
  • Loading branch information
timhaines committed Dec 13, 2017
1 parent b0a96e4 commit 7838d1b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/percy-storybook/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,15 @@ export async function run(argv) {
const rtlRegex = getRtlRegex(argv.rtl, argv.rtl_regex);

const options = {
debug: argv.debug,
// Configure debug logging if flag specified, or if it was already enabled via DEBUG env var
debug: argv.debug || debug.enabled,
buildDir: argv.build_dir,
outputFormat: getOutputFormat(argv.output_format),
};

// Enable debug logging based on options.
debug.enabled = options.debug;

if (process.env.PERCY_ENABLE === '0') {
if (options.outputFormat == 'text') {
// eslint-disable-next-line no-console
Expand All @@ -74,10 +78,10 @@ export async function run(argv) {
// debug('assets %o', assets);

const stories = await getStories(assets[storybookJavascriptPath], options);
options.debug && debug('stories %o', stories);
debug('stories %o', stories);

const selectedStories = selectStories(stories, rtlRegex);
options.debug && debug('selectedStories %o', selectedStories);
debug('selectedStories %o', selectedStories);

if (selectedStories.length === 0) {
if (options.outputFormat == 'text') {
Expand Down

0 comments on commit 7838d1b

Please sign in to comment.