@storybook/addon-jest
Advanced tools
Comparing version 3.3.13 to 3.3.14
@@ -70,7 +70,9 @@ 'use strict'; | ||
), | ||
trace.join('').trim().split(/\n/).map(function (i) { | ||
trace.join('').trim().split(/\n/) | ||
// eslint-disable-next-line react/no-array-index-key | ||
.map(function (traceLine, traceLineIndex) { | ||
return _react2.default.createElement( | ||
'div', | ||
null, | ||
i.trim() | ||
{ key: traceLineIndex }, | ||
traceLine.trim() | ||
); | ||
@@ -138,2 +140,7 @@ }) | ||
} | ||
if (!('grouperIndex' in acc)) { | ||
acc.grouperIndex = 0; | ||
} else { | ||
acc.grouperIndex += 1; | ||
} | ||
@@ -159,2 +166,9 @@ // start or stop extraction | ||
if (i === list.length - 1) { | ||
// Provide a "safety net" when Jest returns a partially recognized "group" | ||
// (recognized by acc.startTrigger but acc.endTrigger was never found) and | ||
// it's the only group in output for a test result. In that case, acc.list | ||
// will be empty, so return whatever was found, even if it will be unstyled | ||
// and prevent next createSubgroup calls from throwing due to empty lists. | ||
acc.list.push(null); | ||
return acc.list.reduce(function (eacc, el, ei) { | ||
@@ -165,3 +179,3 @@ switch (true) { | ||
// at index 0, inject before | ||
return eacc.concat(acc.grouper(acc.grouped)).concat(el); | ||
return eacc.concat(acc.grouper(acc.grouped, acc.grouperIndex)).concat(el); | ||
} | ||
@@ -171,3 +185,3 @@ case acc.injectionPoint > 0 && acc.injectionPoint === ei + 1: | ||
// at index > 0, and next index WOULD BE injectionPoint, inject after | ||
return eacc.concat(el).concat(acc.grouper(acc.grouped)); | ||
return eacc.concat(el).concat(acc.grouper(acc.grouped, acc.grouperIndex)); | ||
} | ||
@@ -223,4 +237,4 @@ default: | ||
}, | ||
grouper: function grouper(list) { | ||
return _react2.default.createElement(Main, { msg: list }); | ||
grouper: function grouper(list, key) { | ||
return _react2.default.createElement(Main, { key: key, msg: list }); | ||
} | ||
@@ -238,4 +252,4 @@ }).reduce(function (acc, it) { | ||
}, | ||
grouper: function grouper(list) { | ||
return _react2.default.createElement(Sub, { msg: list }); | ||
grouper: function grouper(list, key) { | ||
return _react2.default.createElement(Sub, { key: key, msg: list }); | ||
} | ||
@@ -249,4 +263,4 @@ }).reduce(createSubgroup, { | ||
}, | ||
grouper: function grouper(list) { | ||
return _react2.default.createElement(StackTrace, { trace: list }); | ||
grouper: function grouper(list, key) { | ||
return _react2.default.createElement(StackTrace, { key: key, trace: list }); | ||
} | ||
@@ -253,0 +267,0 @@ }); |
{ | ||
"name": "@storybook/addon-jest", | ||
"version": "3.3.13", | ||
"version": "3.3.14", | ||
"description": "React storybook addon that show component jest report", | ||
@@ -28,3 +28,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@storybook/components": "^3.3.13", | ||
"@storybook/components": "^3.3.14", | ||
"glamor": "^2.20.40", | ||
@@ -31,0 +31,0 @@ "glamorous": "^4.11.2", |
@@ -38,3 +38,4 @@ import React from 'react'; | ||
.split(/\n/) | ||
.map(i => <div>{i.trim()}</div>)} | ||
// eslint-disable-next-line react/no-array-index-key | ||
.map((traceLine, traceLineIndex) => <div key={traceLineIndex}>{traceLine.trim()}</div>)} | ||
</details> | ||
@@ -84,2 +85,7 @@ ))({ | ||
} | ||
if (!('grouperIndex' in acc)) { | ||
acc.grouperIndex = 0; | ||
} else { | ||
acc.grouperIndex += 1; | ||
} | ||
@@ -105,2 +111,9 @@ // start or stop extraction | ||
if (i === list.length - 1) { | ||
// Provide a "safety net" when Jest returns a partially recognized "group" | ||
// (recognized by acc.startTrigger but acc.endTrigger was never found) and | ||
// it's the only group in output for a test result. In that case, acc.list | ||
// will be empty, so return whatever was found, even if it will be unstyled | ||
// and prevent next createSubgroup calls from throwing due to empty lists. | ||
acc.list.push(null); | ||
return acc.list.reduce((eacc, el, ei) => { | ||
@@ -110,7 +123,7 @@ switch (true) { | ||
// at index 0, inject before | ||
return eacc.concat(acc.grouper(acc.grouped)).concat(el); | ||
return eacc.concat(acc.grouper(acc.grouped, acc.grouperIndex)).concat(el); | ||
} | ||
case acc.injectionPoint > 0 && acc.injectionPoint === ei + 1: { | ||
// at index > 0, and next index WOULD BE injectionPoint, inject after | ||
return eacc.concat(el).concat(acc.grouper(acc.grouped)); | ||
return eacc.concat(el).concat(acc.grouper(acc.grouped, acc.grouperIndex)); | ||
} | ||
@@ -138,5 +151,5 @@ default: { | ||
? item | ||
.split(/\[32m(.*?)\[39m/) | ||
// eslint-disable-next-line react/no-array-index-key | ||
.map((i, index) => (index % 2 ? <Positive key={`p_${li}_${i}`}>{i}</Positive> : i)) | ||
.split(/\[32m(.*?)\[39m/) | ||
// eslint-disable-next-line react/no-array-index-key | ||
.map((i, index) => (index % 2 ? <Positive key={`p_${li}_${i}`}>{i}</Positive> : i)) | ||
: item | ||
@@ -149,5 +162,5 @@ ) | ||
? item | ||
.split(/\[31m(.*?)\[39m/) | ||
// eslint-disable-next-line react/no-array-index-key | ||
.map((i, index) => (index % 2 ? <Negative key={`n_${li}_${i}`}>{i}</Negative> : i)) | ||
.split(/\[31m(.*?)\[39m/) | ||
// eslint-disable-next-line react/no-array-index-key | ||
.map((i, index) => (index % 2 ? <Negative key={`n_${li}_${i}`}>{i}</Negative> : i)) | ||
: item | ||
@@ -159,3 +172,3 @@ ) | ||
endTrigger: e => typeof e === 'string' && e.match('Expected '), | ||
grouper: list => <Main msg={list} />, | ||
grouper: (list, key) => <Main key={key} msg={list} />, | ||
}) | ||
@@ -171,3 +184,3 @@ .reduce( | ||
endTrigger: e => typeof e === 'string' && e.match(/^at/), | ||
grouper: list => <Sub msg={list} />, | ||
grouper: (list, key) => <Sub key={key} msg={list} />, | ||
}) | ||
@@ -177,3 +190,3 @@ .reduce(createSubgroup, { | ||
endTrigger: () => false, | ||
grouper: list => <StackTrace trace={list} />, | ||
grouper: (list, key) => <StackTrace key={key} trace={list} />, | ||
}); | ||
@@ -180,0 +193,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5234965
1983