From 46128f49ae4ce1f8fae2155f0d7f67d33f33ad87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 12 Nov 2026 15:31:23 +0000 Subject: [PATCH] test(e2e): don't snapshot react-native's command descriptions and order --- __e2e__/__snapshots__/config.test.ts.snap | 46 +++++++++++------------ __e2e__/config.test.ts | 17 ++++++--- 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/__e2e__/__snapshots__/config.test.ts.snap b/__e2e__/__snapshots__/config.test.ts.snap index ac2afe61b..ead519d1e 100644 --- a/__e2e__/__snapshots__/config.test.ts.snap +++ b/__e2e__/__snapshots__/config.test.ts.snap @@ -37,52 +37,56 @@ exports[`shows up current config without unnecessary output 1`] = ` }, "commands": [ { - "name": "bundle", - "description": "Build the bundle for the provided JavaScript entry file.", + "name": "build-android", + "description": "<>", "options": [ "<>" ] }, { - "name": "start", - "description": "Start the React Native development server.", + "name": "build-ios", + "description": "<>", + "examples": [ + "<>" + ], "options": [ "<>" ] }, { - "name": "codegen", + "name": "bundle", + "description": "<>", "options": [ "<>" ] }, { - "name": "spm [action]", - "description": "Set up or maintain Swift Package Manager support for the iOS/macOS app. Actions: add, update, deinit, scaffold. With no action: add (or update if SPM is already set up).", + "name": "codegen", "options": [ "<>" ] }, + { + "name": "log-android", + "description": "<>" + }, { "name": "log-ios", - "description": "starts iOS device syslog tail", + "description": "<>", "options": [ "<>" ] }, { - "name": "run-ios", - "description": "builds your app and starts it on iOS simulator", - "examples": [ - "<>" - ], + "name": "run-android", + "description": "<>", "options": [ "<>" ] }, { - "name": "build-ios", - "description": "builds your app for iOS platform", + "name": "run-ios", + "description": "<>", "examples": [ "<>" ], @@ -91,19 +95,15 @@ exports[`shows up current config without unnecessary output 1`] = ` ] }, { - "name": "log-android", - "description": "starts logkitty" - }, - { - "name": "run-android", - "description": "builds your app and starts it on a connected Android emulator or device", + "name": "spm [action]", + "description": "<>", "options": [ "<>" ] }, { - "name": "build-android", - "description": "builds your app", + "name": "start", + "description": "<>", "options": [ "<>" ] diff --git a/__e2e__/config.test.ts b/__e2e__/config.test.ts index afc126b09..866c2599b 100644 --- a/__e2e__/config.test.ts +++ b/__e2e__/config.test.ts @@ -63,12 +63,17 @@ afterAll(() => { test('shows up current config without unnecessary output', () => { const {stdout} = runCLI(path.join(DIR, 'TestProject'), ['config']); const parsedStdout = JSON.parse(stdout); - // Strip unnecessary parts - parsedStdout.commands = parsedStdout.commands.map((command: any) => ({ - ...command, - examples: command.examples && ['<>'], - options: command.options && ['<>'], - })); + // Strip unnecessary parts. Commands also come from react-native itself, whose + // descriptions and registration order change between releases, so compare + // only the set of command names. + parsedStdout.commands = parsedStdout.commands + .map((command: any) => ({ + ...command, + description: command.description && '<>', + examples: command.examples && ['<>'], + options: command.options && ['<>'], + })) + .sort((a: any, b: any) => a.name.localeCompare(b.name)); expect(parsedStdout.reactNativeVersion).toMatch(/^\d+\.\d+(\.\d+)?$/); parsedStdout.reactNativeVersion = '<>';