mocha-annotated
Advanced tools
Comparing version
@@ -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) |
@@ -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. |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
21459
7.32%419
0.24%179
18.54%0
-100%