Skip to content

Commit

Permalink
Merge pull request #1215 from storybooks/fix-coverage
Browse files Browse the repository at this point in the history
FIX coverage by using jest projects over multiple npm scripts
  • Loading branch information
ndelangen authored Jun 8, 2017
2 parents 468515b + 6f5feb1 commit 2fe179b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
6 changes: 6 additions & 0 deletions examples/react-native-vanilla/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
preset: 'react-native',
globals: {
__DEV__: true,
},
};
3 changes: 0 additions & 3 deletions examples/react-native-vanilla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,5 @@
"@storybook/react-native": "file:../../app/react-native",
"@storybook/ui": "file:../../lib/ui",
"react-dom": "^15.5.4"
},
"jest": {
"preset": "react-native"
}
}
8 changes: 4 additions & 4 deletions examples/react-native-vanilla/storybook/stories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ storiesOf('Welcome', module).add('to Storybook', () => <Welcome showApp={linkTo(

storiesOf('Button', module)
.addDecorator(getStory => <CenterView>{getStory()}</CenterView>)
.add('with text', () => (
.add('with text', () =>
<Button onPress={action('clicked-text')}>
<Text>Hello Button</Text>
</Button>
))
.add('with some emoji', () => (
)
.add('with some emoji', () =>
<Button onPress={action('clicked-emoji')}>
<Text>😀 😎 👍 💯</Text>
</Button>
));
);
11 changes: 9 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@ module.exports = {
'<rootDir>/__mocks__/fileMock.js',
'\\.(css|scss)$': '<rootDir>/__mocks__/styleMock.js',
},
roots: ['<rootDir>/addons', '<rootDir>/app', '<rootDir>/lib', '<rootDir>/examples'],
testPathIgnorePatterns: ['/node_modules/', 'examples/react-native-vanilla'],
roots: [
'<rootDir>/addons',
'<rootDir>/app',
'<rootDir>/lib',
'<rootDir>/examples/cra-storybook',
'<rootDir>/examples/test-cra',
],
testPathIgnorePatterns: ['/node_modules/'],
projects: ['./', './examples/react-native-vanilla'],
collectCoverage: false,
collectCoverageFrom: [
'app/**/*.{js,jsx}',
Expand Down
6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@
"lint:js": "eslint . --cache --cache-location=.cache/eslint --ext .js,.jsx,.json",
"lint:md": "remark .",
"publish": "lerna publish",
"test": "npm run test:libs && npm run test:apps",
"test:apps": "npm run test:react-native-vanilla",
"test:libs": "jest",
"test:watch": "npm run test:libs -- --watch",
"test:react-native-vanilla": "cd examples/react-native-vanilla && jest"
"test": "jest --projects ./ ./examples/react-native-vanilla"
},
"devDependencies": {
"babel-cli": "^6.24.1",
Expand Down

0 comments on commit 2fe179b

Please sign in to comment.