Skip to content

Commit

Permalink
Add debug option
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewiggins committed Nov 20, 2018
1 parent 2772516 commit 7cadc38
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ package-lock.json
dist
build
coverage
.vscode
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,32 @@ 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
```

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
Original file line number Diff line number Diff line change
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 7cadc38

Please sign in to comment.