Skip to content

Commit

Permalink
Merge pull request #27 from andrewiggins/debug-option
Browse files Browse the repository at this point in the history
Add debug command
  • Loading branch information
developit committed Apr 3, 2019
2 parents 38b3e9e + bf6f0b0 commit a391c9b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -4,3 +4,4 @@ package-lock.json
dist
build
coverage
.vscode
28 changes: 28 additions & 0 deletions README.md
Expand Up @@ -41,6 +41,34 @@ karmatic '**/*Spec.jsx?'
```


## Usage

```text
Usage
$ karmatic <command> [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)**
Expand Down
7 changes: 7 additions & 0 deletions src/cli.js
Expand Up @@ -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) {
Expand Down

0 comments on commit a391c9b

Please sign in to comment.