-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathrun-tests.ts
More file actions
48 lines (41 loc) · 1.05 KB
/
run-tests.ts
File metadata and controls
48 lines (41 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import assert from "node:assert/strict";
import path from "node:path";
import { spawn, SpawnFailure } from "bufout";
// Ideally, we would just use "concurrently" or "npm-run-all" to run these in parallel but:
// - "concurrently" hangs the emulator action on Ubuntu
// - "npm-run-all" shows symptoms of not closing metro when Mocha Remote sends a SIGTERM
const platform = process.argv[2];
assert(
platform === "android" || platform === "ios",
"Platform must be 'android' or 'ios'"
);
const cwd = path.resolve(__dirname, "..");
const env = {
...process.env,
FORCE_COLOR: "1",
};
const metro = spawn("react-native", ["start", "--no-interactive"], {
cwd,
stdio: "inherit",
outputPrefix: "[metro] ",
env,
});
const build = spawn(
"react-native",
[
`run-${platform}`,
"--no-packager",
...(platform === "android" ? ["--active-arch-only"] : []),
],
{
cwd,
stdio: "inherit",
outputPrefix: `[${platform}] `,
env,
}
);
Promise.all([metro, build]).catch((err) => {
if (!(err instanceof SpawnFailure)) {
throw err;
}
});