en un clic
tests
// Write clear, maintainable Vitest and Playwright tests with precise assertions, consistent structure, and strong behavioral coverage.
// Write clear, maintainable Vitest and Playwright tests with precise assertions, consistent structure, and strong behavioral coverage.
| name | tests |
| description | Write clear, maintainable Vitest and Playwright tests with precise assertions, consistent structure, and strong behavioral coverage. |
You write tests that are clear, maintainable, and thorough. You optimize for readability and reliability. Tests should be easy to understand and cover both typical use cases and edge cases.
toBe, toEqual, and toStrictEqual over loose checks.toBeDefined, toBeTruthy, toHaveLength, or toMatchObject when you can assert the exact value instead.expect.arrayContaining or expect.objectContaining. Assert the full expected value.toStrictEqual when checking objects or arrays to catch extra or missing properties.toBe for primitives (strings, numbers, booleans).toBeUndefined only when the expected value is genuinely undefined.// ❌ BAD - vague, does not catch wrong values
expect(result).toBeDefined()
expect(items).toHaveLength(2)
expect(user).toMatchObject({ name: 'Alice' })
// ✅ GOOD - exact, catches regressions
expect(result).toBe('expected-value')
expect(items).toStrictEqual([{ id: 1 }, { id: 2 }])
expect(user).toStrictEqual({ name: 'Alice', role: 'admin' })
/src
/lib
custom-lib.ts
custom-lib.test.ts
import { describe, it, expect } from 'vitest'
import { generateSlug, doSomething } from './custom-lib'
describe('generateSlug', () => {
it('generates a slug from the title', () => {
const result = generateSlug('Hello World')
expect(result).toBe('hello-world')
})
it('handles empty input gracefully', () => {
const result = generateSlug('')
expect(result).toBe('')
})
})
describe('doSomething', () => {
it('does something really well', () => {
const result = doSomething('Hello World')
expect(result).toBe('hello-world')
})
})
Minimal starter runbook for cloud agents to install dependencies, run packages, execute tests, and troubleshoot the Scalar monorepo quickly.
Skill for writing and updating scalar.config.json — Scalar Docs configuration reference for users and LLMs.
Build, customize, and troubleshoot OpenAPI mock servers with @scalar/mock-server, including x-handler, x-seed, authentication, and Docker.
Use consistent OpenAPI terminology and definitions when writing documentation, educational material, and tooling guidance.
Write clear, predictable TypeScript and Vue TypeScript code with strong typing, maintainability, and consistent documentation conventions.
Build Vue 3 components with TypeScript and Tailwind using clean structure, composable logic, accessibility, and maintainable patterns.