-
-
Notifications
You must be signed in to change notification settings - Fork 369
test: add Expo compatibility CI job #1432
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
Draft
grdsdev
wants to merge
10
commits into
next
Choose a base branch
from
guilherme/expo-compatibility-test
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6a9dd6b
test: add Expo compatibility CI job
grdsdev bd455d0
build and pack before running integration tests
grdsdev 5d3e96f
ignore examples on tests
grdsdev c30ca65
run expo test twice
grdsdev 678987f
ignore examples
grdsdev c463521
update expo deps
grdsdev e07e762
increase timeout
grdsdev 7acf4fa
add timeout
grdsdev b63febb
wip
grdsdev e0be4e2
make sure to run expo tests against local supabase
grdsdev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,39 @@ | ||
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files | ||
|
||
# dependencies | ||
node_modules/ | ||
|
||
# Expo | ||
.expo/ | ||
dist/ | ||
web-build/ | ||
expo-env.d.ts | ||
|
||
# Native | ||
.kotlin/ | ||
*.orig.* | ||
*.jks | ||
*.p8 | ||
*.p12 | ||
*.key | ||
*.mobileprovision | ||
|
||
# Metro | ||
.metro-health-check* | ||
|
||
# debug | ||
npm-debug.* | ||
yarn-debug.* | ||
yarn-error.* | ||
|
||
# macOS | ||
.DS_Store | ||
*.pem | ||
|
||
# local env files | ||
.env*.local | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
|
||
app-example |
This file contains hidden or 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,7 @@ | ||
{ | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll": "explicit", | ||
"source.organizeImports": "explicit", | ||
"source.sortMembers": "explicit" | ||
} | ||
} |
This file contains hidden or 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,50 @@ | ||
# Welcome to your Expo app 👋 | ||
|
||
This is an [Expo](https://expo.dev) project created with [`create-expo-app`](https://www.npmjs.com/package/create-expo-app). | ||
|
||
## Get started | ||
|
||
1. Install dependencies | ||
|
||
```bash | ||
npm install | ||
``` | ||
|
||
2. Start the app | ||
|
||
```bash | ||
npx expo start | ||
``` | ||
|
||
In the output, you'll find options to open the app in a | ||
|
||
- [development build](https://docs.expo.dev/develop/development-builds/introduction/) | ||
- [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/) | ||
- [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/) | ||
- [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo | ||
|
||
You can start developing by editing the files inside the **app** directory. This project uses [file-based routing](https://docs.expo.dev/router/introduction). | ||
|
||
## Get a fresh project | ||
|
||
When you're ready, run: | ||
|
||
```bash | ||
npm run reset-project | ||
``` | ||
|
||
This command will move the starter code to the **app-example** directory and create a blank **app** directory where you can start developing. | ||
|
||
## Learn more | ||
|
||
To learn more about developing your project with Expo, look at the following resources: | ||
|
||
- [Expo documentation](https://docs.expo.dev/): Learn fundamentals, or go into advanced topics with our [guides](https://docs.expo.dev/guides). | ||
- [Learn Expo tutorial](https://docs.expo.dev/tutorial/introduction/): Follow a step-by-step tutorial where you'll create a project that runs on Android, iOS, and the web. | ||
|
||
## Join the community | ||
|
||
Join our community of developers creating universal apps. | ||
|
||
- [Expo on GitHub](https://github.com/expo/expo): View our open source platform and contribute. | ||
- [Discord community](https://chat.expo.dev): Chat with Expo users and ask questions. |
This file contains hidden or 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,36 @@ | ||
import { render, waitFor, cleanup } from '@testing-library/react-native' | ||
import Index from '../app/index.tsx' | ||
|
||
describe('Index', () => { | ||
afterEach(() => { | ||
cleanup() | ||
}) | ||
|
||
it('should display SUBSCRIBED status when realtime connection is established', async () => { | ||
const { getByTestId, unmount } = render(<Index />) | ||
|
||
// Initially, the text should be empty | ||
expect(getByTestId('realtime_status')).toHaveTextContent('') | ||
|
||
// Wait for the subscription status to be updated | ||
await waitFor( | ||
() => { | ||
const status = getByTestId('realtime_status').props.children | ||
expect(status).toBe('SUBSCRIBED') | ||
}, | ||
{ | ||
timeout: 30000, // 30 seconds timeout for waitFor | ||
interval: 1000, // Check every second | ||
onTimeout: (error) => { | ||
const currentStatus = getByTestId('realtime_status').props.children | ||
throw new Error( | ||
`Timeout waiting for SUBSCRIBED status. Current status: ${currentStatus}. ${error.message}` | ||
) | ||
}, | ||
} | ||
) | ||
|
||
// Unmount the component to trigger cleanup. | ||
unmount() | ||
}, 35000) // 35 seconds timeout for the entire test | ||
}) |
This file contains hidden or 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,42 @@ | ||
{ | ||
"expo": { | ||
"name": "expo-app", | ||
"slug": "expo-app", | ||
"version": "1.0.0", | ||
"orientation": "portrait", | ||
"icon": "./assets/images/icon.png", | ||
"scheme": "expoapp", | ||
"userInterfaceStyle": "automatic", | ||
"newArchEnabled": true, | ||
"ios": { | ||
"supportsTablet": true | ||
}, | ||
"android": { | ||
"adaptiveIcon": { | ||
"foregroundImage": "./assets/images/adaptive-icon.png", | ||
"backgroundColor": "#ffffff" | ||
}, | ||
"edgeToEdgeEnabled": true | ||
}, | ||
"web": { | ||
"bundler": "metro", | ||
"output": "static", | ||
"favicon": "./assets/images/favicon.png" | ||
}, | ||
"plugins": [ | ||
"expo-router", | ||
[ | ||
"expo-splash-screen", | ||
{ | ||
"image": "./assets/images/splash-icon.png", | ||
"imageWidth": 200, | ||
"resizeMode": "contain", | ||
"backgroundColor": "#ffffff" | ||
} | ||
] | ||
], | ||
"experiments": { | ||
"typedRoutes": true | ||
} | ||
} | ||
} |
This file contains hidden or 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,5 @@ | ||
import { Stack } from 'expo-router' | ||
|
||
export default function RootLayout() { | ||
return <Stack /> | ||
} |
This file contains hidden or 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,40 @@ | ||
import { Text, View } from 'react-native' | ||
import { useState, useEffect } from 'react' | ||
import { createClient } from '@supabase/supabase-js' | ||
|
||
const SUPABASE_URL = 'http://127.0.0.1:54321' | ||
const ANON_KEY = | ||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0' | ||
|
||
const supabase = createClient(SUPABASE_URL, ANON_KEY) | ||
|
||
export default function Index() { | ||
const [realtimeStatus, setRealtimeStatus] = useState<string | null>(null) | ||
const channel = supabase.channel('realtime:public:todos') | ||
|
||
useEffect(() => { | ||
if (channel.state === 'closed') { | ||
channel.subscribe((status) => { | ||
if (status === 'SUBSCRIBED') setRealtimeStatus(status) | ||
}) | ||
} | ||
|
||
return () => { | ||
channel.unsubscribe() | ||
supabase.realtime.disconnect() | ||
} | ||
}, []) | ||
|
||
return ( | ||
<View | ||
style={{ | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
backgroundColor: '#fff', | ||
}} | ||
> | ||
<Text testID="realtime_status">{realtimeStatus || ''}</Text> | ||
</View> | ||
) | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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,10 @@ | ||
// https://docs.expo.dev/guides/using-eslint/ | ||
const { defineConfig } = require('eslint/config') | ||
const expoConfig = require('eslint-config-expo/flat') | ||
|
||
module.exports = defineConfig([ | ||
expoConfig, | ||
{ | ||
ignores: ['dist/*'], | ||
}, | ||
]) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Avoid hardcoding values that are meant to be secret. Found
a hardcoded string
used inhere
.Line 7 | CWE-547 | Priority score 775
Data flow: 2 steps
Step 1 - 2
supabase-js/examples/expo-app/app/index.tsx
Line 7 in 9703aa7