Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add debug command #27

Merged
merged 4 commits into from Apr 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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