Skip to content

Commit f432de3

Browse files
authored
Add tests for React Native 0.78 (#480)
1 parent 6160f00 commit f432de3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+12304
-1400
lines changed

.circleci/config.yml

+26-54
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,29 @@
11
version: 2.1
22

33
aliases:
4-
- &xcode-version 15.4.0
5-
- &node-version '20.10.0'
6-
- &yarn-version '1.22.19'
4+
- &node-version '22.14.0'
5+
- &yarn-version '1.22.22'
76

87
orbs:
9-
node: circleci/node@5.1.1
10-
browser-tools: circleci/browser-tools@1.4.6
8+
node: circleci/node@5.3.0
9+
browser-tools: circleci/browser-tools@1.5.3
1110
android: circleci/[email protected]
1211

1312
executors:
1413
node:
1514
docker:
16-
- image: cimg/node:20.10.0
15+
- image: cimg/node:22.14.0
1716
working_directory: ~/react-native-url-polyfill
1817
environment:
1918
NODE_OPTIONS: '--openssl-legacy-provider'
2019
node-browsers:
2120
docker:
22-
- image: cimg/node:20.10.0-browsers
21+
- image: cimg/node:22.14.0-browsers
2322
environment:
2423
NODE_OPTIONS: '--openssl-legacy-provider'
25-
xcode:
26-
macos:
27-
xcode: *xcode-version
28-
environment:
29-
HOMEBREW_NO_AUTO_UPDATE: 1
30-
XCODE_VERSION: *xcode-version
31-
NODE_OPTIONS: '--openssl-legacy-provider'
3224
android:
3325
docker:
34-
- image: cimg/android:2023.06.1
26+
- image: cimg/android:2023.12.1-node
3527
resource_class: large
3628
environment:
3729
JAVA_TOOL_OPTIONS: '-Xmx1536m'
@@ -194,15 +186,19 @@ jobs:
194186
command: yarn test
195187
test-ios:
196188
parameters:
197-
executor:
198-
default: xcode
199-
type: executor
200189
react-native-version:
201190
type: string
191+
xcode-version:
192+
type: string
202193
install-yarn:
203194
type: boolean
204195
default: true
205-
executor: << parameters.executor >>
196+
macos:
197+
xcode: << parameters.xcode-version >>
198+
environment:
199+
HOMEBREW_NO_AUTO_UPDATE: 1
200+
XCODE_VERSION: << parameters.xcode-version >>
201+
NODE_OPTIONS: '--openssl-legacy-provider'
206202
working_directory: ~/react-native-url-polyfill/platforms/react-native/<< parameters.react-native-version >>
207203
steps:
208204
- attach-workspace
@@ -266,31 +262,6 @@ jobs:
266262
name: Build APK
267263
command: cd android && ./gradlew assembleRelease
268264
- save-android-build-cache
269-
test-hermes-ios:
270-
parameters:
271-
executor:
272-
default: xcode
273-
type: executor
274-
react-native-version:
275-
type: string
276-
executor: << parameters.executor >>
277-
working_directory: ~/react-native-url-polyfill/platforms/react-native/<< parameters.react-native-version >>
278-
steps:
279-
- attach-workspace
280-
- restore-cache-detox-app
281-
- run:
282-
name: Enable Hermes
283-
command: npx shx sed -i "s/:hermes_enabled\s=>\sfalse/:hermes_enabled => true/g" ios/Podfile
284-
- install-node
285-
- install-yarn-dependencies
286-
- install-detox
287-
- run:
288-
name: Install Pods
289-
command: |
290-
cd ios && pod install
291-
- run:
292-
name: Run Detox on iOS
293-
command: yarn e2e:ios
294265
test-expo-web:
295266
parameters:
296267
expo-version:
@@ -330,25 +301,26 @@ workflows:
330301
requires:
331302
- checkout
332303
- test-ios:
333-
matrix:
334-
parameters:
335-
react-native-version: ['0.72']
304+
name: test-ios-0.72
305+
react-native-version: '0.72'
306+
xcode-version: 15.4.0
307+
requires:
308+
- lint
309+
- test-js
310+
- test-ios:
311+
name: test-ios-0.78
312+
react-native-version: '0.78'
313+
xcode-version: 16.2.0
336314
requires:
337315
- lint
338316
- test-js
339317
- test-android:
340318
matrix:
341319
parameters:
342-
react-native-version: ['0.68', '0.72']
320+
react-native-version: ['0.68', '0.72', '0.78']
343321
requires:
344322
- lint
345323
- test-js
346-
# - test-hermes-ios:
347-
# matrix:
348-
# parameters:
349-
# react-native-version: ['0.68']
350-
# requires:
351-
# - test-ios-<< matrix.react-native-version >>
352324
- test-hermes-android:
353325
matrix:
354326
parameters:

package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
},
3535
"devDependencies": {
3636
"@react-native-community/eslint-config": "3.2.0",
37-
"detox": "20.14.3",
37+
"@types/node": "^22.13.10",
38+
"detox": "20.34.5",
3839
"eslint": "8.56.0",
3940
"eslint-plugin-prettier": "5.1.1",
4041
"husky": "8.0.3",
@@ -43,10 +44,10 @@
4344
"metro-react-native-babel-preset": "0.76.7",
4445
"nanoid": "3.3.7",
4546
"prettier": "3.1.1",
46-
"react": "18.2.0",
47-
"react-native": "0.72.1",
47+
"react": "19.0.0",
48+
"react-native": "0.78.0",
4849
"react-native-bundle-scale": "1.1.0",
49-
"typescript": "5.3.3"
50+
"typescript": "5.8.2"
5051
},
5152
"peerDependencies": {
5253
"react-native": "*"

platforms/detox/.detoxrc.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,18 @@ module.exports = {
3737
},
3838
},
3939
devices: {
40-
simulator: {
40+
simulator15: {
4141
type: 'ios.simulator',
4242
device: {
4343
type: 'iPhone 15 Pro',
4444
},
4545
},
46+
simulator: {
47+
type: 'ios.simulator',
48+
device: {
49+
type: 'iPhone 16 Pro',
50+
},
51+
},
4652
attached: {
4753
type: 'android.attached',
4854
device: {
@@ -61,6 +67,10 @@ module.exports = {
6167
device: 'simulator',
6268
app: 'ios.debug',
6369
},
70+
'ios.sim.release.15': {
71+
device: 'simulator15',
72+
app: 'ios.release',
73+
},
6474
'ios.sim.release': {
6575
device: 'simulator',
6676
app: 'ios.release',

platforms/react-native/0.68/metro.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@ module.exports = {
1414
resolver: {
1515
blockList: [
1616
new RegExp(`${reactNativeLib}/node_modules/react-native/.*`),
17+
new RegExp(`${reactNativeLib}/node_modules/react/.*`),
1718
new RegExp(`${reactNativeLib}/platforms/react-native/((?!0.68).).*`),
1819
new RegExp(`${reactNativeLib}/platforms/expo/.*`),
1920
new RegExp(path.resolve(__dirname, 'ios/.*')),
2021
],
2122
extraNodeModules: {
2223
'react-native': path.resolve(__dirname, 'node_modules/react-native'),
24+
'react': path.resolve(__dirname, 'node_modules/react'),
25+
'react-native-url-polyfill': path.resolve(__dirname, reactNativeLib),
2326
},
2427
},
2528
transformer: {

platforms/react-native/0.72/metro.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@ const config = {
1515
resolver: {
1616
blockList: [
1717
new RegExp(`${reactNativeLib}/node_modules/react-native/.*`),
18+
new RegExp(`${reactNativeLib}/node_modules/react/.*`),
1819
new RegExp(`${reactNativeLib}/platforms/react-native/((?!0.72).).*`),
1920
new RegExp(`${reactNativeLib}/platforms/expo/.*`),
2021
new RegExp(path.resolve(__dirname, 'ios/.*')),
2122
],
2223
extraNodeModules: {
2324
'react-native': path.resolve(__dirname, 'node_modules/react-native'),
25+
'react': path.resolve(__dirname, 'node_modules/react'),
26+
'react-native-url-polyfill': reactNativeLib,
2427
},
2528
},
2629
};

platforms/react-native/0.72/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"lint": "eslint .",
99
"start": "react-native start",
1010
"test": "jest",
11-
"build:ios": "detox build --configuration ios.sim.release",
12-
"test:ios": "detox test --configuration ios.sim.release --cleanup",
11+
"build:ios": "detox build --configuration ios.sim.release.15",
12+
"test:ios": "detox test --configuration ios.sim.release.15 --cleanup --headless",
1313
"e2e:ios": "yarn build:ios && yarn test:ios",
1414
"build:android": "detox build --configuration android.emu.release",
1515
"test:android": "detox test --configuration android.emu.release",
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"extends": "@tsconfig/react-native/tsconfig.json"
2+
"extends": "@react-native/typescript-config/tsconfig.json"
33
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BUNDLE_PATH: "vendor/bundle"
2+
BUNDLE_FORCE_RUBY_PLATFORM: 1
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
const detoxConfig = require('../../detox/.detoxrc.js');
2+
3+
/** @type {Detox.DetoxConfig} */
4+
module.exports = detoxConfig;
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
root: true,
3+
extends: '@react-native',
4+
};
+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# Xcode
6+
#
7+
build/
8+
*.pbxuser
9+
!default.pbxuser
10+
*.mode1v3
11+
!default.mode1v3
12+
*.mode2v3
13+
!default.mode2v3
14+
*.perspectivev3
15+
!default.perspectivev3
16+
xcuserdata
17+
*.xccheckout
18+
*.moved-aside
19+
DerivedData
20+
*.hmap
21+
*.ipa
22+
*.xcuserstate
23+
**/.xcode.env.local
24+
25+
# Android/IntelliJ
26+
#
27+
build/
28+
.idea
29+
.gradle
30+
local.properties
31+
*.iml
32+
*.hprof
33+
.cxx/
34+
*.keystore
35+
!debug.keystore
36+
.kotlin/
37+
38+
# node.js
39+
#
40+
node_modules/
41+
npm-debug.log
42+
yarn-error.log
43+
44+
# fastlane
45+
#
46+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47+
# screenshots whenever they are needed.
48+
# For more information about the recommended setup visit:
49+
# https://docs.fastlane.tools/best-practices/source-control/
50+
51+
**/fastlane/report.xml
52+
**/fastlane/Preview.html
53+
**/fastlane/screenshots
54+
**/fastlane/test_output
55+
56+
# Bundle artifact
57+
*.jsbundle
58+
59+
# Ruby / CocoaPods
60+
**/Pods/
61+
/vendor/bundle/
62+
63+
# Temporary files created by Metro to check the health of the file watcher
64+
.metro-health-check*
65+
66+
# testing
67+
/coverage
68+
69+
# Yarn
70+
.yarn/*
71+
!.yarn/patches
72+
!.yarn/plugins
73+
!.yarn/releases
74+
!.yarn/sdks
75+
!.yarn/versions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
arrowParens: 'avoid',
3+
bracketSameLine: true,
4+
bracketSpacing: false,
5+
singleQuote: true,
6+
trailingComma: 'all',
7+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

platforms/react-native/0.78/App.tsx

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* Sample React Native App
3+
* https://github.com/facebook/react-native
4+
*
5+
* @format
6+
*/
7+
8+
import React from 'react';
9+
import {SafeAreaView, StatusBar, useColorScheme} from 'react-native';
10+
11+
import TestPolyfill from '../../detox/TestPolyfill';
12+
13+
function App(): React.JSX.Element {
14+
const isDarkMode = useColorScheme() === 'dark';
15+
16+
return (
17+
<SafeAreaView>
18+
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
19+
<TestPolyfill />
20+
</SafeAreaView>
21+
);
22+
}
23+
24+
export default App;

platforms/react-native/0.78/Gemfile

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
source 'https://rubygems.org'
2+
3+
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4+
ruby ">= 2.6.10"
5+
6+
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
7+
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
8+
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
9+
gem 'xcodeproj', '< 1.26.0'
10+
gem 'concurrent-ruby', '< 1.3.4'

0 commit comments

Comments
 (0)