{"name":"wdio-reporter","version":"5.0.0-beta.2","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"},"devDependencies":{"tmp":"^0.0.33"},"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## Synchronization\n\nIf your reporter needs to do some async computation after the test (e.g. upload logs to a server) you can overwrite the `isSynchronised` getter method to manage this. By default this property always returns true as most of the reporters don't require to do any async work. However in case you need to handle this overwrite the getter method with an custom implementation (e.g. [wdio-sumologic-reporter](https://github.com/webdriverio/webdriverio/tree/master/packages/wdio-sumologic-reporter)).\n\n```js\nclass MyReporter extends WDIOReporter {\n    constructor (options) {\n        // ...\n    }\n\n    get isSynchronised (test) {\n        return this.unsyncedMessages.length === 0\n    }\n\n    // ...\n}\n```\n\nThe wdio testrunner will wait to kill the runner process until every reporter has the `isSynchronised` property set to `true`.\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-beta.2","_npmVersion":"6.1.0","_nodeVersion":"8.11.2","_npmUser":{"name":"christian-bromann","email":"christian@saucelabs.com"},"dist":{"integrity":"sha512-jv0mFzgKwzR6hqSvhH5eujbsu5eS2S2L4Qz2EiUv9CINaKyFfv4Eo/AiQRl0OLTPh8bsR1EgHpTldUGew5zLcA==","shasum":"918d5f6dfd1f69a23433cab4cbc6710ace6368ac","tarball":"http://registry-npm.ywwl.com/wdio-reporter/download/wdio-reporter-5.0.0-beta.2.tgz","fileCount":9,"unpackedSize":50981,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbkkU8CRA9TVsSAnZWagAAk0kP/A7jEJx70+xQDOj5Pbyr\nlT1xtULU2JRLDonoQw62ixru8ekt2dQFdVe3TuPWNzt8eorSqzxNsScR8gPY\n7ZCu5in/V5fxGObBxDzb4/wgPnTrFGXIo5FNjeAmIeK2KAQcx6QuagMGIm3X\npXRQ8H+t2yqE9KgQfLPq+j7pMUBEBhUO57yCPbDEfE7L1Jf2goMKFe5JaO76\n6uApZv9Lkzu8y2aKnWevE6n2+0KK/g2AX5Y+nVJhKXLwo+/QqQIlmLfj1pY5\ngb5t79HaGcqijjdgt+k18VkfINTLJa59ftnmpgXRjLIFjm8FSt8lnMFrVF1Q\nVqSna39hJ6pwnqjantRZz5u5Xf1bhsWouOJt5YYDUoWqNuEAbSmmOIEF58Wl\ntaio28olgmF7WRUUl9LXrj9eejfUMqgOYKXTXqcwd/ZuZlQy7N1p3lvXZdwH\ncffqrLIifA53ELda3XZ6NC4khxjZWqu9J7Wtxj6AhW4Upoiv/arMB/SBtwdR\n1Zm6Dn0cfKhsHsRBVVAfMzB1UarG2xlNjKRYS4JoH0nGnTn8wAWe0dbiNwF1\nHW+cyUyTNySYHw+v30m5xahujLprUkUGxVM7bhJUHhufpjwPAY/fWq/q8W2W\nVh/9TfrbBDnHQoehhjoJKgYnK14QutguH4f4vdjOkamb5oF60Ct5ZyV2VySS\nDvz0\r\n=x9/t\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHNC+bCL6xS5t+YchAv4aIQPBnxXSeg7apRaOOHlJ0F1AiBPGxmrFU10kGzmu4zaL8GR6VhlpR4mBZg8v7tQ4wg0bw=="}],"size":14992,"noattachment":false,"key":"/wdio-reporter/-/wdio-reporter-5.0.0-beta.2.tgz"},"maintainers":[{"name":"christian-bromann","email":"christian@saucelabs.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/wdio-reporter_5.0.0-beta.2_1536312635690_0.3857697565333862"},"_hasShrinkwrap":false,"publish_time":1536312635981,"_cnpm_publish_time":1536312635981,"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"}}