Skip to content

Switch to Yarn workspaces #507

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

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ jobs:
- attach_workspace:
at: ~/react-native-testing-library
- run: |
cd packages/react-native-testing-library
Copy link
Member

Choose a reason for hiding this comment

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

linting and type checks should go from the root, please remove and adjust configuration if needed

yarn lint
yarn flow-check
typescript:
<<: *defaults
steps:
- attach_workspace:
at: ~/react-native-testing-library
- run: |
yarn typescript-check
- run: cd packages/react-native-testing-library && yarn typescript-check
tests:
<<: *defaults
steps:
- attach_workspace:
at: ~/react-native-testing-library
- run: yarn test
- run: cd packages/react-native-testing-library && yarn test
- store_artifacts:
path: coverage
destination: coverage
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ build
# Ignore lock files in examples for now
examples/**/yarn.lock
.docusaurus

.expo
4 changes: 2 additions & 2 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// added for Jest inline snapshots to not use default Prettier config
module.exports = {
singleQuote: true,
trailingComma: "es5"
}
trailingComma: 'es5',
};
7 changes: 5 additions & 2 deletions examples/reactnavigation/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
module.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
};
};
8 changes: 8 additions & 0 deletions examples/reactnavigation/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import registerRootComponent from 'expo/build/launch/registerRootComponent';

import App from './src/App';

// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
// It also ensures that whether you load the app in the Expo client or in a native build,
// the environment is set up appropriately
registerRootComponent(App);
7 changes: 0 additions & 7 deletions examples/reactnavigation/jest.config.js

This file was deleted.

49 changes: 32 additions & 17 deletions examples/reactnavigation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,44 @@
"name": "react-navigation-example",
"description": "Testing React Navigation with RNTL",
"version": "0.0.1",
"private": true,
"private": false,
"main": "./index.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"eject": "expo eject",
"test": "jest"
},
"dependencies": {
"@react-native-community/masked-view": "^0.1.9",
"@react-navigation/native": "^5.1.6",
"@react-navigation/stack": "^5.2.13",
"prop-types": "^15.7.2",
"react": "^16.13.1",
"react-native": "^0.62.2",
"react-native-gesture-handler": "^1.6.1",
"react-native-reanimated": "^1.8.0",
"react-native-safe-area-context": "^0.7.3",
"react-native-screens": "^2.5.0"
"@react-native-community/masked-view": "^0.1.10",
"@react-navigation/native": "^5.7.3",
"@react-navigation/stack": "^5.9.0",
"expo": "~38.0.8",
"expo-status-bar": "^1.0.2",
"react": "*",
"react-native": "*",
"react-native-gesture-handler": "^1.7.0",
"react-native-reanimated": "^1.13.0",
"react-native-safe-area-context": "^3.1.4",
"react-native-screens": "^2.10.1"
},
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/core": "^7.8.6",
"@babel/runtime": "^7.9.2",
"babel-jest": "^25.4.0",
"jest": "^25.4.0",
"metro-react-native-babel-preset": "^0.59.0",
"@testing-library/react-native": "^7.0.0-rc.0",
"react-test-renderer": "^16.13.1"
"@testing-library/react-native": "*",
"babel-jest": "*",
"babel-preset-expo": "~8.1.0",
"jest": "*",
"react-test-renderer": "*"
},
"jest": {
"preset": "react-native",
"setupFiles": [
"../../node_modules/react-native-gesture-handler/jestSetup.js"
],
"transformIgnorePatterns": [
"node_modules/(?!(jest-)?react-native|@react-native-community|@react-navigation)"
]
}
}
Binary file added examples/reactnavigation/public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/reactnavigation/public/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/reactnavigation/public/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/redux/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = function (api) {
api.cache(true);
return {
presets: ['module:metro-react-native-babel-preset'],
presets: ['babel-preset-expo'],
};
};
2 changes: 1 addition & 1 deletion examples/redux/components/TodoList.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { FlatList, Text } from 'react-native';
import { FlatList } from 'react-native';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { removeTodo } from '../actions/todoActions';
Expand Down
2 changes: 1 addition & 1 deletion examples/redux/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { registerRootComponent } from 'expo';
import registerRootComponent from 'expo/build/launch/registerRootComponent';

