Skip to content

Commit

Permalink
chore: bump react-native to 0.71 (#958)
Browse files Browse the repository at this point in the history
This commit also removes Detox. Detox keeps breaking with every update
and they're really hard to figure out every time. Tests are disabled
until we can implement an alternative.
  • Loading branch information
tido64 committed Jun 19, 2023
1 parent f804102 commit 2b525c8
Show file tree
Hide file tree
Showing 16 changed files with 2,171 additions and 2,998 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ jobs:
run: |
yarn build:e2e:ios
- name: Test
if: false
run: |
yarn test:e2e:ios
macos:
Expand Down Expand Up @@ -112,12 +113,16 @@ jobs:
run: |
pod install
working-directory: example/macos
- name: Build and test
- name: Build
run: |
yarn build:e2e:macos
- name: Test
if: false
run: |
yarn test:e2e:macos
windows:
name: Windows
runs-on: windows-2019
runs-on: windows-2022
steps:
- name: Set up MSBuild
uses: microsoft/setup-msbuild@v1.3
Expand Down
13 changes: 13 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,17 @@ logFilters:
level: discard
nodeLinker: node-modules
npmRegistryServer: "https://registry.npmjs.org"
packageExtensions:
"@expo/cli@*":
peerDependencies:
"expo-modules-autolinking": "*"
"babel-preset-expo@*":
peerDependencies:
"@babel/core": "^7.0.0-0"
"expo@*":
peerDependencies:
"@babel/core": "^7.0.0-0"
"expo-asset@*":
peerDependencies:
"expo": "*"
yarnPath: .yarn/releases/yarn-3.4.1.cjs
2 changes: 1 addition & 1 deletion example/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function App(): JSX.Element {
const [iteration, setIteration] = useState(0);
const [currentTest, setCurrentTest] = useState(SCREENS.Functional);

const dismissKeyboard = useCallback(Keyboard.dismiss, []);
const dismissKeyboard = useCallback(() => Keyboard.dismiss(), []);
const simulateRestart = useCallback(
() => setIteration(iteration + 1),
[iteration]
Expand Down
16 changes: 2 additions & 14 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ buildscript {

// Mainly for Detox testing for using Next Storage
// when building next, force using next storage
if(gradle.startParameter.getTaskNames().contains("assembleNext")) {
if (gradle.startParameter.getTaskNames().contains("assembleNext")) {
rootProject.setProperty("AsyncStorage_useNextStorage", "true")
}
Boolean nextStorageFlag = rootProject.hasProperty("AsyncStorage_useNextStorage") ? rootProject.properties["AsyncStorage_useNextStorage"] == "true" : false
Expand All @@ -50,13 +50,6 @@ buildscript {
}

allprojects {
repositories {
maven {
url("$rootDir/../../node_modules/detox/Detox-android")
}
mavenCentral()
google()
}
afterEvaluate { project ->
def androidExtension = project.extensions.findByName('android')

Expand Down Expand Up @@ -86,13 +79,8 @@ allprojects {
}
androidExtension.testBuildType = 'release'
androidExtension.sourceSets.androidTest.java.srcDirs += "$rootDir/app/src/androidTest/java"
if(System.getenv("CIRCLECI") == "true") {
// explicitly apply NDK version available in CI image
androidExtension.ndkVersion = "20.1.5948944"
}
project.dependencies {
androidTestImplementation('com.wix:detox:+')

project.dependencies {
def hermesDir = file('../../node_modules/hermes-engine/android').absolutePath
nextImplementation files("$hermesDir/hermes-release.aar")
}
Expand Down
Binary file modified example/android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 6 additions & 0 deletions example/android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
14 changes: 8 additions & 6 deletions example/android/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,7 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
8 changes: 0 additions & 8 deletions example/e2e/config.json

This file was deleted.

23 changes: 0 additions & 23 deletions example/e2e/environment.js

This file was deleted.

5 changes: 0 additions & 5 deletions example/e2e/jest.setup.js

This file was deleted.

49 changes: 35 additions & 14 deletions example/examples/Functional.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ async function execute(steps: TestStep[]): Promise<void> {
function Functional(): JSX.Element {
const [results, setResults] = useState<[string, TestResult?][]>([]);
useEffect(() => {
const results: [string, TestResult?][] = [];
const testResults: [string, TestResult?][] = [];
Promise.resolve()
.then(async () => {
for (const [name, test] of Object.entries(tests)) {
try {
await execute(test);
results.push([name, undefined]);
testResults.push([name, undefined]);
} catch (e: any) {
results.push([name, e]);
testResults.push([name, e]);
}
}
})
Expand All @@ -100,15 +100,15 @@ function Functional(): JSX.Element {
const name = currentName + ' with delegate';

if (!AsyncStorageTestSupport?.test_setDelegate) {
results.push([name, SKIP_TEST]);
testResults.push([name, SKIP_TEST]);
continue;
}

const isNativeDelegateSet = await new Promise((resolve) => {
AsyncStorageTestSupport.test_setDelegate(resolve);
});
if (!isNativeDelegateSet) {
results.push([
testResults.push([
name,
{
step: 0,
Expand All @@ -121,27 +121,31 @@ function Functional(): JSX.Element {

try {
await execute(test);
results.push([name, undefined]);
testResults.push([name, undefined]);
} catch (e: any) {
results.push([name, e]);
testResults.push([name, e]);
await new Promise((resolve) => {
AsyncStorageTestSupport.test_unsetDelegate(resolve);
});
}
}
})
.then(() => setResults(results));
.then(() => setResults(testResults));
}, []);
return (
<ScrollView contentContainerStyle={{ flexGrow: 1 }}>
<ScrollView contentContainerStyle={styles.container}>
<View>
{results.map(([name, result]) => {
const testID = 'test:' + name;
if (!result) {
return (
<View key={name} style={styles.passed}>
<Text style={styles.testLabel}>{name}</Text>
<Text accessibilityLabel="Pass" testID={testID}>
<Text
accessibilityLabel="Pass"
testID={testID}
style={styles.testResult}
>
Pass
</Text>
</View>
Expand All @@ -152,7 +156,11 @@ function Functional(): JSX.Element {
return (
<View key={name} style={styles.skipped}>
<Text style={styles.testLabel}>{name}</Text>
<Text accessibilityLabel="Skip" testID={testID}>
<Text
accessibilityLabel="Skip"
testID={testID}
style={styles.testResult}
>
Skip
</Text>
</View>
Expand All @@ -163,9 +171,15 @@ function Functional(): JSX.Element {
<View key={name} style={styles.failed}>
<Text style={styles.testLabel}>{name}</Text>
<View accessibilityLabel="Fail" testID={testID}>
<Text>{`Step: ${result.step + 1}`}</Text>
<Text>{`Expected: ${stringify(result.expected)}`}</Text>
<Text>{`Actual: ${result.actual}`}</Text>
<Text style={styles.testResult}>{`Step: ${
result.step + 1
}`}</Text>
<Text style={styles.testResult}>{`Expected: ${stringify(
result.expected
)}`}</Text>
<Text
style={styles.testResult}
>{`Actual: ${result.actual}`}</Text>
</View>
</View>
);
Expand All @@ -176,6 +190,9 @@ function Functional(): JSX.Element {
}

const styles = StyleSheet.create({
container: {
flexGrow: 1,
},
failed: {
backgroundColor: '#e53935',
flex: 1,
Expand All @@ -193,8 +210,12 @@ const styles = StyleSheet.create({
padding: 4,
},
testLabel: {
color: '#000000',
flex: 1,
},
testResult: {
color: '#000000',
},
});

export default {
Expand Down

0 comments on commit 2b525c8

Please sign in to comment.