cypress.config.ts — TypeScript starter
Cypress 13+ E2E config with TypeScript, baseUrl, specPattern, viewport sizing, video disabled, screenshots on failure, and an API URL environment variable.
// Config file
import { defineConfig } from 'cypress';
export default defineConfig({
e2e: {
baseUrl: 'http://localhost:3000',
specPattern: 'cypress/e2e/**/*.cy.{ts,tsx}',
supportFile: 'cypress/support/e2e.ts',
viewportWidth: 1280,
viewportHeight: 720,
video: false,
screenshotOnRunFailure: true,
defaultCommandTimeout: 8000,
requestTimeout: 10000,
env: {
apiUrl: 'http://localhost:3001/api',
},
},
});// Setup
cypress.config.ts. Run npm install --save-dev cypress typescript ts-node. Add a cypress/tsconfig.json that extends your root tsconfig.json and includes cypress/**/*.// How to use
npx cypress open for interactive mode; npx cypress run for headless CI. Override baseUrl per environment with CYPRESS_baseUrl=https://staging.example.com npx cypress run.