npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@wyh.michael/wdio-json-reporter

v3.2.0

Published

A fork of https://github.com/fijijavis/wdio-json-reporter with dependencies updated including wido@v7

Downloads

3

Readme

Fork of WDIO JSON Reporter with dependencies updated

A WebdriverIO plugin. Report results in json format. With updates to WDIO@v7

WDIO Version Compatibility

This package is only made for wdio@v7, please see https://github.com/fijijavis/wdio-json-reporter/ for compatibility with other wdio versions

Note: the changes from this fork are also made or going to be made back to https://github.com/fijijavis/wdio-json-reporter/, I recommend to use https://github.com/fijijavis/wdio-json-reporter/ first

| WDIO Json Reporter | WDIO | | ------------------ | ---- | | ^3.0.0 | v7 |

Installation

  • NPM
npm install @wyh.michael/wdio-json-reporter --save-dev
  • Yarn
yarn add @wyh.michael/wdio-json-reporter --dev

Configuration

Results to STDOUT

reporters: [
  'dot',
  ['@wyh.michael/wdio-json-reporter',{ stdout: true }]
],

Results to File

reporters: [
  'dot',
  ['@wyh.michael/wdio-json-reporter',{
      outputDir: './Results'
  }]
],

Results to File with custom file name

reporters: [
  'dot',
  ['@wyh.michael/wdio-json-reporter',{
    outputDir: './Results',
    outputFileFormat: function(opts) {
        return `results-${opts.cid}.${opts.capabilities}.json`
    }
  }]
],

Result Files

Starting with WDIO v5, reporting has moved from a centralized process to one that is handled by each of the "sessions" spun up for parallel test execution. This change helped reduce the amount of chatter during WDIO test execution and thus improved performance. The downside is we are no longer able to get a single report for ALL test execution. Consider the following:

2 suites of tests configured to run in 2 browsers:

  • WDIO v4: 1 json file with execution results
  • WDIO v5: 4 json files with execution results

wdio-json-reporter provides a utility function to merge the multiple json files into a single file. Follow the steps below to take advantage of the utility.

  1. Create a small node script
const mergeResults = require('wdio-json-reporter/mergeResults')
mergeResults('./Results', 'wdio-json-*', 'wdio-custom-filename.json')

Note: wdio-custom-filename.json is optional, if the parameter is not provided the default value is wdio-merged.json

  1. Call node script from command line and pass 2 arguments
  • <RESULTS_DIR>: Directory where results files are written
  • <FILE_REGEX>: Regex pattern for finding wdio-json-reporter result files in <RESULTS_DIR>. This is necessary because multiple reporters produce json result files

Example:

node mergeResults.json ./Results "wdio-json-*"
  1. As part of a wdio hook
// Located in your wdio.conf.js file
onComplete: function (exitCode, config, capabilities, results) {
  const mergeResults = require('wdio-json-reporter/mergeResults')
  mergeResults('./Results', 'results-*', 'wdio-custom-filename.json')
}

Upon completion, the merge script will output a single json file named wdio-merged.json in the provided <RESULTS_DIR>

Configuration

Standard

Following code shows the default wdio test runner configuration. Just add 'json' as reporter to the array. To get some output during the test you can run the WDIO Dot Reporter and the WDIO JSON Reporter at the same time:

// wdio.conf.js
module.exports = {
  // ...
  reporters: ['dot', '@wyh.michael/wdio-json-reporter'],
  reporterOptions: {
    outputDir: './Results'
  },
  // ...
};

Single Results File

// wdio.conf.js
module.exports = {
  // ...
  reporters: ['dot', '@wyh.michael/wdio-json-reporter'],
  reporterOptions: {
    outputDir: './',
    combined: true
  },
  // ...
};

Custom File Name

// wdio.conf.js
module.exports = {
  // ...
  reporters: ['dot', '@wyh.michael/wdio-json-reporter'],
  reporterOptions: {
    outputDir: './',
    filename: 'wdio-results'
  },
  // ...
};

STDOUT

// wdio.conf.js
module.exports = {
  // ...
  reporters: ['@wyh.michael/wdio-json-reporter'],
  reporterOptions: {
    useStdout: true
  },
  // ...
};

If you do not want to print out the mocha epilogue (i.e. 1 passing (5.2s)), you can suppress it:

// wdio.conf.js
module.exports = {
  // ...
  reporters: ['@wyh.michael/wdio-json-reporter'],
  reporterOptions: {
    suppressEpilogue: true
  },
  // ...
};

For more information on WebdriverIO see the homepage.