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

Allow passing options to react-test-renderer .create() method #896

Closed
wants to merge 16 commits into from
Closed
Prev Previous commit
Next Next commit
Extract storyshots package dependency check into a separate function
  • Loading branch information
John Rodriguez authored and John Rodriguez committed May 18, 2017
commit f2fdbc7f6b2ee8701b0da04e8caff106bec402d1
16 changes: 8 additions & 8 deletions addons/storyshots/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ let configPath;

const babel = require('babel-core');

function hasDependency(pkg, dependency) {
return (pkg.devDependencies && pkg.devDependencies[dependency]) ||
(pkg.dependencies && pkg.dependencies[dependency]) ||
(pkg.name === dependency);
}

const pkg = readPkgUp.sync().pkg;
const isStorybook =
(pkg.devDependencies && pkg.devDependencies['@storybook/react']) ||
(pkg.dependencies && pkg.dependencies['@storybook/react']) ||
(pkg.name === 'storybook');

const isRNStorybook =
(pkg.devDependencies && pkg.devDependencies['@storybook/react-native']) ||
(pkg.dependencies && pkg.dependencies['@storybook/react-native']) ||
(pkg.name === '@storybook/react-native');
const isStorybook = hasDependency(pkg, '@storybook/react') || pkg.name === 'storybook';
const isRNStorybook = hasDependency(pkg, '@storybook/react-native');

export default function testStorySnapshots(options = {}) {
addons.setChannel(createChannel());
Expand Down