Skip to content

Testing Guide

Power SEO Bot edited this page Feb 27, 2026 · 1 revision

Testing Guide

Running Tests

# All tests
pnpm test

# Watch mode
pnpm test --watch

# Specific package
pnpm --filter @power-seo/schema test

# Coverage
pnpm test --coverage

Writing Tests

We use Vitest:

import { describe, it, expect } from 'vitest';
import { validateTitle } from '@power-seo/core';

describe('validateTitle', () => {
  it('accepts valid titles', () => {
    const result = validateTitle('My Title');
    expect(result.valid).toBe(true);
  });

  it('rejects titles that are too short', () => {
    const result = validateTitle('Short');
    expect(result.valid).toBe(false);
  });
});

Test Coverage

Target: 95%+ coverage

View coverage report:

pnpm test --coverage

Integration Tests

Test real-world scenarios:

import { analyzeContent } from '@power-seo/content-analysis';
import { auditPage } from '@power-seo/audit';

it('produces consistent results across packages', () => {
  const content = analyzeContent({...});
  const audit = auditPage({...});
  
  expect(content.score).toBeDefined();
  expect(audit.score).toBeDefined();
});

All contributions must pass tests before merging.

Clone this wiki locally