Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add addon jest #2295

Merged
merged 38 commits into from
Nov 23, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
f6df222
initial commit
renaudtertrais Nov 9, 2017
1db27cb
v0.0.1
renaudtertrais Nov 9, 2017
b1db164
Add new TODOS item + add know issue when deploying in README
renaudtertrais Nov 10, 2017
1433160
RENAME package & SYNC version with monorepo
ndelangen Nov 11, 2017
812c054
Merge branch 'master' into add-addon-jest
danielduan Nov 12, 2017
f1f869c
Remove eslint files and yarn.lock
renaudtertrais Nov 12, 2017
e66e375
Merge branch 'master' into add-addon-jest
ndelangen Nov 13, 2017
3af0b87
REMOVE dev setup on package && Linting
ndelangen Nov 13, 2017
f38a027
Linting
ndelangen Nov 13, 2017
37d3748
CHANGE jest config to exclude the example (failing) jest test for add…
ndelangen Nov 13, 2017
b4c0d31
lockfile
ndelangen Nov 14, 2017
758c195
Merge branch 'master' into add-addon-jest
ndelangen Nov 14, 2017
d004bd7
Merge branch 'master' into add-addon-jest
ndelangen Nov 14, 2017
3c8c783
FIX review comment
ndelangen Nov 14, 2017
1073760
Merge branch 'master' into add-addon-jest
danielduan Nov 14, 2017
d185d1a
Add addon-jest to examples/cra-kitchen-sink
renaudtertrais Nov 14, 2017
cc1eef2
Merge branch 'master' into add-addon-jest
ndelangen Nov 16, 2017
2d17ece
WIP
ndelangen Nov 16, 2017
b42538e
IMPROVE parsing of failureMessage
ndelangen Nov 17, 2017
e310ec2
IMPROVE styling & parsing of failureMessage
ndelangen Nov 18, 2017
3320ee3
Merge branch 'master' into add-addon-jest
Hypnosphi Nov 18, 2017
6648656
IMPROVE jest failureMessages
ndelangen Nov 18, 2017
663d5ae
Merge branch 'add-addon-jest' of github.com:storybooks/storybook into…
ndelangen Nov 18, 2017
ab0d84d
IMRPOVE styling
ndelangen Nov 18, 2017
d0d0494
Merge branch 'master' into add-addon-jest
Hypnosphi Nov 18, 2017
045bca1
REFACTOR to glamorous
ndelangen Nov 18, 2017
24b1982
no message
ndelangen Nov 18, 2017
1f2edf0
FIX links in readme
ndelangen Nov 19, 2017
6dbbb34
IMPROVE README
ndelangen Nov 19, 2017
793b76e
CLEANUP: remove unneeded component
ndelangen Nov 19, 2017
80bc824
IMPROVE readme
ndelangen Nov 21, 2017
d3ceba4
Merge branch 'master' into add-addon-jest
ndelangen Nov 21, 2017
59fff75
DELETE unneeded file
ndelangen Nov 21, 2017
7d95fae
Merge branch 'master' into add-addon-jest
ndelangen Nov 23, 2017
eb33a3e
CHANGE @storybook/addons to peerDependency && update versions
ndelangen Nov 23, 2017
7206c93
UPDATE snapshots
ndelangen Nov 23, 2017
9d83982
UPDATE snapshots
ndelangen Nov 23, 2017
70d3424
Merge branch 'master' into add-addon-jest
ndelangen Nov 23, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions addons/jest/.babelrc

This file was deleted.

31 changes: 7 additions & 24 deletions addons/jest/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@storybook/addon-jest",
"version": "3.2.14",
"version": "3.2.15",
"description": "React storybook addon that show component jest report",
"keywords": [
"addon",
Expand All @@ -15,33 +15,18 @@
"bugs": "https://github.com/storybooks/storybook",
"license": "MIT",
"author": "Renaud Tertrais <renaud.tertrais@gmail.com> (https://github.com/renaudtertrais)",
"files": [
"dist",
"styles.js",
"register.js"
],
"main": "dist/index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/storybooks/storybook"
},
"scripts": {
"prebuild": "npm run clear",
"build": "cross-env NODE_ENV=production babel -d ./dist ./src",
"prebuild:storybook": "npm run clean:storybook",
"build:storybook": "build-storybook -c example/.storybook -o build/",
"clean:storybook": "rm -rf build",
"clear": "rm -rf ./dist",
"predeploy": "npm run build:storybook",
"deploy": "gh-pages -d build",
"prepublish": "npm run build",
"storybook": "cross-env NODE_ENV=development start-storybook -p 3001 -c example/.storybook",
"test:example": "jest example --json --outputFile=example/.jest-test-results.json"
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@storybook/addons": "^3.2.15"
},
"dependencies": {},
"devDependencies": {
"@storybook/addon-options": "^3.2.14",
"@storybook/react": "^3.2.14",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-preset-env": "^1.6.1",
Expand All @@ -56,16 +41,14 @@
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.4.0",
"gh-pages": "^1.0.0",
"jest": "^21.2.1",
"react": "^16.1.0",
"react-dom": "^16.1.0",
"style-loader": "^0.19.0"
},
"peerDependencies": {
"@storybook/addons": "^3.2.14",
"prop-types": "^15.6.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be a simple dependency, not a peer one

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually meant the prop-types package. It's OK for an end user not to have it

"react": "^16.0.0",
"react-dom": "^16.0.0"
"react": "*",
"react-dom": "*"
}
}
2 changes: 1 addition & 1 deletion addons/jest/src/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ export default {
error: 'CRIMSON',
warning: 'DARKORANGE',
grey: 'LIGHTSLATEGRAY',
}
};
6 changes: 2 additions & 4 deletions addons/jest/src/components/TestsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ const TestsPanel = ({ tests }) => {
}}
>
{successNumber > 0 && (
<div style={{ color: colors.success }}>
{successNumber} passed
</div>
<div style={{ color: colors.success }}>{successNumber} passed</div>
)}
{failedNumber > 0 && (
<div style={{ marginLeft: 10, color: colors.error }}>{failedNumber} failed</div>
Expand Down Expand Up @@ -136,7 +134,7 @@ const TestsPanel = ({ tests }) => {
.replace(/\[22?m?/g, '')
.replace(/\[31m/g, `<strong style="color: ${colors.error}">`)
.replace(/\[32m/g, `<strong style="color: ${colors.success}">`)
.replace(/\[39m/g, `</strong>`),
.replace(/\[39m/g, '</strong>'),
}}
/>
))}
Expand Down
6 changes: 1 addition & 5 deletions addons/jest/src/withTests.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';
import PropTypes from 'prop-types';
import addons from '@storybook/addons';

const basename = path => path.split('/').slice(-1)[0];
Expand All @@ -18,7 +16,6 @@ const findTestResults = (testFiles, jestTestResults, jestTestFilesExt) =>
});

const withTests = (results, options) => (...testFiles) => {

const emitAddTests = ({ kind, story }) => {
addons.getChannel().emit('storybook/tests/add_tests', {
kind,
Expand All @@ -31,7 +28,6 @@ const withTests = (results, options) => (...testFiles) => {
emitAddTests({ kind, story });
return storyFn();
};
}
};

export default withTests;