Skip to content

qthibeault/mocha-notes-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mocha-notes-plugin

A plugin that allows you to save notes for each Test which are reported with the results at the end

Installation

npm install --save-dev mocha mocha-notes-plugin

This library is tested to work with Mocha 6.0.0

{
    "scripts": {
        "test": "node node_modules/mocha/bin/_mocha --require mocha-notes-plugin --reporter mocha-notes-plugin/lib/repoter.js"
    }
}

Example Usage

const { expect } = require('chai')

describe('Suite', function() {
    it('Should run a test', function() {
        this.test.note('foo', 'bar')
        this.test.note('answer', 42)

        expect(true).to.be.true
    })
})

How it Works

This module monkey-patches the Test class to expose a method called note. This method appends key value pairs to a private object calles notes. The custom reporter packaged with this plugin adapts the JSON reporter to display the notes in the output.

About

Plugin for Mocha test runner to store notes during tests

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published