Make robolectric tests run in offline mode (#36510)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36510

This sets up a small offline mirror for Robolectric tests
and allows to run them both on CircleCI and on the internal CI.

allow-large-files

Changelog:
[Internal] [Changed] - Make robolectric tests run in offline mode

Reviewed By: cipolleschi

Differential Revision: D44066692

fbshipit-source-id: 3974d92169ed5c8947f72c953e83a7bf6fadca54
This commit is contained in:
Nicola Corti
2023-03-17 10:26:34 -07:00
committed by Facebook GitHub Bot
parent 5cbabe30d3
commit d904164434
@@ -647,6 +647,17 @@ android {
includeBuildTypeValues('debug', 'release')
}
}
testOptions {
unitTests.all {
// Robolectric tests are downloading JARs at runtime. This allows to specify
// a local file mirror with REACT_NATIVE_ROBOLECTRIC_MIRROR to go in offline more.
if (System.getenv("REACT_NATIVE_ROBOLECTRIC_MIRROR") != null) {
systemProperty 'robolectric.offline', 'true'
systemProperty 'robolectric.dependency.dir', System.getenv("REACT_NATIVE_ROBOLECTRIC_MIRROR")
}
}
}
}
dependencies {