Skip to content

Commit

Permalink
Merge branch 'master' into fix-actions-android
Browse files Browse the repository at this point in the history
  • Loading branch information
Hypnosphi authored Nov 29, 2017
2 parents f424f9d + bb86e68 commit b8c8852
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
15 changes: 10 additions & 5 deletions addons/jest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ Assuming that you have created a test files `MyComponent.test.js` and `MyOtherCo
In your `story.js`

```js
import jestTestResults from '../.jest-test-results.json';
import results from '../.jest-test-results.json';
import { withTests } from '@storybook/addon-jest';

storiesOf('MyComponent', module)
.addDecorator(withTests(jestTestResults, { filesExt: '.test.js' })('MyComponent', 'MyOtherComponent'))
.addDecorator(withTests({ results })('MyComponent', 'MyOtherComponent'))
.add('This story shows test results from MyComponent.test.js and MyOtherComponent.test.js', () => (
<div>Jest results in storybook</div>
));
Expand All @@ -90,11 +90,11 @@ storiesOf('MyComponent', module)
Or in order to avoid importing `.jest-test-results.json` in each story, you can create a simple file `withTests.js`:

```js
import jestTestResults from '../.jest-test-results.json';
import results from '../.jest-test-results.json';
import { withTests } from '@storybook/addon-jest';

export default withTests(jestTestResults, {
filesExt: '.test.js',
export default withTests({
results,
});
```

Expand All @@ -111,6 +111,11 @@ storiesOf('MyComponent', module)
));
```

### withTests(options)

- **options.results**: [OBJECT] jest output results. *mandatory*
- **filteExt**: [STRING] test file extention. *optionnal*. This allow you to write "MyComponent" and not "MyComponent.test.js". It will be used as regex to find your file results. Default value is `((\\.specs?)|(\\.tests?))?(\\.js)?$`. That mean it will match: MyComponent.js, MyComponent.test.js, MyComponent.tests.js, MyComponent.spec.js, MyComponent.specs.js...

## TODO

- [ ] Add coverage
Expand Down
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"bootstrap": "^3.3.7",
"gatsby": "^1.9.125",
"gatsby-link": "^1.6.29",
"gatsby": "^1.9.126",
"gatsby-link": "^1.6.30",
"gatsby-plugin-sharp": "^1.6.22",
"gatsby-remark-autolink-headers": "^1.4.9",
"gatsby-remark-copy-linked-files": "^1.5.22",
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/Docs/Container/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const getEditUrl = (selectedSectionId, selectedItemId) => {
const gitHubRepoUrl = 'https://github.com/storybooks/storybook';
const docPath = `${selectedSectionId}/${selectedItemId}`;

return `${gitHubRepoUrl}/tree/master/docs/pages/${docPath}/index.md`;
return `${gitHubRepoUrl}/blob/master/docs/src/pages/${docPath}/index.md`;
};

const Container = ({ sections, selectedItem, selectedSectionId, selectedItemId }) => (
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/Grid/Examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Examples = ({ items }) => (
<h1>Storybook Examples</h1>
<a
className="edit-link"
href="https://github.com/storybooks/storybook/edit/master/docs/pages/examples/_examples.yml"
href="https://github.com/storybooks/storybook/blob/master/docs/src/pages/examples/_examples.yml"
target="_blank"
rel="noopener noreferrer"
>
Expand Down
12 changes: 6 additions & 6 deletions docs/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4196,9 +4196,9 @@ gatsby-cli@^1.1.24:
yargs "^8.0.2"
yurnalist "^0.2.1"

gatsby-link@^1.6.29:
version "1.6.29"
resolved "https://registry.yarnpkg.com/gatsby-link/-/gatsby-link-1.6.29.tgz#a3ecedb8a1bd0f9430bda8f193375309ff2e9efa"
gatsby-link@^1.6.30:
version "1.6.30"
resolved "https://registry.yarnpkg.com/gatsby-link/-/gatsby-link-1.6.30.tgz#d75a7ceaa9e138b5f4f64cc6dbf1e0632876bd09"
dependencies:
babel-runtime "^6.26.0"
prop-types "^15.5.8"
Expand Down Expand Up @@ -4317,9 +4317,9 @@ gatsby-transformer-remark@^1.7.22:
unist-util-select "^1.5.0"
unist-util-visit "^1.1.1"

gatsby@^1.9.125:
version "1.9.125"
resolved "https://registry.yarnpkg.com/gatsby/-/gatsby-1.9.125.tgz#5674fab6f54c5a635edc8ba1ad6c57431e1ef14d"
gatsby@^1.9.126:
version "1.9.126"
resolved "https://registry.yarnpkg.com/gatsby/-/gatsby-1.9.126.tgz#879d9136b179500a7ca0f95b032d1763184e8594"
dependencies:
async "^2.1.2"
babel-code-frame "^6.22.0"
Expand Down

0 comments on commit b8c8852

Please sign in to comment.