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

mocha-allure-reporter

v1.4.0

Published

Mocha reporter for Allure framework

Downloads

131,811

Readme

mocha-allure-reporter Build Status

Allure reporter for Mocha

Installation

Assuming that you have mocha installed, install reporter via npm:

npm install mocha-allure-reporter

Then use it as any other mocha reporter:

mocha --reporter mocha-allure-reporter

After running tests you will get raw tests result into allure-results directory. See generator list on how to make a report from raw results.

Also check out mocha-allure-example to see it in action.

Supported options

  • targetDir (string) – directory where test results will be stored

Runtime API

Allure is a test framework which provides more data from tests than usual. Once added mocha-allure-reporter will create global allure object with the following API:

  • allure.createStep(name, stepFn) – define step function. Result of each call of this function will be recorded into report.
  • allure.createAttachement(name, content, [type]) – save attachment to test. If you're calling this inside step function or during its execution (e.g. asynchronously via promises), attachment will be saved to step function.
    • name (String) - attachment name. Note that it is not then name of the file, actual filename will be generated.
    • content (Buffer|String|Function) – attachment content. If you pass Buffer or String, it will be saved to file immediately. If you are passing Function, you will get decorated function and you can call it several times to trigger attachment. General purpose of the second case is an ability to create utility function to take screenshot. You can define function for you test framework only once and then call it each time you need a screenshot.
    • type (String, optional) – attachment MIME-type. If you omit this argument we'll try to detect type automatically via file-type library
  • allure.description(description) – set detailed test description, if test name is not enough.
  • allure.severity(severity) – set test severity, one of: blocker, critical, normal, minor, trivial. You can also use constants like allure.SEVERITY.BLOKER.
  • allure.feature(featureName) – assign feature to test
  • allure.story(storyName) – assign user story to test. See documentation for details
  • allure.addArgument(name, value) - provide parameters, which had been used in test. Unlike other languages, javascript test methods usually doesn't have special arguments (only callbacks), so developers use other way to populate parameters to test. This method is to provide them to Allure
  • allure.addEnvironment(name, value) - save environment value. It is similar to addArgument method, but it is designed to store more verbose data, like HTTP-links to test page or used package version.