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

yachr

v0.1.12

Published

Yet another cucumber html reporter

Downloads

98

Readme

YACHR

Build Status Coverage Status PRs Welcome

Note: This library is under development, there are several features outstanding.

Feel free to use it or trial it, pull requests and issues are welcome, and will be addressed as time allows.


Yet another cucumber html reporter is a simple html reporter that runs off the standard json file produced by cucumberjs.

This reporter targets cucumberjs 3.

How to use

Install yachr either as a global or dev dependency to your project:

npm install yachr --global

To run yachr stand alone, create a js file (eg runReport.js) with the following contents:

var yachr = require("yachr");
var reporter = new yachr.Reporter();

reporter.generate({
  jsonFile: 'e2e-reports/results.json', // Location of the output from running cucumberjs
  output: 'e2e-reports/yachr.html'
});

Then execute it with node:

node ./runReport.js

This script can then be used through your projects npm scripts:

{
  "scripts": [
    ...,
    "cucumber": "...",
    "postCucumber": "node ./runReport"
    ...
  ]
}

Or if you're using it with a library like protractor, it can be included in the tear down script directly:

In protractor.conf.js

exports.config = {
  ...,
  onCleanUp: () => {
    var yachr = require("yachr");
    var reporter = new yachr.Reporter();

    reporter.generate({
      jsonFile: 'e2e-reports/results.json', // Location of the output from running cucumberjs
      output: 'e2e-reports/yachr.html'
    });
  }
  ...
}

Sample Output

Sample Image of Report

Custom Templates

yachr makes use of handlebarsjs for its templating. If there is a particular look you are going for, you can include a custom html file in your repo, and pass it in as a parameter.

Feel free to contribute it back to the project if you think the community could benefit from it. :wink:

A good place to start is looking at the default template

The data model supplied to the template can be seen starting here

Contribute

Clone the repo Run npm install

Hack away.

sampleUsageFile.ts gets transpiled into the dist folder when npm build is run, this is useful for checking how it runs with node:

From the root: node dist/src/sampleUsageFile.js

Should produced dist/samples/report.html

Testing out changes to the html template

When making changes to the template its good to see those changes applied as you go.

One option to do this if you're using the templating system, is to get the unit tests to run as you make changes.

As a starting point, the 'should generate a report' test in the reporter.spec.ts will generate a basic looking report.

This can be run on its own by updating the test's it to use the only function:

it.only('should generate a report', () => {

Don't commit this line though!

One last step is to comment out the code that cleans up the test and removes the generated html. This should be the last line of the test, and has a helpful comment to point it out for you.

CI

yachr is monitored by Travis-ci. when a change is detected Travis-ci will pull the repo and execute npm run ci. Travis will run ci before accepting a pull request.

Pre-commit hooks

To keep the build tags aligned to each branch, we're using this pre-commit setup in git. When the readme is committed, the tag will be updated to reflect the current branch.

The commit hooks for this repo can be found under the .githooks folder. A setup.sh script is provided for ease of setting up local developer environments to use these commit hooks.

As new commit hooks are added, the setup.sh script should be maintained to ensure that all hooks can be loaded as part of the onboarding process.

The pre-commit hook is configured to auto-load the current version of the pre-commit.py python script. This will ensure that any changes made to the pre-commit script are synchronised with the developer's environment.

It should be noted that because the pre-commit hook uses a python script, python needs to be installed and accessible from the developer's PATH environment variable.