-
Notifications
You must be signed in to change notification settings - Fork 577
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Initial commit with RNTA * Updating node_modules paths * Ran an install * Comitting in the Podfile.lock * Adding a tsconfig.json to RNTA environment * Using TS project references in integration tests * Upgrading mocha-remote * Removing the old RN test app * Adding a RNTA environment * Switching PR workflow to use the new app * Adding missing npm scripts * Adding "--" to mocha-remote calls * Avoiding "type": "module" as it breaks node-tests * The new Mocha client injects context into the context, so we need to rename "longTimeout" * Using "*" as range for "realm" and * Upgrading realm-web-integration-tests deps and mocha-remote across * Updating realm-web-integration-tests harness * Adding missing header to config files * Upgrading mocha-remote * Moving bundled Realm into app directory * Building android instead of pod-install * Passing gradle project settings via wireit * Upgrading RN to 0.73.6 * Ensure useDefineForClassFields is disabled when running tests via tsx and mocha * Adding a base-path to fix the "coveralls" GHA invocation * Renamed longTimeout to longTimeoutMs in coverage workflow * Removed the base-path from coveralls action * Apply suggestions from code review Co-authored-by: LJ <81748770+elle-j@users.noreply.github.com> --------- Co-authored-by: LJ <81748770+elle-j@users.noreply.github.com>
- Loading branch information
1 parent
40e4801
commit 4ada449
Showing
96 changed files
with
5,567 additions
and
5,454 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
16 changes: 16 additions & 0 deletions
16
integration-tests/environments/react-native-test-app/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
*.binlog | ||
*.hprof | ||
*.xcworkspace/ | ||
*.zip | ||
.DS_Store | ||
.gradle/ | ||
.idea/ | ||
.vs/ | ||
.xcode.env | ||
Pods/ | ||
build/ | ||
dist/* | ||
!dist/.gitignore | ||
local.properties | ||
msbuild.binlog | ||
node_modules/ |
File renamed without changes.
102 changes: 102 additions & 0 deletions
102
integration-tests/environments/react-native-test-app/App.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
//////////////////////////////////////////////////////////////////////////// | ||
// | ||
// Copyright 2024 Realm Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
//////////////////////////////////////////////////////////////////////////// | ||
import React from "react"; | ||
import { StyleSheet, View, SafeAreaView, StatusBar, Platform } from "react-native"; | ||
|
||
import { MochaRemoteProvider, ConnectionText, StatusEmoji, StatusText, CustomContext } from "mocha-remote-react-native"; | ||
|
||
// Registering an error handler that always throw unhandled exceptions | ||
// This is to enable the remote-mocha-cli to exit on uncaught errors | ||
const originalHandler = ErrorUtils.getGlobalHandler(); | ||
ErrorUtils.setGlobalHandler((err, isFatal) => { | ||
// Calling the original handler to show the error visually too | ||
originalHandler(err, isFatal); | ||
throw err; | ||
}); | ||
|
||
function loadTests(context: CustomContext) { | ||
/* eslint-env mocha */ | ||
// Quick sanity check that "realm" is loadable at all | ||
require("realm"); | ||
/* eslint-disable-next-line no-restricted-globals */ | ||
Object.assign(globalThis, { | ||
fs: require("react-native-fs"), | ||
path: require("path-browserify"), | ||
environment: { | ||
// Default to the host machine when running on Android | ||
baseUrl: Platform.OS === "android" ? "http://10.0.2.2:9090" : undefined, | ||
...context, | ||
// TODO: Incorporate this into the Mocha context instead | ||
reactNative: Platform.OS, | ||
android: Platform.OS === "android", | ||
ios: Platform.OS === "ios", | ||
}, | ||
}); | ||
// Make the tests reinitializable, to allow test running on changes to the "realm" package | ||
// Probing the existance of `getModules` as this only exists in debug mode | ||
// if ("getModules" in require) { | ||
// const modules = require.getModules(); | ||
// for (const [, m] of Object.entries(modules)) { | ||
// if (m.verboseName.startsWith("../../tests/")) { | ||
// m.isInitialized = false; | ||
// } | ||
// } | ||
// } | ||
// Require in the integration tests | ||
require("@realm/integration-tests"); | ||
} | ||
|
||
export default function App() { | ||
return ( | ||
<MochaRemoteProvider tests={loadTests}> | ||
<StatusBar hidden /> | ||
<SafeAreaView style={styles.container}> | ||
<ConnectionText style={styles.connectionText} /> | ||
<View style={styles.statusContainer}> | ||
<StatusEmoji style={styles.statusEmoji} /> | ||
<StatusText style={styles.statusText} /> | ||
</View> | ||
</SafeAreaView> | ||
</MochaRemoteProvider> | ||
); | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
backgroundColor: "#fff", | ||
}, | ||
statusContainer: { | ||
flex: 1, | ||
alignItems: "center", | ||
justifyContent: "center", | ||
}, | ||
statusEmoji: { | ||
fontSize: 30, | ||
margin: 30, | ||
textAlign: "center", | ||
}, | ||
statusText: { | ||
fontSize: 20, | ||
margin: 20, | ||
textAlign: "center", | ||
}, | ||
connectionText: { | ||
textAlign: "center", | ||
}, | ||
}); |
26 changes: 26 additions & 0 deletions
26
integration-tests/environments/react-native-test-app/android/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
buildscript { | ||
def androidTestAppDir = "../../../../node_modules/react-native-test-app/android" | ||
apply(from: "${androidTestAppDir}/dependencies.gradle") | ||
|
||
repositories { | ||
mavenCentral() | ||
google() | ||
} | ||
|
||
dependencies { | ||
getReactNativeDependencies().each { dependency -> | ||
classpath(dependency) | ||
} | ||
} | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
maven { | ||
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm | ||
url("../../../../node_modules/react-native/android") | ||
} | ||
mavenCentral() | ||
google() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+42.4 KB
...ration-tests/environments/react-native-test-app/android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion
2
.../gradle/wrapper/gradle-wrapper.properties → .../gradle/wrapper/gradle-wrapper.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.