screenshots icon indicating copy to clipboard operation
screenshots copied to clipboard

Config validation can be better at telling what is badly configured or missing

Open avioli opened this issue 5 years ago • 1 comments

I thought I can have the following screenshots.yaml:

devices:
  ios:
    iPhone SE:

But it doesn't work.

Running screenshots with that file yields stack trace output that is only good for the developer(s) of this lib.

There are no defaults for tests, staging, locales, nor frame.

I would suggest:

  • if devices is null - let the user know and exit;
  • if devices.ios and devices.android are null - let the user know and exit;
  • if tests is null, then walk test_driver dir (if it exists) and collect *.dart, that do not match *_test.dart;
  • if staging is null, default to /tmp/screenshots (or check TMPDIR env and fallback to /tmp/);
  • if frame is null, default to false (my suggestion, but fine with true too);
  • confirm all config types afterwards and tell the user if any value is of the wrong type;
  • output the values when -v/--verbose is used;
  • maybe even add a --print-config to to print the config as yaml with the defaults.

I could implement these if someone can help me a bit to find the right spot to add the validations/defaults.

avioli avatar Jan 22 '20 05:01 avioli

@avioli a good place to start may be validate.dart and config.dart

mmcc007 avatar Jan 22 '20 08:01 mmcc007