Skip to content

Commit 78ea211

Browse files
committed
test: starting with 0.80, JSC is no longer available
1 parent e7dd6fa commit 78ea211

3 files changed

Lines changed: 31 additions & 24 deletions

File tree

example/test/specs/app.spec.mjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @ts-check
2-
import { equal } from "node:assert/strict";
2+
import { equal, match } from "node:assert/strict";
33
import { after, before, describe, it } from "node:test";
44
import { remote } from "webdriverio";
55
import { findNearest, readTextFile } from "../../../scripts/helpers.js";
@@ -103,8 +103,9 @@ describe("App", () => {
103103
const reactNative = await client.$(byId("react-native-value"));
104104
equal(await reactNative.getText(), reactNativeVersion);
105105

106-
const hermes = await client.$(byId("hermes-value"));
107-
equal(await hermes.getText(), getCapability("react:hermes"));
106+
const jsEngine = await client.$(byId("js-engine-value"));
107+
const isHermes = config.capabilities["react:hermes"];
108+
match(await jsEngine.getText(), isHermes ? /^Hermes/ : /^JSC$/);
108109

109110
const fabric = await client.$(byId("fabric-value"));
110111
equal(await fabric.getText(), getCapability("react:fabric"));

scripts/testing/test-matrix.mts

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,22 @@ import { spawn, spawnSync } from "node:child_process";
66
import * as fs from "node:fs";
77
import { URL, fileURLToPath } from "node:url";
88
import * as util from "node:util";
9-
import { readTextFile } from "../helpers.js";
9+
import { readTextFile, toVersionNumber, v } from "../helpers.js";
1010
import { setReactVersion } from "../internal/set-react-version.mts";
11-
import type { BuildConfig, TargetPlatform } from "../types.js";
1211
import { green, red, yellow } from "../utils/colors.mjs";
1312
import { getIOSSimulatorName, installPods } from "./test-apple.mts";
1413
import { $, $$, test } from "./test-e2e.mts";
1514

15+
type ApplePlatform = "ios" | "macos" | "visionos";
16+
type TargetPlatform = ApplePlatform | "android" | "windows";
17+
18+
type BuildConfig = {
19+
version: string;
20+
platform: TargetPlatform;
21+
variant: "fabric" | "paper";
22+
engine?: "hermes" | "jsc";
23+
};
24+
1625
type PlatformConfig = {
1726
name: string;
1827
engines: ReadonlyArray<"hermes" | "jsc">;
@@ -43,7 +52,17 @@ const PLATFORM_CONFIG: Record<TargetPlatform, PlatformConfig> = {
4352
ios: {
4453
name: "iOS",
4554
engines: ["jsc", "hermes"],
46-
isAvailable: () => process.platform === "darwin",
55+
isAvailable: ({ version, engine }) => {
56+
if (process.platform !== "darwin") {
57+
return false;
58+
}
59+
60+
if (engine === "jsc" && toVersionNumber(version) >= v(0, 80, 0)) {
61+
return false;
62+
}
63+
64+
return true;
65+
},
4766
prebuild: installPods,
4867
},
4968
macos: {
@@ -203,15 +222,15 @@ function buildAndRun(platform: TargetPlatform) {
203222
}
204223
}
205224

206-
async function buildRunTest({ platform, variant }: BuildConfig) {
225+
async function buildRunTest({ version, platform, variant }: BuildConfig) {
207226
const setup = PLATFORM_CONFIG[platform];
208227
if (!setup) {
209228
log(yellow(`⚠ Unknown platform: ${platform}`));
210229
return;
211230
}
212231

213232
for (const engine of setup.engines) {
214-
const configWithEngine = { platform, variant, engine };
233+
const configWithEngine = { version, platform, variant, engine };
215234
if (!setup.isAvailable(configWithEngine)) {
216235
continue;
217236
}
@@ -285,13 +304,13 @@ if (platforms.length === 0) {
285304
return job.then(() =>
286305
withReactNativeVersion(version, async () => {
287306
for (const platform of platforms) {
288-
await buildRunTest({ platform, variant });
307+
await buildRunTest({ version, platform, variant });
289308
}
290309
})
291310
);
292311
}, prestart())
293312
.then(() => {
294-
showBanner(`Initialize new app`);
313+
showBanner("Initialize new app");
295314
$(
296315
PACKAGE_MANAGER,
297316
"init-test-app",
@@ -306,7 +325,7 @@ if (platforms.length === 0) {
306325
);
307326
})
308327
.then(() => {
309-
showBanner(`Reconfigure existing app`);
328+
showBanner("Reconfigure existing app");
310329
const args = [
311330
"configure-test-app",
312331
"-p",

scripts/types.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -301,16 +301,3 @@ export type Manifest = Partial<{
301301
resolutions: Record<string, string | undefined>;
302302
defaultPlatformPackages: Record<string, PlatformPackage | undefined>;
303303
}>;
304-
305-
/***************************
306-
* testing/test-matrix.mts *
307-
***************************/
308-
309-
export type ApplePlatform = "ios" | "macos" | "visionos";
310-
export type TargetPlatform = ApplePlatform | "android" | "windows";
311-
312-
export type BuildConfig = {
313-
platform: TargetPlatform;
314-
variant: "fabric" | "paper";
315-
engine?: "hermes" | "jsc";
316-
};

0 commit comments

Comments
 (0)