MCPcopy
hub / github.com/reflex-dev/reflex / get_lighthouse_command

Function get_lighthouse_command

tests/integration/lighthouse_utils.py:693–711  ·  view source on GitHub ↗

Resolve the Lighthouse CLI command. Returns: The command prefix used to invoke Lighthouse.

()

Source from the content-addressed store, hash-verified

691
692
693def get_lighthouse_command() -> list[str]:
694 """Resolve the Lighthouse CLI command.
695
696 Returns:
697 The command prefix used to invoke Lighthouse.
698 """
699 if command := os.environ.get(LIGHTHOUSE_COMMAND_ENV_VAR):
700 return shlex.split(command)
701 if shutil.which("lighthouse") is not None:
702 return ["lighthouse"]
703 if shutil.which("npx") is not None:
704 return ["npx", "--yes", LIGHTHOUSE_CLI_PACKAGE]
705 if shutil.which("pnpx") is not None:
706 return ["pnpx", LIGHTHOUSE_CLI_PACKAGE]
707 pytest.skip(
708 "Lighthouse CLI is unavailable. "
709 "Install `lighthouse`, make `npx` or `pnpx` available, "
710 f"or set {LIGHTHOUSE_COMMAND_ENV_VAR}."
711 )
712
713
714def _format_subprocess_output(output: str | bytes | None) -> str:

Callers 1

run_lighthouseFunction · 0.85

Calls 2

splitMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected