-
Notifications
You must be signed in to change notification settings - Fork 5
Add Expo tests #618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Expo tests #618
Conversation
It doesn't work on Expo and isn't really used much anyway
Browser bundle sizeNPM build
CDN build
Code coverageCoverage values did not change👌. Total:
Generated against e5597f0 on 13 May 2025 at 11:40:24 UTC |
|
||
export default function HomeScreen() { | ||
|
||
const [currentScenario, setCurrentScenario] = useState<any>(null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we set just the scenario name here and select the component dynamically? I think this is probably quite a lot of information to store in state
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's true - we certainly could, I just decided not to because it makes the withInstrumentedAppStarts
scenario a more awkward to deal with - that component needs to be wrapped so we'd need to do that in each of the index.js files instead.
As it's just a test app and we only set that state once when we start the scenario I don't think it matters too much?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could it work with something like:
import scenarios from '../scenario-launcher/scenarios'
const [currentScenario, setCurrentScenario] = useState('ExpoScenario')
currentScenario && <scenarios[currentScenario].Component />
88998bd
to
9155ffe
Compare
9155ffe
to
d60782d
Compare
import React, { useContext } from 'react' | ||
import { ScenarioContext } from './ScenarioContext' | ||
import * as Scenarios from '../scenarios' | ||
import BugsnagPerformance from '@bugsnag/react-native-performance' | ||
|
||
export const ScenarioComponent = () => { | ||
const scenarioContext = useContext(ScenarioContext) | ||
|
||
if (scenarioContext) { | ||
const scenario = Scenarios[scenarioContext.name] | ||
const Scenario = scenario.withInstrumentedAppStarts ? BugsnagPerformance.withInstrumentedAppStarts(scenario.App) : scenario.App | ||
return <Scenario /> | ||
} | ||
|
||
return null | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌🏻 that'll do it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay - I think I've got this working nicely now.
Updated the RNN test fixture so that it doesn't use the new ScenarioComponent
- instead it passes its own custom setScenario
callback to the scenario launcher to set the current scenario using react-native-navigation. Basically I've moved the loadReactNativeNavigationScenario
logic out of the scenario launcher and into the RNN fixture's index.js file
I think this is cleaner as the scenario launcher now just calls setScenario
in all cases and doesn't have to do any special handling for react-native-navigation. And as an added bonus it also makes it a lot easier to run the RNN fixture locally as it doesn't rely on the environment variable being set at runtime.
0966330
to
ab6dbfb
Compare
ab6dbfb
to
e5597f0
Compare
Goal
Add Expo builds and tests to CI pipeline.
Design
Test fixtures are generated dynamically and tests run (more or less) the same test suite as React Native, against the latest 3 Expo versions (currently 52, 51 and 50).
Had to remove the
react-native-dotenv
dependency from the scenario launcher as this doesn't work on Expo - this was just a convenience tool for running scenarios locally but isn't really necessary.Testing
Covered by CI