{"name":"wdio-reporter","version":"5.0.0-alpha.8","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.8","_npmVersion":"6.1.0","_nodeVersion":"8.11.2","_npmUser":{"name":"christian-bromann","email":"christian@saucelabs.com"},"dist":{"integrity":"sha512-GlbchWdjYGXDjd/Vf6ehHclRKW3ZB63qaSHg5detfpkW40kWpU08PeE6MNAIG8YX2CG8SZ4fBbepicWIPBLkFQ==","shasum":"f46032f1cf8c230f584aca8f61941a39c6cf8b57","tarball":"http://registry-npm.ywwl.com/wdio-reporter/download/wdio-reporter-5.0.0-alpha.8.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\nwsFcBAEBCAAQBQJbRIR1CRA9TVsSAnZWagAA4C4P/R74NWvdRNvdF/fOuPcy\nEZmIhbcKPQuwemK5aD/8epclm9eixlm7PVHFiTGFf/m+fptRY6AfST3ArkAF\nMPn2BI1tzuflZF9HHDSXj7W51A41cISJdYx8z7mIxMsoOCawHIGj7C7kHTlj\nrpkesJ7f4IopSBVV4uZtQyBjDBAnZ3Xbt/D76wqLw0oA52doefLS3F24kzwr\ncEdA8lFEgkRO+F0jl27Qc09pPEFZSUJ0K+/JQl/k4FFGSCWoL6O07fJhI/5R\nMPa62qKAZ3Exq8ZXjn6CqLldJAwoZ1i02cQjVe/QDm/cYoHQai0yywmCcJNv\nEAHEm55IvfFYVIkL7YoYY/H65dGo2y5ty8OzdAkF6GoMA0f1L2ThsbMnhi10\n80SfF/U9UBh64L9mD0wRQQCS5DtisR7tyu/OseQno16OZjwXJCGWcqvxgJGP\ngUQ9K+wECTCWLsDeOZWxTYt2GsvYxnlghEmbBvzElRy5vayx8/MrieO/FLZb\nLEeojUQVV1axCPM0J2EIxS0POIpG+PiEY7Xo5fMC0H10HD9e9nBqq8y9yDZN\nOaQcvlLGcryOSejTnN5kb6fi1ZpLA7UqUqN+m++6ITlSmJsi+nycFwOOxNgD\nvSNFUfDUUq1gUV4ryE/yclD54H/l43RB+LVZInJ3808sxKiW7zB6GJv0iE1b\nwLe9\r\n=dh+T\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDKdBuwBQPncmC96G6IH5cDy1DrOhE5KiTl8eWXGaY04AIhALqELPTO3hziPlF+rB9AqCxpkitv0Vl48uIYYW0VdHka"}],"size":14145,"noattachment":false,"key":"/wdio-reporter/-/wdio-reporter-5.0.0-alpha.8.tgz"},"maintainers":[{"name":"christian-bromann","email":"christian@saucelabs.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/wdio-reporter_5.0.0-alpha.8_1531217013666_0.1405535559661224"},"_hasShrinkwrap":false,"publish_time":1531217013726,"_cnpm_publish_time":1531217013726,"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"}}