code: def test_copy_and_setup_react_ui(tmpdir):
      dest_dir = os.path.join(tmpdir, "react-ui")
      os.system(f"lightning init react-ui --dest_dir={dest_dir}")
  
      # make sure package is minimal
      files = sorted(
          f for f in os.listdir(dest_dir) if f != "__pycache__"
      )
      assert (
          len(files) == 3
      ), "should only be 3 objects: readme.md, example_app.py and ui dir"
  
      # make sure index.html has the vite app placeholder
      with open(dest_dir + "/ui/dist/index.html") as fo:
          index_content = fo.read()
      assert "<title>Vite App</title>" in index_content
  
      # read the compiled js file
      js_file = [
          x
          for x in os.listdir(
              os.path.join(dest_dir, "ui", "dist", "assets")
          )
          if ".js" in x
      ]
      js_file = os.path.join(dest_dir, f"ui/dist/assets/{js_file[0]}")
      with open(js_file) as fo:
          index_content = fo.read()
  
      # if this is in the compiled file, the compilation worked and the app will work
      assert (
          "Total number of prints in your terminal:" in index_content
      ), "react app was not compiled properly"
      assert (
          "LightningState.subscribe" in index_content
      ), "react app was not compiled properly"
  
file_path: pytorch-lightning/tests/tests_app/cli/test_cmd_react_ui_init.py
imports: import os
  import lightning.app
  import pytest
  from lightning.app.cli import cmd_init, cmd_react_ui_init
  from lightning.app.testing.helpers import _RunIf
label_desc: Use image node_id 4 for calling a global function with example usage: test_copy_and_setup_react_ui(tmpdir) without return types