Files
conference-room-booking-system/frontend/noxfile.py
2025-09-21 07:07:56 -04:00

89 lines
2.0 KiB
Python

"""Nox sessions for frontend tasks.
Run with `nox -s <session>` from the frontend directory.
"""
import os
from pathlib import Path
import nox
nox.options.sessions = (
"precommit",
"coverage",
"audit",
"storybook",
"jest",
)
@nox.session(name="pre-commit")
def precommit(session: nox.Session) -> None:
"""Run pre-commit checks by delegating to the root noxfile.
Args:
session: The Nox session object.
"""
session.run("nox", "-f", "../noxfile.py", "-s", "pre-commit", external=True)
@nox.session(name="typecheck")
def typecheck(session: nox.Session) -> None:
"""Run TypeScript type checks.
Args:
session: The Nox session object.
"""
frontend_dir = Path(__file__).parent
os.chdir(frontend_dir)
session.run("yarn", "tsc", "--noEmit", external=True)
@nox.session(name="coverage")
def coverage(session: nox.Session) -> None:
"""Run Jest with coverage reporting.
Args:
session: The Nox session object.
"""
frontend_dir = Path(__file__).parent
os.chdir(frontend_dir)
session.run("yarn", "jest", "--coverage", external=True)
@nox.session(name="audit")
def audit(session: nox.Session) -> None:
"""Run yarn audit for security checks.
Args:
session: The Nox session object.
"""
frontend_dir = Path(__file__).parent
os.chdir(frontend_dir)
session.run("yarn", "audit", external=True)
@nox.session(name="storybook")
def storybook(session: nox.Session) -> None:
"""Run Storybook for frontend documentation.
Args:
session: The Nox session object.
"""
frontend_dir = Path(__file__).parent
os.chdir(frontend_dir)
session.run("yarn", "storybook", external=True)
@nox.session(name="jest")
def jest(session: nox.Session) -> None:
"""Run frontend Jest tests using yarn.
Args:
session: The Nox session object.
"""
frontend_dir = Path(__file__).parent
os.chdir(frontend_dir)
session.run("yarn", "run", "jest", external=True)