Socket
Book a DemoInstallSign in
Socket

mocha-annotated

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mocha-annotated - npm Package Compare versions

Comparing version

to
0.5.1

10

CHANGELOG.md

@@ -5,2 +5,12 @@ # Change Log

<a name="0.5.1"></a>
## [0.5.1](https://github.com/nwronski/mocha-annotated/compare/v0.5.0...v0.5.1) (2018-12-07)
### Bug Fixes
* **ui:** remove feedback from non-annotated tests ([#5](https://github.com/nwronski/mocha-annotated/issues/5)) ([f204d4b](https://github.com/nwronski/mocha-annotated/commit/f204d4b))
<a name="0.5.0"></a>

@@ -7,0 +17,0 @@ # [0.5.0](https://github.com/nwronski/mocha-annotated/compare/v0.4.0...v0.5.0) (2018-12-06)

2

dist/helpers.js

@@ -39,3 +39,3 @@ "use strict";

result.err = errorJSON(test.err);
if (result.feedback == null) {
if (test.annotated && result.feedback == null) {
result.feedback = result.err.message;

@@ -42,0 +42,0 @@ }

@@ -23,2 +23,3 @@ 'use strict';

this.feedback = feedback;
this.annotated = true;
}

@@ -25,0 +26,0 @@

{
"name": "mocha-annotated",
"version": "0.5.0",
"version": "0.5.1",
"description": "Mocha but with tasks and feedback built into it!",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -151,1 +151,29 @@ # mocha-annotated

```
### Alternative Forms
While `it.annotated(title, taskNumber, feedback, fn)` works when a task number is known and the feedback is predetermined, there are alternative forms to support other situations:
* Use `it.annotated(title, feedback, fn)` when there is no task number associated with the test.
* Use `it.annotated(title, taskNumber, fn)` when there is no feedback associated with the test, **or** when feedback is included in a test assertion.
* Use `it.annotated(title, fn)` when there is no task number associated with the test and feedback is undefined or dynamic (as above).
Following is an example of the dynamic feedback situation:
```javascript
import { expect } from 'chai';
describe('Beep#add', () => {
it.annotated(
// Test title
'2 + 2 = 4',
// The test function containing the expectations/assertions
() => {
const result = Beep.add(2, 2);
expect(result).to.equal(4, `We expected 2 + 2 = 4, but instead it is ${result}.`);
},
);
});
```
Annotated tests without predetermined feedback will also use messages from errors thrown within the test.