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

Angular and Vue storyshots #2564

Merged
merged 75 commits into from
Jan 15, 2018
Merged
Changes from 1 commit
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
97c2b42
Initial dirty-half-working-POC of the storyshots for angular
igor-dv Dec 26, 2017
edb1cf6
Refactor storyshots index.js
igor-dv Dec 26, 2017
c208016
Refactor test-bodies
igor-dv Dec 26, 2017
e0bae92
Better copy-past from app/angular
igor-dv Dec 26, 2017
91f17b6
Remove things
igor-dv Dec 26, 2017
8f549fa
Merge remote-tracking branch 'origin/master' into angular-storyshots
igor-dv Dec 28, 2017
714b694
Merge remote-tracking branch 'origin/master' into angular-storyshots
igor-dv Dec 28, 2017
43a273b
Merge branch 'master' into angular-storyshots
igor-dv Dec 29, 2017
d9942cf
Fix indentation in package.json
igor-dv Dec 29, 2017
2c460e4
Extract more stories to separate files
igor-dv Dec 29, 2017
887182f
Support promises in storyshots
igor-dv Dec 29, 2017
9cffe0a
Allow loading html templates
igor-dv Dec 29, 2017
29e84bd
Update snapshots
igor-dv Dec 29, 2017
f9e83ca
Merge branch 'master' into angular-storyshots
igor-dv Dec 29, 2017
b09b631
Few cleanups
igor-dv Dec 29, 2017
3c782a6
Merge branch 'master' into angular-storyshots
igor-dv Jan 1, 2018
3802a8e
Merge branch 'master' into angular-storyshots
ndelangen Jan 1, 2018
3cbd772
Add vue storyshots fork
igor-dv Jan 1, 2018
db89374
Extract common config-loading logic to a separate module
igor-dv Jan 1, 2018
7193eee
Merge remote-tracking branch 'origin/angular-storyshots' into vue-sto…
igor-dv Jan 1, 2018
36daf9c
Use config-loader in vue/loader
igor-dv Jan 1, 2018
5ba2e9e
Use prepare script in storyshots
igor-dv Jan 3, 2018
84237fb
Angular + Jest + Storyshots = Crazy Shit. Move the `jest-preset-angul…
igor-dv Jan 3, 2018
4b612eb
Merge remote-tracking branch 'origin/angular-storyshots' into vue-sto…
igor-dv Jan 3, 2018
796deb5
Merge branch 'master' into angular-storyshots
igor-dv Jan 3, 2018
7fc4888
Define global.STORYBOOK_ENV to be 'vue' because there are addons that…
igor-dv Jan 3, 2018
08cbbc8
Move angular and react to regular reps
igor-dv Jan 3, 2018
51b91d8
Merge remote-tracking branch 'origin/angular-storyshots' into vue-sto…
igor-dv Jan 3, 2018
347bdc2
Add utils.test.js
igor-dv Jan 3, 2018
637a919
Fix indentation
igor-dv Jan 3, 2018
a0d4e10
Merge pull request #2614 from storybooks/vue-storyshots
ndelangen Jan 3, 2018
ea2db19
Wrap story with app.component like in the app/angular and set dynamic…
igor-dv Jan 3, 2018
a1fd3cf
typo and indentation
igor-dv Jan 3, 2018
6a5b3b8
Merge branch 'master' into angular-storyshots
igor-dv Jan 3, 2018
c35d48b
Update yarn.lock
igor-dv Jan 3, 2018
3bb8ab9
Move angular back to peer to check if cli tests are failing.
igor-dv Jan 3, 2018
45c7f24
Remove angular and vue deps from storyshots and suppress no-extraneou…
igor-dv Jan 3, 2018
ee1fad4
Remove react from deps as well and remove wildcard from react-test-re…
igor-dv Jan 3, 2018
a7a6324
Merge branch 'master' into angular-storyshots
igor-dv Jan 3, 2018
3aa07d0
Update yarn.lock
igor-dv Jan 3, 2018
279090c
Disable each specific import separately with ugly "eslint-disable-nex…
igor-dv Jan 3, 2018
7730d21
Merge remote-tracking branch 'origin/master' into angular-storyshots
igor-dv Jan 3, 2018
acfd41e
Disable with specific rule, so the imports will be even uglier
igor-dv Jan 3, 2018
23b85f0
Merge branch 'master' into angular-storyshots
igor-dv Jan 4, 2018
c4b7ecf
Merge branch 'master' into angular-storyshots
igor-dv Jan 4, 2018
6115fe1
Merge branch 'master' into angular-storyshots
igor-dv Jan 4, 2018
0b57690
Merge branch 'master' into angular-storyshots
igor-dv Jan 4, 2018
de37c4b
Merge branch 'master' into angular-storyshots
ndelangen Jan 4, 2018
08ec56b
Merge branch 'master' into angular-storyshots
igor-dv Jan 5, 2018
e304771
Add docs for angular and vue
igor-dv Jan 6, 2018
227aaf5
Merge branch 'master' into angular-storyshots
igor-dv Jan 6, 2018
8eee1c0
Now I need to update snapshots...
igor-dv Jan 6, 2018
2aac993
Merge remote-tracking branch 'origin/master' into angular-storyshots
igor-dv Jan 8, 2018
11687bd
After merge fixes
igor-dv Jan 8, 2018
b0f4064
Update snapshots
igor-dv Jan 8, 2018
ea9adf3
Merge branch 'master' into angular-storyshots
igor-dv Jan 8, 2018
c3b5aa7
Merge remote-tracking branch 'origin/master' into angular-storyshots
igor-dv Jan 10, 2018
805f73e
Update snapshots
igor-dv Jan 10, 2018
2e30203
Merge remote-tracking branch 'origin/master' into angular-storyshots
igor-dv Jan 10, 2018
a5eb21c
Update storyshots to use helpers with templates support
igor-dv Jan 10, 2018
9ba4b74
Generalize api. import react-test-renderer only in react loader
igor-dv Jan 10, 2018
64506b4
Remove jest-preset-angular and react-test-renderer from deps.
igor-dv Jan 10, 2018
cb3029e
Merge branch 'master' into angular-storyshots
igor-dv Jan 10, 2018
2ca902a
Merge branch 'master' into angular-storyshots
igor-dv Jan 11, 2018
c2ced8d
Update README
igor-dv Jan 11, 2018
9091f4a
Add deps issue description to README
igor-dv Jan 11, 2018
d17f61b
Fix docs
igor-dv Jan 11, 2018
f68a410
Merge remote-tracking branch 'origin/master' into angular-storyshots
igor-dv Jan 11, 2018
d5b30aa
Merge remote-tracking branch 'origin/master' into angular-storyshots
igor-dv Jan 12, 2018
5fcf200
Merge remote-tracking branch 'origin/master' into angular-storyshots
igor-dv Jan 14, 2018
878aa75
Merge branch 'master' into angular-storyshots
igor-dv Jan 14, 2018
53b9a3a
Fix image snapshot to err on RN
igor-dv Jan 14, 2018
89af8fe
Merge branch 'master' into angular-storyshots
igor-dv Jan 15, 2018
db75151
Merge branch 'master' into angular-storyshots
igor-dv Jan 15, 2018
760d3c7
Merge remote-tracking branch 'origin/master' into angular-storyshots
igor-dv Jan 15, 2018
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
32 changes: 29 additions & 3 deletions addons/storyshots/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,19 @@ Usually, you might already have completed this step. If not, here are some resou

### Configure Jest for React
StoryShots addon for React is dependent on [react-test-renderer](https://github.com/facebook/react/tree/master/packages/react-test-renderer), but
doesn't install it, so you need yo install it separately.
doesn't install it, so you need to install it separately (read [here](#deps-issue) why).
Copy link
Member

@Hypnosphi Hypnosphi Jan 11, 2018

Choose a reason for hiding this comment

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

It's a super-nit, but I prefer when a sentence keeps making sense if you replace links with their text, that's why I don't really like links with "here" text.

Can we just make "doesn't" a link?


```sh
npm install --save-dev react-test-renderer
```

### Configure Jest for Angular
StoryShots addon for Angular is dependent on [jest-preset-angular](https://github.com/thymikee/jest-preset-angular), but
doesn't install it, so you need yo install it separately.
doesn't install it, so you need to install it separately (read [here](#deps-issue) why).

```sh
npm install --save-dev jest-preset-angular
```

If you already use Jest for testing your angular app - probably you already have the needed jest configuration.
Anyway you can add these lines to your jest config:
Expand All @@ -62,7 +70,11 @@ module.exports = {
```
### Configure Jest for Vue
StoryShots addon for Vue is dependent on [jest-vue-preprocessor](https://github.com/vire/jest-vue-preprocessor), but
doesn't install it, so you need yo install it separately.
doesn't install it, so you need yo install it separately (read [here](#deps-issue) why).

```sh
npm install --save-dev jest-vue-preprocessor
```

If you already use Jest for testing your vue app - probably you already have the needed jest configuration.
Anyway you can add these lines to your jest config:
Expand All @@ -75,6 +87,20 @@ module.exports = {
moduleFileExtensions: ['vue', 'js', 'jsx', 'json', 'node'],
};
```

### <a name="deps-issue"></a>Why don't we install dependencies of each framework ?
Storyshots addon is currently supporting React, Angular and Vue. Each framework needs its own packages to be integrated with Jest. We don't want people that use only React will need to bring other dependencies that do not make sense for them.

`dependancies` - will installed an exact version of the particular dep - Storyshots can work with different versions of the same framework (let's say React v16 and React v15), that have to be compatible with a version of its plugin (react-test-renderer).
Copy link
Member

Choose a reason for hiding this comment

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

dependancies — typo


`optionalDependencies` - behaves like a regular dependency, but do not fail the installation in case there is a problem to bring the dep.

`peerDependancies` - listing all the deps in peer will trigger warnings during the installation - we don't want users to install unneeded deps by hand.

`optionalPeerDependancies` - unfortunately there is nothing like this =(

For more information read npm [docs](https://docs.npmjs.com/files/package.json#dependencies)

## Configure Storyshots

Create a new test file with the name `Storyshots.test.js`. (Or whatever the name you prefer, as long as it matches Jest's config [`testMatch`](http://facebook.github.io/jest/docs/en/configuration.html#testmatch-array-string)).
Expand Down