Skip to content

Commit e9cad01

Browse files
committed
build: automate platform-specific script choice for build/test
1 parent 9866852 commit e9cad01

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

CONTRIBUTING.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,10 @@ The project has a Detox powered end-to-end testing app located in `/tests`.
121121
To run end-to-end tests for `Android`, please run:
122122

123123
- `yarn tests:android:build` - builds `Android` test application.
124-
- Note: for Windows you will need `yarn tests:android:build:windows`
125124
- `yarn tests:packager:jet-reset-cache` - runs JavaScript bundler.
126125
- `yarn tests:emulator:start` - runs Firestore emulator for Firestore tests.
127126
- Note: for Windows you will need `yarn tests:emulator:start:windows`
128127
- `yarn tests:android:test` - runs tests using Detox library. Tests for each package can be found in the `e2e` directory (i.e. `[PACKAGE]/e2e/*.e2e.js`)
129-
- Note: for Windows you will need `yarn tests:android:test:windows`
130128

131129
To run end-to-end tests for `iOS`, please run:
132130

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@
2727
"tests:packager:jet-ci": "cd tests && (mkdir $HOME/.metro || true) && cross-env TMPDIR=$HOME/.metro REACT_DEBUGGER=\"echo nope\" yarn react-native start",
2828
"tests:packager:jet-reset-cache": "cd tests && cross-env REACT_DEBUGGER=\"echo nope\" yarn react-native start --reset-cache",
2929
"tests:emulator:prepare": "cd .github/workflows/scripts/functions && yarn && yarn build",
30-
"tests:emulator:start": "yarn tests:emulator:prepare && cd ./.github/workflows/scripts && ./start-firebase-emulator.sh --no-daemon",
30+
"tests:emulator:start": "run-script-os",
31+
"tests:emulator:start:default": "yarn tests:emulator:prepare && cd ./.github/workflows/scripts && ./start-firebase-emulator.sh --no-daemon",
3132
"tests:emulator:start:windows": "yarn tests:emulator:prepare && cd ./.github/workflows/scripts && ./start-firebase-emulator.bat --no-daemon",
3233
"tests:emulator:start-ci": "yarn tests:emulator:prepare && cd ./.github/workflows/scripts && ./start-firebase-emulator.sh",
33-
"tests:android:build": "cd tests && yarn detox build --configuration android.emu.debug",
34+
"tests:android:build": "run-script-os",
35+
"tests:android:build:default": "cd tests && yarn detox build --configuration android.emu.debug",
3436
"tests:android:build:windows": "cd tests && yarn detox build --configuration android.emu.debug.windows",
3537
"tests:android:build:release": "cd tests && yarn detox build --configuration android.emu.release",
3638
"tests:android:test": "cd tests && yarn detox test --configuration android.emu.debug",
37-
"tests:android:test:windows": "cd tests && yarn detox test --configuration android.emu.debug",
3839
"tests:android:test:debug": "cd tests && yarn detox test --configuration android.emu.debug --inspect",
3940
"tests:android:test-reuse": "cd tests && yarn detox test --configuration android.emu.debug --reuse",
4041
"tests:android:test-cover": "cd tests && yarn detox test --configuration android.emu.debug --loglevel verbose",
@@ -93,6 +94,7 @@
9394
"prettier": "^3.6.2",
9495
"regenerator-transform": "^0.15.2",
9596
"rimraf": "^6.0.1",
97+
"run-script-os": "^1.1.6",
9698
"shelljs": "^0.10.0",
9799
"spellchecker-cli": "^7.0.0",
98100
"ts-jest": "^29.4.1",

tests/.detoxrc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ module.exports = {
2525
'android.debug': {
2626
type: 'android.apk',
2727
binaryPath: 'android/app/build/outputs/apk/debug/app-debug.apk',
28+
// keep in sync with android.debug.windows below, except gradlew vs gradlew.bat
2829
build:
2930
'cd android && ./gradlew assembleDebug assembleAndroidTest lintDebug -DtestBuildType=debug --warning-mode all && cd ..',
3031
reversePorts: [8080, 8081, 8090, 9000, 9099, 9199],
3132
},
3233
'android.debug.windows': {
3334
type: 'android.apk',
3435
binaryPath: 'android/app/build/outputs/apk/debug/app-debug.apk',
36+
// android.debug.windows only exists to use .bat script vs shell here:
3537
build:
3638
'cd android && .\\gradlew.bat assembleDebug assembleAndroidTest lintDebug -DtestBuildType=debug --warning-mode all && cd ..',
3739
reversePorts: [8080, 8081, 8090, 9000, 9099, 9199],

yarn.lock

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19997,6 +19997,7 @@ __metadata:
1999719997
prettier: "npm:^3.6.2"
1999819998
regenerator-transform: "npm:^0.15.2"
1999919999
rimraf: "npm:^6.0.1"
20000+
run-script-os: "npm:^1.1.6"
2000020001
shelljs: "npm:^0.10.0"
2000120002
spellchecker-cli: "npm:^7.0.0"
2000220003
ts-jest: "npm:^29.4.1"
@@ -21086,6 +21087,16 @@ __metadata:
2108621087
languageName: node
2108721088
linkType: hard
2108821089

21090+
"run-script-os@npm:^1.1.6":
21091+
version: 1.1.6
21092+
resolution: "run-script-os@npm:1.1.6"
21093+
bin:
21094+
run-os: index.js
21095+
run-script-os: index.js
21096+
checksum: 10/b6c478ebb7aff9914eb5b9aa2aec54ea81a3a210b0dfd0fb0f4e37cd4a802fcc1dd2cd134301713fcdc4e2cf783052c0a2194da8e96e0d4aad9d4fb9317da5b5
21097+
languageName: node
21098+
linkType: hard
21099+
2108921100
"rxjs@npm:^7.5.5":
2109021101
version: 7.8.1
2109121102
resolution: "rxjs@npm:7.8.1"

0 commit comments

Comments
 (0)