From 381245253de9de10e876bc44fa6c5710629c82c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Thu, 26 Nov 2026 03:27:16 -0800 Subject: [PATCH] Clarify Fantom test mode selection Summary: ## Context Running mode-independent tests in both development and optimized configurations adds execution time without covering different logic. Fantom already defaults tests to development mode and benchmarks to optimized mode, but the configuration examples did not explain when overriding those defaults is appropriate. ## Changes - Document that ordinary tests should keep the default development mode unless the tested logic depends on development versus optimized mode. - Reserve `fantom_mode *` for mode-dependent behavior that needs coverage in both configurations. - Explain that benchmarks automatically use optimized mode and do not need an explicit mode pragma. - Keep the introductory configuration example in the default mode and qualify the wildcard example as testing mode-dependent behavior. Changelog: [Internal] Differential Revision: D134283446 --- private/react-native-fantom/__docs__/README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/private/react-native-fantom/__docs__/README.md b/private/react-native-fantom/__docs__/README.md index 29f428dc6f48..40c4b6e6dbe4 100644 --- a/private/react-native-fantom/__docs__/README.md +++ b/private/react-native-fantom/__docs__/README.md @@ -356,13 +356,21 @@ expect(root.getRenderedOutput().toJSX()).toEqual( ### Test configuration +Tests run in development (`dev`) mode by default. Keep this default when the +logic under test does not depend on development versus optimized mode. Do not +add `@fantom_mode opt` or `@fantom_mode *` just for extra coverage. Override the +mode only for mode-dependent logic, and use `@fantom_mode *` when both behaviors +need coverage. + +Benchmarks automatically use optimized (`opt`) mode, so they do not need an +explicit mode pragma. + You can configure certain aspects of the test execution using pragmas in the docblock at the top of the file. E.g.: ```javascript /** * @fantom_flags jsOnlyTestFlag:true - * @fantom_mode opt */ ``` @@ -404,7 +412,8 @@ Setting `@fantom_mode` is mutually exclusive with setting any of For all pragmas, except non-boolean feature flags, you can use a wildcard (`*`) as value to run the test with all possible values for that pragma. For example, -this test: +a test whose logic depends on both `jsOnlyTestFlag` and development versus +optimized mode could use: ```javascript /**