Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions example/test/specs/app.spec.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @ts-check
import { equal } from "node:assert/strict";
import { equal, match } from "node:assert/strict";
import { after, before, describe, it } from "node:test";
import { remote } from "webdriverio";
import { findNearest, readTextFile } from "../../../scripts/helpers.js";
Expand Down Expand Up @@ -103,8 +103,9 @@ describe("App", () => {
const reactNative = await client.$(byId("react-native-value"));
equal(await reactNative.getText(), reactNativeVersion);

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

const fabric = await client.$(byId("fabric-value"));
equal(await fabric.getText(), getCapability("react:fabric"));
Expand Down
24 changes: 17 additions & 7 deletions scripts/testing/test-matrix.mts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { spawn, spawnSync } from "node:child_process";
import * as fs from "node:fs";
import { URL, fileURLToPath } from "node:url";
import * as util from "node:util";
import { readTextFile } from "../helpers.js";
import { readTextFile, toVersionNumber, v } from "../helpers.js";
import { setReactVersion } from "../internal/set-react-version.mts";
import type { BuildConfig, TargetPlatform } from "../types.js";
import { green, red, yellow } from "../utils/colors.mjs";
Expand Down Expand Up @@ -43,7 +43,17 @@ const PLATFORM_CONFIG: Record<TargetPlatform, PlatformConfig> = {
ios: {
name: "iOS",
engines: ["jsc", "hermes"],
isAvailable: () => process.platform === "darwin",
isAvailable: ({ version, engine }) => {
if (process.platform !== "darwin") {
return false;
}

if (engine === "jsc" && toVersionNumber(version) >= v(0, 80, 0)) {
return false;
}

return true;
},
prebuild: installPods,
},
macos: {
Expand Down Expand Up @@ -203,15 +213,15 @@ function buildAndRun(platform: TargetPlatform) {
}
}

async function buildRunTest({ platform, variant }: BuildConfig) {
async function buildRunTest({ version, platform, variant }: BuildConfig) {
const setup = PLATFORM_CONFIG[platform];
if (!setup) {
log(yellow(`⚠ Unknown platform: ${platform}`));
return;
}

for (const engine of setup.engines) {
const configWithEngine = { platform, variant, engine };
const configWithEngine = { version, platform, variant, engine };
if (!setup.isAvailable(configWithEngine)) {
continue;
}
Expand Down Expand Up @@ -285,13 +295,13 @@ if (platforms.length === 0) {
return job.then(() =>
withReactNativeVersion(version, async () => {
for (const platform of platforms) {
await buildRunTest({ platform, variant });
await buildRunTest({ version, platform, variant });
}
})
);
}, prestart())
.then(() => {
showBanner(`Initialize new app`);
showBanner("Initialize new app");
$(
PACKAGE_MANAGER,
"init-test-app",
Expand All @@ -306,7 +316,7 @@ if (platforms.length === 0) {
);
})
.then(() => {
showBanner(`Reconfigure existing app`);
showBanner("Reconfigure existing app");
const args = [
"configure-test-app",
"-p",
Expand Down
1 change: 1 addition & 0 deletions scripts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ export type ApplePlatform = "ios" | "macos" | "visionos";
export type TargetPlatform = ApplePlatform | "android" | "windows";

export type BuildConfig = {
version: string;
platform: TargetPlatform;
variant: "fabric" | "paper";
engine?: "hermes" | "jsc";
Expand Down