Skip to content

Commit 1949f8f

Browse files
authored
test: starting with 0.80, JSC is no longer available (#2470)
1 parent e7dd6fa commit 1949f8f

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

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: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ 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";
1111
import type { BuildConfig, TargetPlatform } from "../types.js";
1212
import { green, red, yellow } from "../utils/colors.mjs";
@@ -43,7 +43,17 @@ const PLATFORM_CONFIG: Record<TargetPlatform, PlatformConfig> = {
4343
ios: {
4444
name: "iOS",
4545
engines: ["jsc", "hermes"],
46-
isAvailable: () => process.platform === "darwin",
46+
isAvailable: ({ version, engine }) => {
47+
if (process.platform !== "darwin") {
48+
return false;
49+
}
50+
51+
if (engine === "jsc" && toVersionNumber(version) >= v(0, 80, 0)) {
52+
return false;
53+
}
54+
55+
return true;
56+
},
4757
prebuild: installPods,
4858
},
4959
macos: {
@@ -203,15 +213,15 @@ function buildAndRun(platform: TargetPlatform) {
203213
}
204214
}
205215

206-
async function buildRunTest({ platform, variant }: BuildConfig) {
216+
async function buildRunTest({ version, platform, variant }: BuildConfig) {
207217
const setup = PLATFORM_CONFIG[platform];
208218
if (!setup) {
209219
log(yellow(`⚠ Unknown platform: ${platform}`));
210220
return;
211221
}
212222

213223
for (const engine of setup.engines) {
214-
const configWithEngine = { platform, variant, engine };
224+
const configWithEngine = { version, platform, variant, engine };
215225
if (!setup.isAvailable(configWithEngine)) {
216226
continue;
217227
}
@@ -285,13 +295,13 @@ if (platforms.length === 0) {
285295
return job.then(() =>
286296
withReactNativeVersion(version, async () => {
287297
for (const platform of platforms) {
288-
await buildRunTest({ platform, variant });
298+
await buildRunTest({ version, platform, variant });
289299
}
290300
})
291301
);
292302
}, prestart())
293303
.then(() => {
294-
showBanner(`Initialize new app`);
304+
showBanner("Initialize new app");
295305
$(
296306
PACKAGE_MANAGER,
297307
"init-test-app",
@@ -306,7 +316,7 @@ if (platforms.length === 0) {
306316
);
307317
})
308318
.then(() => {
309-
showBanner(`Reconfigure existing app`);
319+
showBanner("Reconfigure existing app");
310320
const args = [
311321
"configure-test-app",
312322
"-p",

scripts/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ export type ApplePlatform = "ios" | "macos" | "visionos";
310310
export type TargetPlatform = ApplePlatform | "android" | "windows";
311311

312312
export type BuildConfig = {
313+
version: string;
313314
platform: TargetPlatform;
314315
variant: "fabric" | "paper";
315316
engine?: "hermes" | "jsc";

0 commit comments

Comments
 (0)