diff --git a/.gitignore b/.gitignore index 301132b..f0bbd74 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ package-lock.json dist build coverage +.vscode diff --git a/README.md b/README.md index e494680..804462a 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,34 @@ karmatic '**/*Spec.jsx?' ``` +## Usage + +```text +Usage + $ karmatic [options] + +Available Commands + run Run tests once and exit + watch Run tests on any change + debug Open a headful Puppeteer instance for debugging your tests + +For more info, run any command with the `--help` flag + $ karmatic run --help + $ karmatic watch --help + +Options + -v, --version Displays current version + --files Minimatch pattern for test files + --headless Run using Chrome Headless (default true) + --coverage Report code coverage of tests (default true) + -h, --help Displays this message +``` + +To disable any option that defaults to `true`, pass `false` to the option: `--headless false` or `--coverage false`. + +NOTE: The `debug` option overrides the default value of the `--headless` and `--coverage` option to be `false`. This option will also open up the local Puppeteer installation of Chrome, not your globally installed one. If you'd like to debug your tests using your your own instance of Chrome (or any other browser), copy the URL from the puppeteer window into your favorite browser. + + ## FAQ **Q**: [Is there an FAQ?](https://twitter.com/gauntface/status/956259291928776704)** diff --git a/src/cli.js b/src/cli.js index 5d4e789..6a02a04 100644 --- a/src/cli.js +++ b/src/cli.js @@ -28,6 +28,13 @@ prog .describe('Run tests on any change') .action( (str, opts) => run(str, opts, true) ); +prog + .command('debug [...files]') + .describe('Open a headful Puppeteer instance for debugging your tests') + .option('--headless', 'Run using Chrome Headless', false) // Override default to false + .option('--coverage', 'Report code coverage of tests', false) // Override default to false + .action( (str, opts) => run(str, opts, true) ); + prog.parse(process.argv); function run(str, opts, isWatch) {