Skip to content

Latest commit

 

History

History
58 lines (52 loc) · 4.91 KB

cdp.md

File metadata and controls

58 lines (52 loc) · 4.91 KB

CDP

Chrome Debugging Protocol

This command uses the Chrome Debugging Protocol to run tests in the Chrome browser. It's designed to be streamlined with the default Node runner so it can leverage the same Mocha reporters and Nycreporters even if the tests are running in a browser environment. It also supports the same developer workflow when writing tests e.g only rerun affected tests when a test or source file is saved.

Generating coverage

This runner is using babel and babel-plugin-istanbul to instrument the files before serving them to the browser. Make sure to add them as devDependencies e.g

npm i --save-dev babel-core babel-plugin-istanbul
Options:
  --version                      Show version number                                                           [boolean]
  --config, -c                   Path to JSON config file                                       [string] [default: null]
  --url                          Url to html file                                                    [string] [required]
  --glob                         Glob pattern                                   [array] [default: ["test/**/*.spec.js"]]
  --watch, -w                    Watch changes                                                [boolean] [default: false]
  --watchGlob, --wg              Watch glob                  [array] [default: ["src/**/*.{js,ts}","test/**/*.{js,ts}"]]
  --coverage                     Generate coverage?                                           [boolean] [default: false]
  --transform.typescript.config  Typescript config file                              [string] [default: "tsconfig.json"]
  --transform.include            Transform files with babel?                                       [array] [default: []]
  --transform.exclude            Exclude glob                                                      [array] [default: []]
  --transform.defaultExclude     Default exclude glob                                                  [array] [default:
  ["**/coverage/**","**/external/**","**/autogenerated/**","**/*.(html|css|json|txt|ttf|woff|svg)","**/*require*.js","**
                                                                                           /*sinon*.js","**/*chai*.js"]]
  --instrument.include           Instrument files with babel?                                      [array] [default: []]
  --instrument.exclude           Exclude glob                                                      [array] [default: []]
  --instrument.defaultExclude    Exclude glob                                                          [array] [default:
  ["**/coverage/**","**/external/**","**/autogenerated/**","**/*.(html|css|json|txt|ttf|woff|svg)","**/*require*.js","**
                                                                       /*sinon*.js","**/*chai*.js","**/*.spec.{js,ts}"]]
  --mocha.bail                   Bail on fail?                                                 [boolean] [default: true]
  --mocha.ui                     Test interface                                                [string] [default: "bdd"]
  --mocha.timeout                Timeout                                                        [number] [default: 2000]
  --mocha.useColors              Use colors                                                    [boolean] [default: true]
  --mocha.reporter               Reporter                                                      [string] [default: "min"]
  --client.port                  Chrome port                                                    [number] [default: 9222]
  --chrome.launch                Launch Chrome?                                                [boolean] [default: true]
  --chrome.devtools              Open Chrome with dev tools?                                  [boolean] [default: false]
  --chrome.port                  Chrome port                                                    [number] [default: 9222]
  --chrome.chromeFlags           Chrome flags
                                      [array] [default: ["--headless","--disable-gpu","--allow-file-access-from-files"]]
  --http.port                    Listen on this http port                                       [number] [default: 9676]
  --http.root                    Root folders to serve                                         [array] [default: ["./"]]
  --nyc.tempDirectory            Directory to output raw coverage information to
                                                                            [string] [default: "./coverage/.nyc_output"]
  --nyc.reporter                 Coverage reporter(s) to use                  [array] [default: ["lcov","text-summary"]]
  --nyc.reportDir                Directory to output coverage reports in                  [string] [default: "coverage"]
  -h, --help                     Show help                                                                     [boolean]