Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mochawesome

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mochawesome - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

27

lib/mochawesome.js

@@ -13,3 +13,2 @@ /*jshint loopfunc: true */

var Base = mocha.reporters.Base,
utils = mocha.utils,
generateReport = reportGen.generateReport,

@@ -241,3 +240,3 @@ saveToFile = reportGen.saveToFile;

if(test.fn){
code = utils.clean(test.fn.toString());
code = cleanCode(test.fn.toString());
code = Highlight.highlightAuto(code, ['javascript']).value;

@@ -269,2 +268,22 @@ }

/**
* Strip the function definition from `str`,
* and re-indent for pre whitespace.
*/
function cleanCode (str) {
str = str
.replace(/\r\n?|[\n\u2028\u2029]/g, '\n').replace(/^\uFEFF/, '')
.replace(/^function *\(.*\) *{|\(.*\) *=> *{?/, '')
.replace(/\s+\}$/, '');
var spaces = str.match(/^\n?( *)/)[1].length,
tabs = str.match(/^\n?(\t*)/)[1].length,
re = new RegExp('^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs ? tabs : spaces) + '}', 'gm');
str = str.replace(re, '');
str = str.replace(/^\s+|\s+$/g, '');
return str;
}
/**
* Remove all properties from an object except

@@ -278,3 +297,3 @@ * those that are in the propsToKeep array.

function removeAllPropsFromObjExcept(obj, propsToKeep) {
function removeAllPropsFromObjExcept (obj, propsToKeep) {
_.forOwn(obj, function(val, prop) {

@@ -294,3 +313,3 @@ if (propsToKeep.indexOf(prop) === -1) {

function _getPercentClass(pct) {
function _getPercentClass (pct) {
if (pct <= 50) {

@@ -297,0 +316,0 @@ return 'danger';

4

package.json
{
"name": "mochawesome",
"version": "1.0.4",
"version": "1.0.5",
"description": "A Gorgeous HTML/CSS Reporter for Mocha.js",

@@ -28,3 +28,3 @@ "scripts": {

"lodash": "^3.1.0",
"mocha": "^2.1.0",
"mocha": "*",
"moment": "^2.9.0",

@@ -31,0 +31,0 @@ "ncp": "^1.0.1",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc