This commit is contained in:
Norbert de Langen 2018-08-08 12:45:26 +02:00
parent 5133d41f16
commit 7aa23d42f2
No known key found for this signature in database
GPG Key ID: 976651DA156C2825
3 changed files with 8 additions and 6 deletions

View File

@ -31,6 +31,7 @@
"global": "^4.3.2",
"prop-types": "^15.6.2",
"react-emotion": "^9.2.6",
"upath": "^1.0.4",
"util-deprecate": "^1.0.2"
},
"peerDependencies": {

View File

@ -1,17 +1,18 @@
import addons from '@storybook/addons';
import deprecate from 'util-deprecate';
import { normalize } from 'upath';
const findTestResults = (testFiles, jestTestResults, jestTestFilesExt) =>
const findTestResults = (testFiles, jestTestResults, jestTestFilesOptions) =>
Object.values(testFiles).map(name => {
const fileName = `${name}${jestTestFilesOptions.filesExt}`;
if (jestTestResults && jestTestResults.testResults) {
return {
fileName,
name,
result: jestTestResults.testResults.find(t =>
new RegExp(`${name}${jestTestFilesExt}`).test(t.name)
),
result: jestTestResults.testResults.find(t => normalize(t.name).includes(fileName)),
};
}
return { name };
return { fileName, name };
});
const emitAddTests = ({ kind, story, testFiles, options }) => {

View File

@ -7,7 +7,7 @@ import Panel from './components/Panel';
addons.register('storybook/tests', api => {
const channel = addons.getChannel();
addons.addPanel('storybook/tests/panel', {
title: <PanelTitle channel={addons.getChannel()} api={api} />,
title: <PanelTitle channel={channel} api={api} />,
// eslint-disable-next-line react/prop-types
render: ({ active }) => <Panel channel={channel} api={api} active={active} />,
});