deer social fork for personal usage. but you might see a use idk. github mirror

E2E runner fixes (#2428)

* Fix mock-server run script

* Bump detox

* Replace fetch with node-native api

authored by Paul Frazee and committed by GitHub 34817628 67e70918

Changed files
+126 -12
__e2e__
+24 -3
__e2e__/util.ts
··· 1 1 import {resolveConfig} from 'detox/internals' 2 2 import {execSync} from 'child_process' 3 + import http from 'http' 3 4 4 5 const platform = device.getPlatform() 5 6 ··· 105 106 } 106 107 107 108 export async function createServer(path = '') { 108 - const res = await fetch(`http://localhost:1986/${path}`, {method: 'POST'}) 109 - const resBody = await res.text() 110 - return resBody 109 + return new Promise(function (resolve, reject) { 110 + var req = http.request( 111 + { 112 + method: 'POST', 113 + host: 'localhost', 114 + port: 1986, 115 + path: `/${path}`, 116 + }, 117 + function (res) { 118 + const body: Buffer[] = [] 119 + res.on('data', chunk => body.push(chunk)) 120 + res.on('end', function () { 121 + try { 122 + resolve(Buffer.concat(body).toString()) 123 + } catch (e) { 124 + reject(e) 125 + } 126 + }) 127 + }, 128 + ) 129 + req.on('error', reject) 130 + req.end() 131 + }) 111 132 } 112 133 113 134 const getDeepLinkUrl = (url: string) =>
+2 -2
package.json
··· 23 23 "test-coverage": "NODE_ENV=test jest --coverage", 24 24 "lint": "eslint ./src --ext .js,.jsx,.ts,.tsx", 25 25 "typecheck": "tsc --project ./tsconfig.check.json", 26 - "e2e:mock-server": "./jest/dev-infra/with-test-redis-and-db.sh ts-node __e2e__/mock-server.ts", 26 + "e2e:mock-server": "./jest/dev-infra/with-test-redis-and-db.sh ts-node --project tsconfig.e2e.json __e2e__/mock-server.ts", 27 27 "e2e:metro": "NODE_ENV=test RN_SRC_EXT=e2e.ts,e2e.tsx expo run:ios", 28 28 "e2e:build": "NODE_ENV=test detox build -c ios.sim.debug", 29 29 "e2e:run": "NODE_ENV=test detox test --configuration ios.sim.debug --take-screenshots all", ··· 215 215 "babel-plugin-module-resolver": "^5.0.0", 216 216 "babel-plugin-react-native-web": "^0.18.12", 217 217 "babel-preset-expo": "^10.0.0", 218 - "detox": "^20.13.0", 218 + "detox": "^20.14.8", 219 219 "eslint": "^8.19.0", 220 220 "eslint-plugin-detox": "^1.0.0", 221 221 "eslint-plugin-ft-flow": "^2.0.3",
+46
tsconfig.e2e.json
··· 1 + { 2 + "compilerOptions": { 3 + "target": "esnext", 4 + "module": "commonjs", 5 + "types": ["react-native", "jest"], 6 + "lib": [ 7 + "es2019", 8 + "es2020.bigint", 9 + "es2020.date", 10 + "es2020.number", 11 + "es2020.promise", 12 + "es2020.string", 13 + "es2020.symbol.wellknown", 14 + "es2021.promise", 15 + "es2021.string", 16 + "es2021.weakref", 17 + "es2022.array", 18 + "es2022.object", 19 + "es2022.string" 20 + ], 21 + "allowJs": true, 22 + "jsx": "react-native", 23 + "noEmit": true, 24 + "isolatedModules": true, 25 + "strict": true, 26 + "moduleResolution": "node", 27 + "resolveJsonModule": true, 28 + "allowSyntheticDefaultImports": true, 29 + "forceConsistentCasingInFileNames": false, 30 + "esModuleInterop": true, 31 + "paths": { 32 + "#/*": ["./src/*"], 33 + "lib/*": ["./src/lib/*"], 34 + "platform/*": ["./src/platform/*"], 35 + "state/*": ["./src/state/*"], 36 + "view/*": ["./src/view/*"], 37 + "crypto": ["./src/platform/crypto.ts"] 38 + } 39 + }, 40 + "exclude": [ 41 + "node_modules", 42 + "babel.config.js", 43 + "metro.config.js", 44 + "jest.config.js" 45 + ] 46 + }
+54 -7
yarn.lock
··· 3335 3335 resolved "https://registry.yarnpkg.com/@fastify/deepmerge/-/deepmerge-1.3.0.tgz#8116858108f0c7d9fd460d05a7d637a13fe3239a" 3336 3336 integrity sha512-J8TOSBq3SoZbDhM9+R/u77hP93gz/rajSA+K2kGyijPpORPWUXHUpTaleoj+92As0S9uPRP7Oi8IqMf0u+ro6A== 3337 3337 3338 + "@flatten-js/interval-tree@^1.1.2": 3339 + version "1.1.2" 3340 + resolved "https://registry.yarnpkg.com/@flatten-js/interval-tree/-/interval-tree-1.1.2.tgz#fcc891da48bc230392884be01c26fe8c625702e8" 3341 + integrity sha512-OwLoV9E/XM6b7bes2rSFnGNjyRy7vcoIHFTnmBR2WAaZTf0Fe4EX4GdA65vU1KgFAasti7iRSg2dZfYd1Zt00Q== 3342 + 3338 3343 "@floating-ui/core@^1.4.1": 3339 3344 version "1.4.1" 3340 3345 resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.4.1.tgz#0d633f4b76052668afb932492ac452f7ebe97f17" ··· 8986 8991 resolved "https://registry.yarnpkg.com/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88" 8987 8992 integrity sha512-uYBjakWipfaO/bXI7E8rq6kpwHRZK5cNYrUv2OzZSI/FvmdMyXJ2tG9dKcjEC5YHmHpUAwsargWIZNWdxb/bnQ== 8988 8993 8994 + bunyamin@^1.5.0: 8995 + version "1.5.1" 8996 + resolved "https://registry.yarnpkg.com/bunyamin/-/bunyamin-1.5.1.tgz#14df1b2f0b82d781d8f8d81eb2e83542353ac8d7" 8997 + integrity sha512-VgWWb3G3HwajZF8fFM8TJjkWOqeDBZgzWBeQb7EhKQTQd33Zri0nghLeg4r86kQqqNlo/p9Jjgwh/O7Q6XpZIg== 8998 + dependencies: 8999 + "@flatten-js/interval-tree" "^1.1.2" 9000 + multi-sort-stream "^1.0.4" 9001 + stream-json "^1.7.5" 9002 + trace-event-lib "^1.3.1" 9003 + 8989 9004 bunyan-debug-stream@^3.1.0: 8990 9005 version "3.1.0" 8991 9006 resolved "https://registry.yarnpkg.com/bunyan-debug-stream/-/bunyan-debug-stream-3.1.0.tgz#78309c67ad85cfb8f011155334152c49209dcda8" ··· 8997 9012 version "1.8.15" 8998 9013 resolved "https://registry.yarnpkg.com/bunyan/-/bunyan-1.8.15.tgz#8ce34ca908a17d0776576ca1b2f6cbd916e93b46" 8999 9014 integrity sha512-0tECWShh6wUysgucJcBAoYegf3JJoZWibxdqhTm7OHPeT42qdjkZ29QCMcKwbgU1kiH+auSIasNRXMLWXafXig== 9015 + optionalDependencies: 9016 + dtrace-provider "~0.8" 9017 + moment "^2.19.3" 9018 + mv "~2" 9019 + safe-json-stringify "~1" 9020 + 9021 + bunyan@^2.0.5: 9022 + version "2.0.5" 9023 + resolved "https://registry.yarnpkg.com/bunyan/-/bunyan-2.0.5.tgz#9dd056755220dddd8b5bb9cf76f3d0d766e96e71" 9024 + integrity sha512-Jvl74TdxCN6rSP9W1I6+UOUtwslTDqsSFkDqZlFb/ilaSvQ+bZAnXT/GT97IZ5L+Vph0joPZPhxUyn6FLNmFAA== 9025 + dependencies: 9026 + exeunt "1.1.0" 9000 9027 optionalDependencies: 9001 9028 dtrace-provider "~0.8" 9002 9029 moment "^2.19.3" ··· 10304 10331 address "^1.0.1" 10305 10332 debug "^2.6.0" 10306 10333 10307 - detox@^20.13.0: 10308 - version "20.13.0" 10309 - resolved "https://registry.yarnpkg.com/detox/-/detox-20.13.0.tgz#923111638dfdb16089eea4f07bf4f0b56468d097" 10310 - integrity sha512-p9MUcoHWFTqSDaoaN+/hnJYdzNYqdelUr/sxzy3zLoS/qehnVJv2yG9pYqz/+gKpJaMIpw2+TVw9imdAx5JpaA== 10334 + detox@^20.14.8: 10335 + version "20.14.8" 10336 + resolved "https://registry.yarnpkg.com/detox/-/detox-20.14.8.tgz#0a550cf677fc98a68d56d162e1c5caad317de9ca" 10337 + integrity sha512-3E/0/7Cb7x+wcBsZpCxD8FykZUsFnfVT00d6PWH940boc0Mo1Kzabh+I151X/On4qZMqVdUzgwmap/z8g/kmaw== 10311 10338 dependencies: 10312 10339 ajv "^8.6.3" 10313 10340 bunyan "^1.8.12" ··· 10321 10348 funpermaproxy "^1.1.0" 10322 10349 glob "^8.0.3" 10323 10350 ini "^1.3.4" 10351 + jest-environment-emit "^1.0.5" 10324 10352 json-cycle "^1.3.0" 10325 10353 lodash "^4.17.11" 10326 10354 multi-sort-stream "^1.0.3" ··· 11338 11366 onetime "^5.1.2" 11339 11367 signal-exit "^3.0.3" 11340 11368 strip-final-newline "^2.0.0" 11369 + 11370 + exeunt@1.1.0: 11371 + version "1.1.0" 11372 + resolved "https://registry.yarnpkg.com/exeunt/-/exeunt-1.1.0.tgz#af72db6f94b3cb75e921aee375d513049843d284" 11373 + integrity sha512-dd++Yn/0Fp+gtJ04YHov7MeAii+LFivJc6KqnJNfplzLVUkUDrfKoQDTLlCgzcW15vY5hKlHasWeIsQJ8agHsw== 11341 11374 11342 11375 exit@^0.1.2: 11343 11376 version "0.1.2" ··· 13772 13805 jest-util "^29.7.0" 13773 13806 pretty-format "^29.7.0" 13774 13807 13808 + jest-environment-emit@^1.0.5: 13809 + version "1.0.5" 13810 + resolved "https://registry.yarnpkg.com/jest-environment-emit/-/jest-environment-emit-1.0.5.tgz#e6f33451f98b88ccd48e9e1188bb535880f03c1b" 13811 + integrity sha512-OsQ08AhYxkkyDBTIow+9ogNmJheQIGWQKp0Nku+1ToLWjAj2Pd6LmypN8HgUIqYHs4HFcqkQ25kaf1qExmoZpg== 13812 + dependencies: 13813 + bunyamin "^1.5.0" 13814 + bunyan "^2.0.5" 13815 + bunyan-debug-stream "^3.1.0" 13816 + funpermaproxy "^1.1.0" 13817 + lodash.merge "^4.6.2" 13818 + node-ipc "9.2.1" 13819 + strip-ansi "^6.0.0" 13820 + tslib "^2.5.3" 13821 + 13775 13822 jest-environment-jsdom@^27.5.1: 13776 13823 version "27.5.1" 13777 13824 resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-27.5.1.tgz#ea9ccd1fc610209655a77898f86b2b559516a546" ··· 15868 15915 resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" 15869 15916 integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== 15870 15917 15871 - multi-sort-stream@^1.0.3: 15918 + multi-sort-stream@^1.0.3, multi-sort-stream@^1.0.4: 15872 15919 version "1.0.4" 15873 15920 resolved "https://registry.yarnpkg.com/multi-sort-stream/-/multi-sort-stream-1.0.4.tgz#e4348edc9edc36e16333e531a90c0f166235cc99" 15874 15921 integrity sha512-hAZ8JOEQFbgdLe8HWZbb7gdZg0/yAIHF00Qfo3kd0rXFv96nXe+/bPTrKHZ2QMHugGX4FiAyET1Lt+jiB+7Qlg== ··· 19619 19666 resolved "https://registry.yarnpkg.com/stream-chain/-/stream-chain-2.2.5.tgz#b30967e8f14ee033c5b9a19bbe8a2cba90ba0d09" 19620 19667 integrity sha512-1TJmBx6aSWqZ4tx7aTpBDXK0/e2hhcNSTV8+CbFJtDjbb+I1mZ8lHit0Grw9GRT+6JbIrrDd8esncgBi8aBXGA== 19621 19668 19622 - stream-json@^1.7.4: 19669 + stream-json@^1.7.4, stream-json@^1.7.5: 19623 19670 version "1.8.0" 19624 19671 resolved "https://registry.yarnpkg.com/stream-json/-/stream-json-1.8.0.tgz#53f486b2e3b4496c506131f8d7260ba42def151c" 19625 19672 integrity sha512-HZfXngYHUAr1exT4fxlbc1IOce1RYxp2ldeaf97LYCOPSoOqY/1Psp7iGvpb+6JIOgkra9zDYnPX01hGAHzEPw== ··· 20393 20440 resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" 20394 20441 integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== 20395 20442 20396 - tslib@^2.0.0, tslib@^2.0.1, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.1, tslib@^2.4.0, tslib@^2.4.1, tslib@^2.5.0: 20443 + tslib@^2.0.0, tslib@^2.0.1, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.1, tslib@^2.4.0, tslib@^2.4.1, tslib@^2.5.0, tslib@^2.5.3: 20397 20444 version "2.6.2" 20398 20445 resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" 20399 20446 integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==