elderfo / react-native-storybook-loader

An automatic story loader for react-native-storybooks
https://github.com/elderfo/react-native-storybook-loader
MIT License
299 stars 27 forks source link

Supports ios|android platforms specific files #66

Closed betoharres closed 5 years ago

betoharres commented 5 years ago

This PR is not meant to be merged, it's more to show a missing feature I had to code to my own need: being able to create platform specific stories, like: Home.stories.ios.js and Home.stories.android.js or just Home.stories.js if I don't need to specify platform.

I had problems running jest right after cloning the project, just by running yarn test I had 2 failing tests about not being able to find snapshot file and another one about not being able to find a directory that was suppose to be generated randomly inside the test.

Here's the output if anyone can help:

~/code/react-native-storybook-loader $ yarn test                                                                                  B1  master
yarn run v1.16.0
$ jest
 FAIL  src/utils/pathHelper.test.js
  ● ensureFileDirectoryExists() › should create directory when it does not exist

    ENOENT, no such file or directory '/Users/me/code/react-native-storybook-loader/input'

      at Binding.<anonymous> (node_modules/mock-fs/lib/binding.js:1086:13)
      at maybeCallback (node_modules/mock-fs/lib/binding.js:42:17)
      at Binding.Object.<anonymous>.Binding.access (node_modules/mock-fs/lib/binding.js:1083:3)
      at Object.existsSync (fs.js:222:11)
      at Object.<anonymous> (src/utils/pathHelper.test.js:173:15)
          at new Promise (<anonymous>)
      at node_modules/p-map/index.js:46:16
      at processTicksAndRejections (internal/process/task_queues.js:89:5)

 FAIL  src/writer/index.test.js
  ● writeFile generate story loader

    ENOENT, no such file or directory '/Users/me/code/react-native-storybook-loader/src/writer/__snapshots__/index.test.js.snap'

      at Object.<anonymous> (src/writer/index.test.js:35:20)
          at new Promise (<anonymous>)
      at node_modules/p-map/index.js:46:16

  ● writeFile should generate dummy story loader if no stories were found

    ENOENT, no such file or directory '/Users/me/code/react-native-storybook-loader/src/writer/__snapshots__/index.test.js.snap'

      at Object.<anonymous> (src/writer/index.test.js:44:20)
          at new Promise (<anonymous>)
      at node_modules/p-map/index.js:46:16
codecov[bot] commented 5 years ago

Codecov Report

Merging #66 into master will increase coverage by 0.05%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #66      +/-   ##
==========================================
+ Coverage   91.02%   91.08%   +0.05%     
==========================================
  Files          10       10              
  Lines         156      157       +1     
  Branches       24       24              
==========================================
+ Hits          142      143       +1     
  Misses         13       13              
  Partials        1        1
Impacted Files Coverage Δ
src/writer/index.js 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 206d632...a8c5c02. Read the comment docs.

codecov[bot] commented 5 years ago

Codecov Report

Merging #66 into master will increase coverage by 0.05%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #66      +/-   ##
==========================================
+ Coverage   91.02%   91.08%   +0.05%     
==========================================
  Files          10       10              
  Lines         156      157       +1     
  Branches       24       24              
==========================================
+ Hits          142      143       +1     
  Misses         13       13              
  Partials        1        1
Impacted Files Coverage Δ
src/writer/index.js 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 206d632...a8c5c02. Read the comment docs.