import App from './App';

Expand Down
22 changes: 15 additions & 7 deletions examples/redux/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,30 @@
"name": "redux-example",
"description": "Testing Redux interactions with RNTL",
"version": "0.0.1",
"main": "./index.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"eject": "expo eject",
"test": "jest"
},
"dependencies": {
"react": "~16.9.0",
"react-native": "~0.61.5",
"expo": "~38.0.8",
"expo-status-bar": "^1.0.2",
"react": "*",
"react-native": "*",
"react-redux": "^7.2.0",
"redux": "^4.0.5"
},
"devDependencies": {
"@babel/core": "^7.8.6",
"babel-jest": "~25.2.6",
"jest": "~25.2.6",
"metro-react-native-babel-preset": "^0.59.0",
"@testing-library/react-native": "^7.0.0-rc.0",
"react-test-renderer": "~16.9.0"
"@babel/runtime": "^7.9.2",
"babel-jest": "*",
"babel-preset-expo": "~8.1.0",
"jest": "*",
"@testing-library/react-native": "*",
"react-test-renderer": "*"
},
"private": true,
"jest": {
Expand Down
Binary file added examples/redux/public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/redux/public/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/redux/public/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
90 changes: 17 additions & 73 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,79 +1,23 @@
{
"name": "@testing-library/react-native",
"version": "7.0.1",
"description": "Simple and complete React Native testing utilities that encourage good testing practices.",
"main": "build/index.js",
"typings": "./typings/index.d.ts",
"repository": {
"type": "git",
"url": "https://www.github.com/callstack/react-native-testing-library.git"
},
"homepage": "https://callstack.github.io/react-native-testing-library",
"author": "Michał Pierzchała <[email protected]>",
"license": "MIT",
"private": false,
"keywords": [
"react-native",
"react",
"test",
"integration"
],
"files": [
"build/",
"typings/index.d.ts",
"pure.js",
"dont-cleanup-after-each.js"
"name": "react-native-testing-library",
"private": true,
"workspaces": [
"examples/*",
"packages/*",
"website"
],
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/preset-env": "^7.9.6",
"@babel/preset-flow": "^7.9.0",
"@babel/preset-react": "^7.9.4",
"@callstack/eslint-config": "^10.0.0",
"@release-it/conventional-changelog": "^1.1.0",
"@testing-library/jest-native": "~3.3.0",
"@types/react": "^16.9.34",
"@types/react-native": "^0.63.0",
"@types/react-test-renderer": "^16.9.2",
"babel-jest": "^26.0.1",
"conventional-changelog-cli": "^2.0.11",
"dedent": "^0.7.0",
"eslint": "^7.0.0",
"flow-bin": "^0.122.0",
"flow-copy-source": "^2.0.9",
"jest": "^26.0.1",
"react": "^16.13.1",
"react-native": "^0.63.0-rc.1",
"react-test-renderer": "^16.13.1",
"release-it": "^13.6.0",
"strip-ansi": "^6.0.0",
"typescript": "^3.8.3"
},
"dependencies": {
"pretty-format": "^26.0.1"
},
"peerDependencies": {
"react": ">=16.0.0",
"react-test-renderer": ">=16.0.0"
},
"scripts": {
"test": "jest",
"flow-check": "flow check",
"typescript-check": "tsc --noEmit --skipLibCheck --jsx react ./typings/__tests__/*",
"lint": "eslint src --cache",
"release": "release-it",
"prepublish": "yarn build && yarn copy-flowtypes",
"copy-flowtypes": "flow-copy-source --ignore __tests__/*.js src build",
"build": "rm -rf build; babel src --out-dir build --ignore 'src/__tests__/*'"
"react": "^16.13.1",
"react-native": "^0.63.2"
},
"jest": {
"preset": "react-native",
"moduleFileExtensions": [
"js",
"json"
],
"rootDir": "./src"
"devDependencies": {
Copy link
Member

Choose a reason for hiding this comment

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

FYI, there's no need to differentiate between deps and devDeps in workspace root, I don't mind it though, your call :)

"@callstack/eslint-config": "^10.0.1",
"@types/react": "^16.9.46",
"@types/react-native": "^0.63.8",
"@types/react-test-renderer": "^16.9.3",
"babel-jest": "^26.3.0",
"eslint": "^7.7.0",
"jest": "^26.4.0",
"react-test-renderer": "^16.13.1"
}
}
File renamed without changes.
File renamed without changes.
79 changes: 79 additions & 0 deletions packages/react-native-testing-library/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"name": "@testing-library/react-native",
"version": "7.0.1",
"description": "Simple and complete React Native testing utilities that encourage good testing practices.",
"main": "build/index.js",
"typings": "./typings/index.d.ts",
"repository": {
"type": "git",
"url": "https://www.github.com/callstack/react-native-testing-library.git"
},
"homepage": "https://callstack.github.io/react-native-testing-library",
"author": "Michał Pierzchała <[email protected]>",
"license": "MIT",
"private": false,
"keywords": [
"react-native",
"react",
"test",
"integration"
],
"files": [
"build/",
"typings/index.d.ts",
"pure.js",
"dont-cleanup-after-each.js"
],
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/preset-env": "^7.9.6",
"@babel/preset-flow": "^7.9.0",
"@babel/preset-react": "^7.9.4",
"@callstack/eslint-config": "*",
"@release-it/conventional-changelog": "^1.1.0",
"@testing-library/jest-native": "~3.3.0",
"@types/react": "*",
"@types/react-native": "*",
"@types/react-test-renderer": "*",
"babel-jest": "*",
"conventional-changelog-cli": "^2.0.11",
"dedent": "^0.7.0",
"eslint": "*",
"flow-bin": "^0.122.0",
"flow-copy-source": "^2.0.9",
"jest": "*",
"react": "*",
"react-native": "*",
"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.

can we get rid of * in our dev deps and bring back the versions we had in original package.json? I don't mind having * in examples though

"release-it": "^13.6.0",
"strip-ansi": "^6.0.0",
"typescript": "^3.8.3"
},
"dependencies": {
"pretty-format": "^26.0.1"
},
"peerDependencies": {
"react": ">=16.0.0",
"react-test-renderer": ">=16.0.0"
},
"scripts": {
"test": "jest",
"flow-check": "flow check",
"typescript-check": "tsc --noEmit --skipLibCheck --jsx react ./typings/__tests__/*",
"lint": "eslint src --cache",
"release": "release-it",
"prepublish": "yarn build && yarn copy-flowtypes",
"copy-flowtypes": "flow-copy-source --ignore __tests__/*.js src build",
"build": "rm -rf build; babel src --out-dir build --ignore 'src/__tests__/*'"
},
"jest": {
"preset": "react-native",
"moduleFileExtensions": [
"js",
"json"
],
"rootDir": "./src"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
act,
within,
getQueriesForElement,
} from '../..';
} from '..';

interface HasRequiredProp {
requiredProp: string;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const siteConfig = {
alt: title,
src: 'img/owl.png',
},
links: [
items: [
{ to: 'docs/getting-started', label: 'Docs', position: 'right' },
{ href: repoUrl, label: 'GitHub', position: 'right' },
],
Expand Down
2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@docusaurus/core": "^2.0.0-alpha.54",
"@docusaurus/preset-classic": "^2.0.0-alpha.54",
"classnames": "^2.2.6",
"react": "^16.8.4",
"react": "*",
"react-dom": "^16.8.4"
},
"browserslist": {
Expand Down
Loading