{"name":"wdio-reporter","version":"5.0.0-alpha.9","description":"A WebdriverIO utility to help reporting all events","author":{"name":"Christian Bromann","email":"christian@saucelabs.com"},"homepage":"https://github.com/webdriverio/webdriverio/packages/wdio-reporter","license":"MIT","main":"./build/index","engines":{"node":">= 4.8.5"},"scripts":{"build":"run-s clean compile","clean":"rm -rf ./build","compile":"babel src/ -d build/","test":"run-s test:*","test:eslint":"eslint src test","test:unit":"jest"},"repository":{"type":"git","url":"git://github.com/webdriverio/webdriverio.git"},"keywords":["webdriver","wdio","wdio-reporter"],"bugs":{"url":"https://github.com/webdriverio/webdriverio/issues"},"readme":"WebdriverIO Reporter\n====================\n\n> A WebdriverIO utility to help reporting all events\n\nThe `wdio-reporter` package can be used to create own custom reporter and publish them to NPM. They have to follow a specific convention as described below in order to work properly. First you need to add `wdio-reporter` as dependency of your custom reporter:\n\n```sh\nnpm install wdio-reporter\n```\n\nor\n\n```sh\nyarn add wdio-reporter\n```\n\nThen you need to extend your reporter with the main wdio-reporter class:\n\n```js\nimport WDIOReporter from 'wdio-reporter'\n\nexport default MyCustomeReporter extends WDIOReporter {\n    constructor () {\n        super()\n        // your custom logic if necessary\n        // ...\n    }\n\n    onRunnerStart () {\n        // ...\n    }\n\n    onSuiteStart (suite) {\n        // ...\n    }\n\n    // ...\n}\n```\n\nThe WDIOReporter calls your event functions if provided when an event was triggered and provides information on that event in a consistent format. You can always register your own listener to receive the raw data that was provided by the framework, e.g. instead of using the `onSuiteStart` method you can do:\n\n```js\nthis.on('suite:start', (raw) => {\n    // ...\n})\n```\n\nin your constructor function.\n\n## Configuration\n\nUser can pass in custom configurations for each reporter. Per default WebdriverIO populates the `logDir` and `logLevel` option to the reporter, they can get overwritten too. For example, if the user has provided the following reporter options:\n\n```js\n// wdio.conf.js\nexports.config = {\n    // ...\n    reporters: ['dot', ['my-reporter', {\n        logDir: '/some/path',\n        foo: 'bar'\n    }]]\n    // ...\n}\n```\n\nyour options in your reporter class are as follows:\n\n```js\nexport default class MyReporter extends WDIOReporter {\n    constructor () {\n        super()\n        console.log(this.options)\n        /**\n         * outputs:\n         * {\n         *   logDir: '/some/path',\n         *   logLevel: 'trace',\n         *   foo: 'bar'\n         * }\n         */\n    }\n}\n```\n\nYou can access all options via `this.options`. You can push logs to stdout or a log file depending of whether the `stdout` option is true or false. Please use the internal method `write` that is provided by the `WDIOReporter` parent class in order to push out logs, e.g.\n\n```js\nclass MyReporter extends WDIOReporter {\n    constructor (options) {\n        /**\n         * make dot reporter to write to output stream by default\n         */\n        options = Object.assign(options, { stdout: true })\n        super(options)\n    }\n\n    // ...\n    onTestPass (test) {\n        this.write(`test \"${test.title}\" passed`)\n    }\n    // ...\n}\n```\n\nThis will result the following output:\n\n```\n\"MyReporter\" Reporter:\ntest \"some test\" passed\ntest \"some other test\" passed\n\n\"spec\" Reporter:\n...\n```\n\nIf `stdout` is set to `false` WebdriverIO will automatically write to a filestream at a location where other logs are stored as well.\n\n## Events\n\nDuring a test run in WebdriverIO several events are thrown and can be captured by your event functions. The following events are propagated:\n\n### Test Events\n\nThese events are containing data about the test regardless of the framework it is running in.\n\n##### onSuiteStart\n\n```js\nSuiteStats {\n  type: 'suite',\n  start: '2018-02-09T13:30:40.177Z',\n  duration: 0,\n  uid: 'root suite2',\n  cid: '0-0',\n  title: 'root suite',\n  fullTitle: 'root suite',\n  tests: [],\n  hooks: [],\n  suites: [] } }\n```\n\n##### onSuiteEnd\n\n```js\nSuiteStats {\n  type: 'suite',\n  start: '2018-02-09T13:30:40.177Z',\n  duration: 1432,\n  uid: 'root suite2',\n  cid: '0-0',\n  title: 'root suite',\n  fullTitle: 'root suite',\n  tests: [ [TestStats] ],\n  hooks: [ [HookStats], [HookStats] ],\n  suites: [ [Object] ],\n  end: '2018-02-09T13:30:41.609Z' } }\n```\n\n##### onHookStart\n\n```js\nHookStats {\n  type: 'hook',\n  start: '2018-02-09T13:30:40.181Z',\n  duration: 0,\n  uid: '\"before each\" hook4',\n  cid: '0-0',\n  title: '\"before each\" hook',\n  parent: 'root suite',\n  parentUid: 'root suite2' } }\n```\n\n##### onHookEnd\n\n```js\nHookStats {\n  type: 'hook',\n  start: '2018-02-09T13:30:40.181Z',\n  duration: 1,\n  uid: '\"before each\" hook4',\n  cid: '0-0',\n  title: '\"before each\" hook',\n  parent: 'root suite',\n  parentUid: 'root suite2',\n  end: '2018-02-09T13:30:40.182Z' } }\n```\n\n##### onTestStart\n\n```js\nTestStats {\n  type: 'test',\n  start: '2018-02-09T13:30:40.180Z',\n  duration: 0,\n  uid: 'passing test3',\n  cid: '0-0',\n  title: 'passing test',\n  fullTitle: 'passing test',\n  state: 'pending' } }\n```\n\n##### onTestSkip\n\n```js\nTestStats {\n  type: 'test',\n  start: '2018-02-09T14:01:04.573Z',\n  duration: 0,\n  uid: 'skipped test6',\n  cid: '0-0',\n  title: 'skipped test',\n  fullTitle: 'skipped test',\n  state: 'skipped' }\n```\n\n##### onTestPass\n\n```js\nTestStats {\n  type: 'test',\n  start: '2018-02-09T14:11:28.075Z',\n  duration: 1503,\n  uid: 'passing test3',\n  cid: '0-0',\n  title: 'passing test',\n  fullTitle: 'passing test',\n  state: 'passed',\n  end: '2018-02-09T14:11:29.578Z' } }\n```\n\n##### onTestFail\n\n```js\nTestStats {\n     type: 'test',\n     start: '2018-02-09T14:11:29.581Z',\n     duration: 21,\n     uid: 'failing test8',\n     cid: '0-0',\n     title: 'failing test',\n     fullTitle: 'failing test',\n     state: 'failed',\n     end: '2018-02-09T14:11:29.602Z',\n     error:\n      { message: 'some error',\n        stack: `Error: some error\\n    at Context.it (/path/to/project/test/b.js:17:19)\\n\n  at /path/to/project/packages/wdio-sync/src/index.js:490:28\\n    at Promise (<anonymous>)\\\nn    at F (/path/to/project/node_modules/core-js/library/modules/_export.js:35:28)\\n    at\nContext.executeSync (/path/to/project/packages/wdio-sync/src/index.js:488:12)\\n    at /path/to/project/packages/wdio-sync/src/index.js:623:33`,\n        type: 'Error' } } }\n```\n\n##### onTestEnd\n\n```js\nTestStats {\n  type: 'test',\n  start: '2018-02-09T14:11:28.075Z',\n  duration: 1503,\n  uid: 'passing test3',\n  cid: '0-0',\n  title: 'passing test',\n  fullTitle: 'passing test',\n  state: 'passed',\n  end: '2018-02-09T14:11:29.578Z' } }\n```\n\n### Runner Events\n\nThese events contain information on the test runner.\n\n##### onRunnerStart\n\n```js\nRunnerStats {\n  type: 'runner',\n  start: '2018-02-09T14:30:19.871Z',\n  duration: 0,\n  cid: '0-0',\n  capabilities:\n   { acceptInsecureCerts: false,\n     browserName: 'firefox',\n     browserVersion: '59.0',\n     'moz:accessibilityChecks': false,\n     'moz:headless': false,\n     'moz:processID': 92113,\n     'moz:profile': '/var/folders/ns/8mj2mh0x27b_gsdddy1knnsm0000gn/T/rust_mozprofile.jlpfs632Becb',\n     'moz:webdriverClick': true,\n     pageLoadStrategy: 'normal',\n     platformName: 'darwin',\n     platformVersion: '17.3.0',\n     rotatable: false,\n     timeouts: { implicit: 0, pageLoad: 300000, script: 30000 } },\n  sanitizedCapabilities: 'firefox.59_0.darwin',\n  config: [Object],\n  specs: [ '/path/to/project/test/my.test.js' ] }\n```\n\n##### onRunnerEnd\n\n```js\nRunnerStats {\n  type: 'runner',\n  start: '2018-02-09T14:30:19.871Z',\n  duration: 1546,\n  uid: undefined,\n  cid: '0-0',\n  capabilities: [Object],\n  sanitizedCapabilities: 'firefox.59_0.darwin',\n  config: [Object],\n  specs: [ '/path/to/project/test/my.test.js' ],\n  failures: 1,\n  end: '2018-02-09T14:30:21.417Z' } }\n```\n\n### Client Events\n\nClient events are triggered when certain interactions with the automation driver are happening.\n\n##### onBeforeCommand\n\n```js\n{ method: 'GET',\n  endpoint: '/session/:sessionId/element',\n  body: { using: 'css selector', value: 'img' }\n  cid: '0-0',\n  sessionId: '4d1707ae-820f-1645-8485-5a820b2a40da',\n  capabilities: [Object] }\n```\n\n##### onAfterCommand\n\n```js\n{ method: 'GET',\n  endpoint: '/session/:sessionId/element/fbf57b79-6521-7d49-b3b7-df91cf2c347a/rect',\n  body: {},\n  result: { value: { x: 75, y: 11, width: 160, height: 160 } },\n  cid: '0-0',\n  sessionId: '4d1707ae-820f-1645-8485-5a820b2a40da',\n  capabilities: [Object] }\n```\n","readmeFilename":"README.md","_id":"wdio-reporter@5.0.0-alpha.9","_npmVersion":"6.1.0","_nodeVersion":"8.11.2","_npmUser":{"name":"christian-bromann","email":"christian@saucelabs.com"},"dist":{"integrity":"sha512-o6mBMyhV6HBVS0TYqI0vIWaln32SsEt2Lp3cROfCpBvMVWwB6VT+6Z0MMzsI7C8VNFdLNv6ABYoAtF2TjHnLjA==","shasum":"4bc6a22d102deeff542c6927a4ba5cce4e00ffd6","tarball":"http://registry-npm.ywwl.com/wdio-reporter/download/wdio-reporter-5.0.0-alpha.9.tgz","fileCount":9,"unpackedSize":47000,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbRaTHCRA9TVsSAnZWagAAXkEP/3FHIP2fZAjiPJs7athZ\nQ4SiP1ElLtLP7yvJlyI2AtwXivhwmWAhqxejUFVh6kd4wo6bufu41tsaE5B2\nBKv9wj9di/BfUf8TtcANSsvOIAl1LOHu7QWBKfVP+rND1sKx1S++TMbO5iGS\nuuUOSY7ijtGyKumfu/hEI/bAy0n6oAbG7YTQUtPKekzyqCcfL/UdDHxH8O1y\nK5ugZrGZ3nT/dznw7z622ktJThp0KnhAW0+znFUIIgm+ep9/Mr9wfyn73rCp\nSWf19gy9Q2vIiXHePzIDUYchmziNjGDTkBzN6MaBIh8DRuEXI7sqObLg5FAs\nbQoqSyIrBlERLeLc9b4Lxt8OUT7jN2QOUn2o3hLCQbvcIQE3gItaNBTtXfZT\nXJJyUiv3RW4yD2AYbKdLGTyPgB/027WhWuYGuOxW5MoFDLvk1rHS+nAjlHBF\nNVF6S2LW80x29hsu+pzKKXvZ/Nj9Jqlq++O3IfK/qtGyXEzADTOvmmtSxfUa\nolKvScQ1wXWx1zg2gjG2ciRWcanvWUuwPwSuG7X8wEhVLwVxQrwSpxZYbJqU\nPuSS2ONVBLbpVaOlrZfbwxDjmla6XLMpBZ/sbaawrS305hTQmKqHeZyIoz8O\n5DIH+/Fr6FUlClRdn0Qo3aI67W5Hr8RlaG4zWTwoMBrfsiFxeKdFVjqIl33l\nWTtq\r\n=xaQ5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA9ezjVwL/+JLfsJt86k0aePDu5xmMHrjd8HUTYakRp2AiATz1PIMWkK8+VK1D37gn+Am3/qdHAsYhtGUR5yo0ikUQ=="}],"size":14145,"noattachment":false,"key":"/wdio-reporter/-/wdio-reporter-5.0.0-alpha.9.tgz"},"maintainers":[{"name":"christian-bromann","email":"christian@saucelabs.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/wdio-reporter_5.0.0-alpha.9_1531290823272_0.6056643403289281"},"_hasShrinkwrap":false,"publish_time":1531290823346,"_cnpm_publish_time":1531290823346,"dist-tags":{"alpha":"5.0.0-alpha.14","beta":"5.0.0-beta.0","latest":"5.0.0-alpha.7","next":"5.0.0-beta.3"}}