fugufish/inertia-rals-vitest-typescript icon
public
Published on 5/22/2025
Inertia Rails / Vitest / Typescript Testing Guidelines

Testing guidelines for Inertia Rails + Vitest + Typescript

Rules

Naming and Directory Structure

  • Tests MUST be placed in spec/frontend/<filepath>
  • Tests MUST be named after the file they are testing, i.e. a file testing blog.ts should create a test called blog.spec.ts
  • Mocks SHOULD be created to mock components not being tested as apart of a unit test in a reusable way
  • Mocks MUST be placed in spec/frontend/__mocks__ - Frontend tests MUST be run after any code change to a frontend file. - If a test fails after a code change, the test MUST be updated to match the new behavior - Tests MUST be run by calling pnpm test <filename> when testing a specific file - Tests MUST be run by calling bundle exec frontend:spec when running tests for all files