Skip to content

Commit

Permalink
Upgrade roboletric and junit versions to be consistent (#22395)
Browse files Browse the repository at this point in the history
# Why

The bumping of robolectric to 4.10 means that we no longer need jetifier to translate old support library dependencies.

# How

* Updates `robolectric` to `4.10` and `junit` to `4.13.2`
* Updates test dependencies in `expo-modules-test-core` to their latest versions
* A minor change needed to be made to the `expo-clipboard` test because of changes to the way that robolectric handles decoding bitmaps for tests.

# Test Plan

Ensured [unit tests still pass](https://github.com/josephyanks/expo/actions/runs/4896200135/jobs/8742724860)

Trying to verify end to end tests locally.
  • Loading branch information
josephyanks authored May 9, 2023
1 parent 66ba892 commit d0cf89c
Show file tree
Hide file tree
Showing 38 changed files with 103 additions and 34 deletions.
6 changes: 3 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,15 @@ dependencies {
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
androidTestImplementation 'com.azimolabs.conditionwatcher:conditionwatcher:0.2'

androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'junit:junit:4.13.2'
androidTestImplementation 'org.mockito:mockito-core:1.10.19'
testImplementation 'org.robolectric:robolectric:3.8'
testImplementation 'org.robolectric:robolectric:4.10'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test:rules:1.4.0'

testImplementation 'androidx.test:runner:1.4.0'
testImplementation 'androidx.test:rules:1.4.0'
testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:1.10.19'

// WHEN_DISTRIBUTING_REMOVE_FROM_HERE
Expand Down
2 changes: 1 addition & 1 deletion android/expoview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"

testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13.2'

// WHEN_VERSIONING_REPLACE_WITH_DEPENDENCIES

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ dependencies {
// used kotlin
def kotlinReflect_version = project.ext.asyncStorageKtVersion
def junit_version = "4.13.2"
def robolectric_version = "4.7.3"
def robolectric_version = "4.10"
def truth_version = "1.1.3"
def androidxtest_version = "1.4.0"
def androidtest_junit_version = "1.1.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ dependencies {
// used kotlin
def kotlinReflect_version = project.ext.asyncStorageKtVersion
def junit_version = "4.13.2"
def robolectric_version = "4.7.3"
def robolectric_version = "4.10"
def truth_version = "1.1.3"
def androidxtest_version = "1.4.0"
def androidtest_junit_version = "1.1.3"
Expand Down
2 changes: 1 addition & 1 deletion android/versioned-abis/expoview-abi46_0_0/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"

testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13.2'

implementation project(":expoview")

Expand Down
2 changes: 1 addition & 1 deletion android/versioned-abis/expoview-abi47_0_0/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"

testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13.2'

implementation project(":expoview")

Expand Down
2 changes: 1 addition & 1 deletion android/versioned-abis/expoview-abi48_0_0/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"

testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13.2'

implementation project(":expoview")

Expand Down
4 changes: 4 additions & 0 deletions packages/expo-application/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unpublished

### 📚 3rd party library updates

- Updated `robolectric` to `4.10` and `junit` to `4.13.2`. ([#22395](https://github.com/expo/expo/pull/22395) by [@josephyanks](https://github.com/josephyanks))

### 🛠 Breaking changes

### 🎉 New features
Expand Down
4 changes: 2 additions & 2 deletions packages/expo-application/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ dependencies {
if (project.findProject(':expo-modules-test-core')) {
testImplementation project(':expo-modules-test-core')
}
testImplementation "org.robolectric:robolectric:4.5.1"
testImplementation 'junit:junit:4.12'
testImplementation "org.robolectric:robolectric:4.10"
testImplementation 'junit:junit:4.13.2'
}
4 changes: 4 additions & 0 deletions packages/expo-battery/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unpublished

### 📚 3rd party library updates

- Updated `robolectric` to `4.10` and `junit` to `4.13.2`. ([#22395](https://github.com/expo/expo/pull/22395) by [@josephyanks](https://github.com/josephyanks))

### 🛠 Breaking changes

### 🎉 New features
Expand Down
2 changes: 1 addition & 1 deletion packages/expo-battery/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,5 @@ dependencies {
if (project.findProject(':expo-modules-test-core')) {
testImplementation project(':expo-modules-test-core')
}
testImplementation "org.robolectric:robolectric:4.3.1"
testImplementation "org.robolectric:robolectric:4.10"
}
4 changes: 4 additions & 0 deletions packages/expo-clipboard/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unpublished

### 📚 3rd party library updates

- Updated `robolectric` to `4.10`. ([#22395](https://github.com/expo/expo/pull/22395) by [@josephyanks](https://github.com/josephyanks))

### 🛠 Breaking changes

### 🎉 New features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package expo.modules.clipboard

import android.content.Context
import android.graphics.Bitmap
import android.graphics.Color
import android.net.Uri
import android.util.Base64
import androidx.test.core.app.ApplicationProvider
Expand Down Expand Up @@ -140,7 +141,10 @@ class ClipboardImageTest {

val bitmap = bitmapFromContentUriAsync(context, uri)
val shadow = shadowOf(bitmap)
assertNotNull("Bitmap was not created from ContentResolver stream", shadow.createdFromStream)
assertNotNull(
"Bitmap was not created from ContentResolver stream",
shadow.createdFromStream
)
assertBitmapMatchesMock(bitmap)
}
}
Expand All @@ -149,9 +153,14 @@ private fun assertBitmapMatchesMock(bitmap: Bitmap) {
val message = "Bitmap doesn't match the mocked data"
assertEquals("$message: Invalid width", 1, bitmap.width)
assertEquals("$message: Invalid height", 1, bitmap.height)

// Note that on some tests, the pixel value will be -16777216, which is
// 11111111 00000000 00000000 00000000 in binary form. This is also a fully-opaque
// black color, so comparing hex strings is cleaner to capture both acceptable results
// (0 and -16777216).
assertEquals(
"$message: Incorrect pixel color. Expected black",
0x000000,
bitmap.getPixel(0, 0)
Integer.toHexString(bitmap.getPixel(0, 0)),
Integer.toHexString(Color.BLACK)
)
}
4 changes: 4 additions & 0 deletions packages/expo-crypto/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unpublished

### 📚 3rd party library updates

- Updated `robolectric` to `4.10` and `junit` to `4.13.2`. ([#22395](https://github.com/expo/expo/pull/22395) by [@josephyanks](https://github.com/josephyanks))

### 🛠 Breaking changes

### 🎉 New features
Expand Down
4 changes: 2 additions & 2 deletions packages/expo-crypto/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,6 @@ dependencies {
if (project.findProject(':expo-modules-test-core')) {
testImplementation project(':expo-modules-test-core')
}
testImplementation 'junit:junit:4.12'
testImplementation "org.robolectric:robolectric:4.3.1"
testImplementation 'junit:junit:4.13.2'
testImplementation "org.robolectric:robolectric:4.10"
}
4 changes: 4 additions & 0 deletions packages/expo-dev-launcher/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unpublished

### 📚 3rd party library updates

- Updated `robolectric` to `4.10`. ([#22395](https://github.com/expo/expo/pull/22395) by [@josephyanks](https://github.com/josephyanks))

### 🛠 Breaking changes

### 🎉 New features
Expand Down
2 changes: 1 addition & 1 deletion packages/expo-dev-launcher/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ dependencies {
testImplementation "io.insert-koin:koin-test:3.1.2"
testImplementation "io.insert-koin:koin-test-junit4:3.1.2"
testImplementation 'io.mockk:mockk:1.12.3'
testImplementation "org.robolectric:robolectric:4.7.3"
testImplementation "org.robolectric:robolectric:4.10"
}

// Koin uses a different version of Kotlin under the hood.
Expand Down
4 changes: 4 additions & 0 deletions packages/expo-dev-menu/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unpublished

### 📚 3rd party library updates

- Updated `robolectric` to `4.10`. ([#22395](https://github.com/expo/expo/pull/22395) by [@josephyanks](https://github.com/josephyanks))

### 🛠 Breaking changes

### 🎉 New features
Expand Down
2 changes: 1 addition & 1 deletion packages/expo-dev-menu/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ dependencies {
api "androidx.browser:browser:1.2.0"

testImplementation "com.google.truth:truth:1.1.2"
testImplementation "org.robolectric:robolectric:4.3.1"
testImplementation "org.robolectric:robolectric:4.10"
testImplementation 'com.squareup.okhttp3:mockwebserver:4.3.1'
testImplementation 'androidx.test:core:1.4.0'
}
Expand Down
4 changes: 4 additions & 0 deletions packages/expo-json-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unpublished

### 📚 3rd party library updates

- Updated `junit` to `4.13.2`. ([#22395](https://github.com/expo/expo/pull/22395) by [@josephyanks](https://github.com/josephyanks))

### 🛠 Breaking changes

### 🎉 New features
Expand Down
2 changes: 1 addition & 1 deletion packages/expo-json-utils/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ android {
}

dependencies {
testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13.2'
testImplementation 'androidx.test:core:1.4.0'
testImplementation 'org.mockito:mockito-core:1.10.19'
testImplementation 'io.mockk:mockk:1.12.3'
Expand Down
4 changes: 4 additions & 0 deletions packages/expo-manifests/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unpublished

### 📚 3rd party library updates

- Updated `junit` to `4.13.2`. ([#22395](https://github.com/expo/expo/pull/22395) by [@josephyanks](https://github.com/josephyanks))

### 🛠 Breaking changes

### 🎉 New features
Expand Down
2 changes: 1 addition & 1 deletion packages/expo-manifests/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ android {
dependencies {
implementation project(':expo-json-utils')

testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13.2'
testImplementation 'androidx.test:core:1.4.0'
testImplementation 'org.mockito:mockito-core:1.10.19'
testImplementation 'io.mockk:mockk:1.12.3'
Expand Down
4 changes: 4 additions & 0 deletions packages/expo-media-library/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unpublished

### 📚 3rd party library updates

- Updated `robolectric` to `4.10`. ([#22395](https://github.com/expo/expo/pull/22395) by [@josephyanks](https://github.com/josephyanks))

### 🛠 Breaking changes

### 🎉 New features
Expand Down
2 changes: 1 addition & 1 deletion packages/expo-media-library/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,5 @@ dependencies {
if (project.findProject(':expo-modules-test-core')) {
testImplementation project(':expo-modules-test-core')
}
testImplementation "org.robolectric:robolectric:4.3.1"
testImplementation "org.robolectric:robolectric:4.10"
}
4 changes: 4 additions & 0 deletions packages/expo-modules-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unpublished

### 📚 3rd party library updates

- Updated `robolectric` to `4.10` and `junit` to `4.13.2`. ([#22395](https://github.com/expo/expo/pull/22395) by [@josephyanks](https://github.com/josephyanks))

### 🛠 Breaking changes

### 🎉 New features
Expand Down
4 changes: 2 additions & 2 deletions packages/expo-modules-core/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,10 @@ dependencies {
compileOnly 'com.facebook.fbjni:fbjni:0.3.0'

testImplementation 'androidx.test:core:1.4.0'
testImplementation 'junit:junit:4.13.1'
testImplementation 'junit:junit:4.13.2'
testImplementation 'io.mockk:mockk:1.12.3'
testImplementation "com.google.truth:truth:1.1.2"
testImplementation "org.robolectric:robolectric:4.5.1"
testImplementation "org.robolectric:robolectric:4.10"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.0"

androidTestImplementation 'androidx.test:runner:1.4.0'
Expand Down
8 changes: 4 additions & 4 deletions packages/expo-modules-test-core/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ repositories {

dependencies {
implementation project(':expo-modules-core')
api 'androidx.test:core:1.4.0'
api 'junit:junit:4.13.1'
api 'io.mockk:mockk:1.12.0'
api "org.robolectric:robolectric:4.5.1"
api 'androidx.test:core:1.5.0'
api 'junit:junit:4.13.2'
api 'io.mockk:mockk:1.13.5'
api "org.robolectric:robolectric:4.10"

//noinspection GradleDynamicVersion
implementation 'com.facebook.react:react-native:+'
Expand Down
4 changes: 4 additions & 0 deletions packages/expo-sms/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unpublished

### 📚 3rd party library updates

- Updated `robolectric` to `4.10` and `junit` to `4.13.2`. ([#22395](https://github.com/expo/expo/pull/22395) by [@josephyanks](https://github.com/josephyanks))

### 🛠 Breaking changes

### 🎉 New features
Expand Down
4 changes: 2 additions & 2 deletions packages/expo-sms/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,6 @@ dependencies {
if (project.findProject(':expo-modules-test-core')) {
testImplementation project(':expo-modules-test-core')
}
testImplementation "org.robolectric:robolectric:4.5.1"
testImplementation 'junit:junit:4.12'
testImplementation "org.robolectric:robolectric:4.10"
testImplementation 'junit:junit:4.13.2'
}
4 changes: 4 additions & 0 deletions packages/expo-structured-headers/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unpublished

### 📚 3rd party library updates

- Updated `junit` to `4.13.2`. ([#22395](https://github.com/expo/expo/pull/22395) by [@josephyanks](https://github.com/josephyanks))

### 🛠 Breaking changes

### 🎉 New features
Expand Down
2 changes: 1 addition & 1 deletion packages/expo-structured-headers/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
implementation "androidx.appcompat:appcompat:1.2.0"

testImplementation 'junit:junit:4.13.1'
testImplementation 'junit:junit:4.13.2'
testImplementation 'commons-codec:commons-codec:1.14'
testImplementation 'org.apache.johnzon:johnzon-core:1.2.5'
testImplementation 'org.apache.geronimo.specs:geronimo-json_1.1_spec:1.4'
Expand Down
4 changes: 4 additions & 0 deletions packages/expo-updates/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unpublished

### 📚 3rd party library updates

- Updated `junit` to `4.13.2`. ([#22395](https://github.com/expo/expo/pull/22395) by [@josephyanks](https://github.com/josephyanks))

### 🛠 Breaking changes

### 🎉 New features
Expand Down
2 changes: 1 addition & 1 deletion packages/expo-updates/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ dependencies {
implementation("org.apache.commons:commons-lang3:3.9")
implementation("org.bouncycastle:bcutil-jdk15to18:1.70")

testImplementation 'junit:junit:4.13.1'
testImplementation 'junit:junit:4.13.2'
testImplementation 'androidx.test:core:1.4.0'
testImplementation 'io.mockk:mockk:1.12.3'
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:${getKotlinVersion()}"
Expand Down
4 changes: 4 additions & 0 deletions packages/expo-web-browser/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unpublished

### 📚 3rd party library updates

- Updated `robolectric` to `4.10`. ([#22395](https://github.com/expo/expo/pull/22395) by [@josephyanks](https://github.com/josephyanks))

### 🛠 Breaking changes

### 🎉 New features
Expand Down
2 changes: 1 addition & 1 deletion packages/expo-web-browser/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,5 @@ dependencies {
if (project.findProject(':expo-modules-test-core')) {
testImplementation project(':expo-modules-test-core')
}
testImplementation "org.robolectric:robolectric:4.3.1"
testImplementation "org.robolectric:robolectric:4.10"
}
Loading

0 comments on commit d0cf89c

Please sign in to comment.