Skip to content

Commit

Permalink
Test with react@17 through a script updating dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
AugustinLF committed Sep 14, 2022
1 parent 80308d4 commit 2732180
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 6,057 deletions.
1 change: 0 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
key: dependencies-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
- run: yarn setup:react:17
- persist_to_workspace:
root: .
paths:
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@
"build:ts:watch": "yarn build:ts --watch --preserveWatchOutput",
"build": "yarn clean && yarn build:js && yarn build:ts && yarn copy-flowtypes",
"prepare": "yarn build",
"setup:react:17": "del react-17-tests/src react-17-tests/jest-preset && cp -R src jestSetup.js jest-preset babel.config.js react-17-tests/ && cd react-17-tests && yarn",
"test:react:17": "cd react-17-tests && yarn test"
"test:react:17": "scripts/test_react_17"
},
"jest": {
"preset": "./jest-preset",
Expand All @@ -93,8 +92,7 @@
],
"testPathIgnorePatterns": [
"timerUtils",
"examples/",
"react-17-tests"
"examples/"
],
"testTimeout": 60000,
"transformIgnorePatterns": [
Expand Down
4 changes: 0 additions & 4 deletions react-17-tests/.gitignore

This file was deleted.

40 changes: 0 additions & 40 deletions react-17-tests/package.json

This file was deleted.

6,002 changes: 0 additions & 6,002 deletions react-17-tests/yarn.lock

This file was deleted.

10 changes: 10 additions & 0 deletions scripts/test_react_17
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh -e

cp yarn.lock tmp.yarn.lock
cp package.json tmp.package.json

yarn add react@17.0.2 react-test-renderer@17.0.2 react-native@0.68.1 --ignore-scripts
yarn test

mv tmp.package.json package.json
mv tmp.yarn.lock yarn.lock
12 changes: 6 additions & 6 deletions src/__tests__/render.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ test('debug changing component', () => {
test('renders options.wrapper around node', () => {
type WrapperComponentProps = { children: React.ReactNode };
const WrapperComponent = ({ children }: WrapperComponentProps) => (
<SafeAreaView testID="wrapper">{children}</SafeAreaView>
<View testID="wrapper">{children}</View>
);

const { toJSON, getByTestId } = render(<View testID="inner" />, {
Expand All @@ -214,20 +214,20 @@ test('renders options.wrapper around node', () => {

expect(getByTestId('wrapper')).toBeTruthy();
expect(toJSON()).toMatchInlineSnapshot(`
<RCTSafeAreaView
<View
testID="wrapper"
>
<View
testID="inner"
/>
</RCTSafeAreaView>
</View>
`);
});

test('renders options.wrapper around updated node', () => {
type WrapperComponentProps = { children: React.ReactNode };
const WrapperComponent = ({ children }: WrapperComponentProps) => (
<SafeAreaView testID="wrapper">{children}</SafeAreaView>
<View testID="wrapper">{children}</View>
);

const { toJSON, getByTestId, rerender } = render(<View testID="inner" />, {
Expand All @@ -240,15 +240,15 @@ test('renders options.wrapper around updated node', () => {

expect(getByTestId('wrapper')).toBeTruthy();
expect(toJSON()).toMatchInlineSnapshot(`
<RCTSafeAreaView
<View
testID="wrapper"
>
<View
accessibilityHint="test"
accessibilityLabel="test"
testID="inner"
/>
</RCTSafeAreaView>
</View>
`);
});

Expand Down

0 comments on commit 2732180

Please sign in to comment.