Skip to content

Commit a391c9b

Browse files
authored
Merge pull request #27 from andrewiggins/debug-option
Add debug command
2 parents 38b3e9e + bf6f0b0 commit a391c9b

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ package-lock.json
44
dist
55
build
66
coverage
7+
.vscode

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,34 @@ karmatic '**/*Spec.jsx?'
4141
```
4242

4343

44+
## Usage
45+
46+
```text
47+
Usage
48+
$ karmatic <command> [options]
49+
50+
Available Commands
51+
run Run tests once and exit
52+
watch Run tests on any change
53+
debug Open a headful Puppeteer instance for debugging your tests
54+
55+
For more info, run any command with the `--help` flag
56+
$ karmatic run --help
57+
$ karmatic watch --help
58+
59+
Options
60+
-v, --version Displays current version
61+
--files Minimatch pattern for test files
62+
--headless Run using Chrome Headless (default true)
63+
--coverage Report code coverage of tests (default true)
64+
-h, --help Displays this message
65+
```
66+
67+
To disable any option that defaults to `true`, pass `false` to the option: `--headless false` or `--coverage false`.
68+
69+
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.
70+
71+
4472
## FAQ
4573

4674
**Q**: [Is there an FAQ?](https://twitter.com/gauntface/status/956259291928776704)**

src/cli.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ prog
2828
.describe('Run tests on any change')
2929
.action( (str, opts) => run(str, opts, true) );
3030

31+
prog
32+
.command('debug [...files]')
33+
.describe('Open a headful Puppeteer instance for debugging your tests')
34+
.option('--headless', 'Run using Chrome Headless', false) // Override default to false
35+
.option('--coverage', 'Report code coverage of tests', false) // Override default to false
36+
.action( (str, opts) => run(str, opts, true) );
37+
3138
prog.parse(process.argv);
3239

3340
function run(str, opts, isWatch) {

0 commit comments

Comments
 (0)