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
5 changes: 5 additions & 0 deletions .nx/version-plans/version-plan-1769158802692.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
__default__: prerelease
---

Added `forwardClientLogs` option to forward React Native logs to terminal during tests
6 changes: 3 additions & 3 deletions actions/shared/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3995,7 +3995,7 @@ ZodNaN.create = (params) => {
...processCreateParams(params)
});
};
var BRAND = Symbol("zod_brand");
var BRAND = /* @__PURE__ */ Symbol("zod_brand");
var ZodBranded = class extends ZodType {
_parse(input) {
const { ctx } = this._processInputParams(input);
Expand Down Expand Up @@ -4231,6 +4231,7 @@ var ConfigSchema = external_exports.object({
coverage: external_exports.object({
root: external_exports.string().optional().describe(`Root directory for coverage instrumentation in monorepo setups. Specifies the directory from which coverage data should be collected. Use ".." for create-react-native-library projects where tests run from example/ but source files are in parent directory. Passed to babel-plugin-istanbul's cwd option.`)
}).optional(),
forwardClientLogs: external_exports.boolean().optional().default(false).describe("Enable forwarding of console.log, console.warn, console.error, and other console method calls from the React Native app to the terminal. When enabled, all console output from your app will be displayed in the test runner terminal with styled level indicators (log, warn, error)."),
// Deprecated property - used for migration detection
include: external_exports.array(external_exports.string()).optional()
}).refine((config) => {
Expand Down Expand Up @@ -4262,7 +4263,6 @@ var et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`, "y");
var At = ["up", "down", "left", "right", "space", "enter", "cancel"];
var _ = { actions: new Set(At), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true };
var bt = globalThis.process.platform.startsWith("win");
var z = Symbol("clack:cancel");

// ../../node_modules/@clack/prompts/dist/index.mjs
var import_picocolors = __toESM(require_picocolors(), 1);
Expand All @@ -4289,7 +4289,7 @@ var Y = w("\u25CF", ">");
var K = w("\u25CB", " ");
var te = w("\u25FB", "[\u2022]");
var k2 = w("\u25FC", "[+]");
var z2 = w("\u25FB", "[ ]");
var z = w("\u25FB", "[ ]");
var Pe = w("\u25AA", "\u2022");
var se = w("\u2500", "-");
var he = w("\u256E", "+");
Expand Down
40 changes: 33 additions & 7 deletions apps/playground/rn-harness.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,34 @@ export default {

runners: [
androidPlatform({
name: 'pixel_8_api_33',
device: androidEmulator('Pixel_8_API_33'),
bundleId: 'com.example',
name: 'android',
device: androidEmulator('Pixel_8_API_35', {
apiLevel: 35,
profile: 'pixel_6',
diskSize: '1G',
heapSize: '1G',
}),
bundleId: 'com.harnessplayground',
}),
androidPlatform({
name: 'moto-g72',
device: physicalAndroidDevice('Motorola', 'Moto G72'),
bundleId: 'com.harnessplayground',
}),
applePlatform({
name: 'iphone-16-pro',
device: applePhysicalDevice('iPhone (Szymon) (2)'),
bundleId: 'react-native-harness',
}),
applePlatform({
name: 'iphone-16-pro-max',
device: appleSimulator('iPhone 16 Pro Max', '26.0'),
bundleId: 'com.example',
name: 'ios',
device: appleSimulator('iPhone 16 Pro', '18.6'),
bundleId: 'com.harnessplayground',
}),
vegaPlatform({
name: 'vega',
device: vegaEmulator('VegaTV_1'),
bundleId: 'com.playground',
}),
webPlatform({
name: 'web',
Expand All @@ -42,5 +62,11 @@ export default {
browser: chromium('http://localhost:8081/index.html', { headless: true }),
}),
],
defaultRunner: 'pixel_8_api_33',
defaultRunner: 'android',
bridgeTimeout: 120000,
webSocketPort: 3002,

resetEnvironmentBetweenTestFiles: true,
unstable__skipAlreadyIncludedModules: false,
forwardClientLogs: true,
};
5 changes: 5 additions & 0 deletions packages/bundler-metro/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ export type ReportableEvent =
| MetroReportableEvent
| {
type: 'initialize_done';
}
| {
type: 'client_log';
level: 'trace' | 'info' | 'warn' | 'log' | 'group' | 'groupCollapsed' | 'groupEnd' | 'debug' | 'error';
data: unknown[];
};

export type Reporter = EventEmitter<ReportableEvent>;
Expand Down
9 changes: 9 additions & 0 deletions packages/config/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ export const ConfigSchema = z
})
.optional(),

forwardClientLogs: z
.boolean()
.optional()
.default(false)
.describe(
'Enable forwarding of console.log, console.warn, console.error, and other console method calls from the React Native app to the terminal. ' +
'When enabled, all console output from your app will be displayed in the test runner terminal with styled level indicators (log, warn, error).'
),

// Deprecated property - used for migration detection
include: z.array(z.string()).optional(),
})
Expand Down
7 changes: 5 additions & 2 deletions packages/jest/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ export default [
'@nx/dependency-checks': [
'error',
{
ignoredFiles: ['{projectRoot}/eslint.config.{js,cjs,mjs,ts,cts,mts}'],
ignoredFiles: [
'{projectRoot}/eslint.config.{js,cjs,mjs,ts,cts,mts}',
'{projectRoot}/vite.config.{js,cjs,mjs,ts,cts,mts}',
],
// jest-runner: we only ingest types
ignoredDependencies: ['@react-native-harness/cli', 'jest-runner'],
ignoredDependencies: ['@react-native-harness/cli', 'jest-runner', 'vitest'],
},
],
},
Expand Down
Loading