From 8cef3d5c03f7a63fcd73b7ad91fb88b5d073c875 Mon Sep 17 00:00:00 2001 From: Tom Coleman Date: Wed, 7 Jun 2017 10:53:10 +1000 Subject: [PATCH] Separate out testing the RN app and the rest. Although RN uses Jest for testing, it uses a Jest preset which messes with the environment. AFIACT it's not possible to selectively apply the environment to different tests so we just separate them. --- examples/react-native-vanilla/__tests__/storyshots.js | 5 ++++- jest.config.js | 1 + package.json | 5 +++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/examples/react-native-vanilla/__tests__/storyshots.js b/examples/react-native-vanilla/__tests__/storyshots.js index ebb0ea21c183..1e951743cfbe 100644 --- a/examples/react-native-vanilla/__tests__/storyshots.js +++ b/examples/react-native-vanilla/__tests__/storyshots.js @@ -1,4 +1,7 @@ import path from 'path'; import initStoryshots, { snapshotWithOptions } from '@storybook/addon-storyshots'; -initStoryshots(); +initStoryshots({ + framework: 'react-native', + configPath: path.join(__dirname, '..', 'storybook'), +}); diff --git a/jest.config.js b/jest.config.js index f7c3431947a8..18aed5696d06 100644 --- a/jest.config.js +++ b/jest.config.js @@ -7,6 +7,7 @@ module.exports = { '\\.(css|scss)$': '/__mocks__/styleMock.js', }, roots: ['/addons', '/app', '/lib', '/examples'], + testPathIgnorePatterns: ['/node_modules/', 'examples/react-native-vanilla'], collectCoverage: false, collectCoverageFrom: [ 'app/**/*.{js,jsx}', diff --git a/package.json b/package.json index 073cf471e8f8..3b81796664ff 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,9 @@ "lint:js": "eslint . --cache --cache-location=.cache/eslint --ext .js,.jsx,.json", "lint:md": "remark .", "publish": "lerna publish", - "test": "jest", - "test:watch": "npm test -- --watch" + "test": "jest && npm run test:react-native-vanilla", + "test:watch": "npm test -- --watch", + "test:react-native-vanilla": "cd examples/react-native-vanilla && jest" }, "devDependencies": { "babel-cli": "^6.24.1",