Skip to content

Commit 5d0e420

Browse files
Add a .chromeDataDir option to help debugging tests
1 parent 6b85d08 commit 5d0e420

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ You can change this to any minimatch pattern _(note the quotes to avoid shell ex
4040
karmatic '**/*Spec.jsx?'
4141
```
4242

43+
### Options
44+
45+
`--chromeDataDir <filename>`
46+
47+
Filename to be used to save Chrome preferences between test runs. Useful for debugging tests. It is recommended to also add this filename to `.gitignore`.
48+
49+
Example:
50+
```
51+
karmatic --chromeDataDir .chrome
52+
```
4353

4454
## License
4555

src/cli.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ let prog = sade('karmatic');
1515
prog
1616
.version(version)
1717
.option('--files', 'Minimatch pattern for test files')
18-
.option('--headless', 'Run using Chrome Headless', true);
18+
.option('--headless', 'Run using Chrome Headless', true)
19+
.option('--chromeDataDir', 'Save Chrome preferences');
1920

2021
prog
2122
.command('run [...files]', '', { default: true })

src/configure.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ export default function configure(options) {
108108

109109
customLaunchers: {
110110
KarmaticChrome: {
111-
base: 'Chrome'
111+
base: 'Chrome',
112+
chromeDataDir: options.chromeDataDir ? path.resolve(cwd, options.chromeDataDir) : null
112113
},
113114
KarmaticChromeHeadless: {
114115
base: 'ChromeHeadless',

0 commit comments

Comments
 (0)