{"_id":"@allystudio/test","name":"@allystudio/test","dist-tags":{"beta":"0.9.0-beta.1","latest":"0.9.0-beta.1"},"versions":{"0.9.0-beta.1":{"name":"@allystudio/test","version":"0.9.0-beta.1","description":"Minimal DOM element test runner with Vitest-style API","type":"module","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"build":"tsup","dev":"tsup --watch","test":"vitest","test:ui":"vitest --ui","test:watch":"vitest --watch","test:visual":"vitest --browser.headless=false --watch","test:browser":"vitest --browser.enabled=true","test:core":"vitest tests/core --run","test:unit":"vitest tests/plugins tests/reporters","test:integration":"vitest tests/integration","test:e2e":"vitest tests/e2e","test:performance":"vitest tests/plugins/performance.test.ts","test:coverage":"vitest --coverage","test:all":"tsx tests/run-all-tests.ts","demo":"vite demo --port 3001","benchmark":"vite --config vite.config.benchmark.js","benchmark:build":"vite build --config vite.config.benchmark.js","lint":"oxlint src","typecheck":"tsc --noEmit"},"keywords":["accessibility","a11y","testing","act","wcag","test-runner","browser","dom","chrome-extension"],"author":{"name":"Aleksej Dix","email":"privat@aleksejdix.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/aleksejdix/allyship.dev.git","directory":"packages/test"},"devDependencies":{"@playwright/test":"^1.40.0","@types/chrome":"^0.0.326","@types/node":"^20.0.0","@vitest/browser":"^2.0.0","@vitest/coverage-v8":"2.1.9","@vitest/ui":"^2.0.0","oxlint":"^0.15.0","playwright":"^1.40.0","tsup":"^8.0.0","typescript":"^5.0.0","vite":"^5.4.19","vitest":"^2.0.0"},"peerDependencies":{"typescript":">=4.5.0"},"dependencies":{"axe-core":"^4.10.3"},"_id":"@allystudio/test@0.9.0-beta.1","gitHead":"8ba8123cdf4f50deadb06b7993843d225d84a184","bugs":{"url":"https://github.com/aleksejdix/allyship.dev/issues"},"homepage":"https://github.com/aleksejdix/allyship.dev#readme","_nodeVersion":"23.11.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-EYlyrTP0tRJp0A8bGJbawNBkpdvdIVKD1JY3Cyr2LxOH5xrOehxNbUatIGKmrkAanhhu864rYbaWdbgXzoJbYw==","shasum":"00a497662dff20bb230afcbf932818dd6d5afe29","tarball":"https://registry.npmjs.org/@allystudio/test/-/test-0.9.0-beta.1.tgz","fileCount":5,"unpackedSize":170812,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDXtM8rDto8m3o/wH5avUgjFNJAzST4eij975eWsFqj0wIhAJWtR7PjTon0K/72zU8aWgdMbzb2H3pHZ3xn+LWBaqA7"}]},"_npmUser":{"name":"allystudio","email":"privat@aleksejdix.com","actor":{"name":"allystudio","email":"privat@aleksejdix.com","type":"user"}},"directories":{},"maintainers":[{"name":"allystudio","email":"privat@aleksejdix.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/test_0.9.0-beta.1_1750852571558_0.5216114664879747"},"_hasShrinkwrap":false}},"time":{"created":"2025-06-25T11:56:11.425Z","0.9.0-beta.1":"2025-06-25T11:56:11.760Z","modified":"2025-06-25T11:56:12.000Z"},"maintainers":[{"name":"allystudio","email":"privat@aleksejdix.com"}],"description":"Minimal DOM element test runner with Vitest-style API","homepage":"https://github.com/aleksejdix/allyship.dev#readme","keywords":["accessibility","a11y","testing","act","wcag","test-runner","browser","dom","chrome-extension"],"repository":{"type":"git","url":"git+https://github.com/aleksejdix/allyship.dev.git","directory":"packages/test"},"author":{"name":"Aleksej Dix","email":"privat@aleksejdix.com"},"bugs":{"url":"https://github.com/aleksejdix/allyship.dev/issues"},"license":"MIT","readme":"# @allystudio/tespack\n\nA minimal DOM element test runner with Vitest-style API. Fast, modular architecture with clean separation between core testing logic, optional plugins, and flexible reporting.\n\n## ✨ Features\n\n- 🎯 **Modular Architecture** - Core, plugins, and reporters are separate\n- ⚡ **Minimal Core** - Essential testing logic without bloat\n- 🔌 **Plugin System** - Optional features (performance, AllyStudio integration)\n- 📊 **Flexible Reporting** - Console, JSON, or minimal output\n- 🧪 **Vitest-style API** - Familiar testing syntax (`describe`, `test`, `expect`)\n- 🚀 **High Performance** - Optimized for speed with performance tracking\n- 🎨 **AllyStudio Ready** - Built-in integration with visual highlighting\n\n## 📦 Installation\n\n```bash\nnpm install @allystudio/test\n```\n\n## 🚀 Quick Start\n\n### Simple Usage (Auto-configured)\n```typescript\nimport { describe, test, run, expect } from '@allystudio/test'\n\ndescribe('Image Tests', () => {\n  test('should have alt attribute', ({ element }) => {\n    expect(element.getAttribute('alt')).toBeTruthy()\n  }, 'img')\n})\n\ndescribe('Button Tests', () => {\n  test('should have text content', ({ element }) => {\n    expect(element.textContent).toBeTruthy()\n  }, 'button')\n})\n\n// Run with default console reporter\nconst results = await run()\n```\n\n### Advanced Configuration\n```typescript\nimport {\n  configure,\n  describe,\n  test,\n  run,\n  PerformancePlugin,\n  JsonReporter\n} from '@allystudio/test'\n\n// Configure with custom reporter and plugins\nconfigure({\n  reporter: 'console',\n  reporterConfig: { verbose: true },\n  performance: true,\n  allyStudio: {\n    highlightElement: (element, type) => {\n      element.classList.add(`highlight-${type}`)\n    }\n  }\n})\n\ndescribe('Form Tests', () => {\n  test('should have labels', ({ element }) => {\n    const label = element.labels?.[0] || document.querySelector(`label[for=\"${element.id}\"]`)\n    expect(label).toBeTruthy()\n  }, 'input:not([type=\"hidden\"])')\n})\n\nconst results = await run()\n```\n\n## 🏗️ Architecture\n\n```\nsrc/\n├── core/           # Essential testing logic (minimal)\n├── plugins/        # Optional features (extensible)\n├── reporters/      # Output formatting (flexible)\n├── api.ts         # Main facade (simple interface)\n└── index.ts       # Module exports\n```\n\n### 🎯 Core Module\nMinimal execution engine with:\n- Test suite management (`describe`, `test`)\n- Element selection and iteration\n- Event system for plugins\n- Basic expectations (`expect`)\n\n### 🔌 Plugins\nOptional features that extend functionality:\n- **PerformancePlugin** - Execution time, memory usage, processing speed\n- **AllyStudioPlugin** - Visual highlighting integration\n- **ExpectationsPlugin** - Accessibility-specific assertions (`expectA11y`)\n\n### 📊 Reporters\nFlexible output formatting:\n- **ConsoleReporter** - Rich console output (default)\n- **MinimalReporter** - Essential output for CI/CD\n- **JsonReporter** - Structured data with download\n\n## 🧪 Testing API\n\n### Element Testing Examples\n```typescript\nimport { expect } from '@allystudio/test'\n\n// Image testing\nexpect(imgElement.getAttribute('alt')).toBeTruthy()\nexpect(imgElement.getAttribute('src')).toContain('https://')\n\n// Button testing\nexpect(buttonElement.textContent).toBeTruthy()\nexpect(buttonElement.getAttribute('type')).toBe('submit')\n\n// Form testing\nexpect(inputElement.labels?.length).toBeGreaterThan(0)\nexpect(inputElement.getAttribute('required')).toBe('')\n\n// Link testing\nexpect(linkElement.textContent?.trim()).toBeTruthy()\nexpect(linkElement.getAttribute('href')).toMatch(/^https?:\\/\\//)\n\n// General DOM testing\nexpect(element.tagName).toBe('BUTTON')\nexpect(element.classList.contains('active')).toBe(true)\n```\n\n### Standard Expectations\n```typescript\nimport { expect } from '@allystudio/test'\n\nexpect(element.tagName).toBe('BUTTON')\nexpect(element.getAttribute('role')).not.toBe('presentation')\nexpect(element.classList.contains('active')).toBe(true)\nexpect(element.textContent?.trim()).toBeTruthy()\n```\n\n## ⚡ Performance Tracking\n\n```typescript\nimport { configure, PerformancePlugin } from '@allystudio/test'\n\nconfigure({\n  performance: true, // Enable performance plugin\n  reporter: 'console',\n  reporterConfig: { verbose: true }\n})\n\n// After running tests, see metrics like:\n// ⚡ Performance Metrics:\n//    Duration: 245.67ms\n//    Elements: 1,247\n//    Tests: 4,988\n//    Speed: 5,073 elements/sec\n//    Memory: 12.4MB\n```\n\n## 🎨 AllyStudio Integration\n\n```typescript\nimport { configure } from '@allystudio/test'\n\nconfigure({\n  allyStudio: {\n    highlightElement: (element, type) => {\n      // Integrate with AllyStudio's layer system\n      element.classList.add(`ally-${type}`)\n      element.setAttribute('data-ally-result', type)\n    },\n    clearHighlights: () => {\n      document.querySelectorAll('[data-ally-result]').forEach(el => {\n        el.classList.remove('ally-pass', 'ally-fail', 'ally-skip')\n        el.removeAttribute('data-ally-result')\n      })\n    },\n    showTooltip: (element, message) => {\n      element.title = message\n    }\n  }\n})\n```\n\n## 📊 Reporters\n\n### Console Reporter (Default)\n```typescript\nconfigure({ reporter: 'console', reporterConfig: { verbose: true } })\n// Output:\n// 🚀 Starting 3 test suite(s)\n// 📋 Image Accessibility\n//    ✅ Passed: 12\n//    ❌ Failed: 3\n//    Duration: 45.67ms\n```\n\n### Minimal Reporter\n```typescript\nconfigure({ reporter: 'minimal' })\n// Output: ✅ 156/160 passed (234ms)\n```\n\n### JSON Reporter\n```typescript\nconfigure({\n  reporter: 'json',\n  reporterConfig: { output: 'test-results.json' }\n})\n// Downloads structured JSON with full results\n```\n\n## 🔧 Custom Extensions\n\n### Custom Plugin\n```typescript\nimport type { Plugin } from '@allystudio/act-test-runner/plugins'\n\nclass CustomPlugin implements Plugin {\n  name = 'custom'\n\n  install(runner: TestRunner): void {\n    runner.on(event => {\n      if (event.type === 'element-tested') {\n        // Custom logic for each tested element\n        console.log(`Tested ${event.data.element}: ${event.data.result}`)\n      }\n    })\n  }\n}\n\nconfigure({ plugins: [new CustomPlugin()] })\n```\n\n### Custom Reporter\n```typescript\nimport type { Reporter } from '@allystudio/act-test-runner/reporters'\n\nclass CustomReporter implements Reporter {\n  onEvent(event: TestEvent): void {\n    // Handle real-time events\n  }\n\n  async onComplete(results: SuiteResult[]): Promise<void> {\n    // Process final results\n    console.log(`Custom report: ${results.length} suites completed`)\n  }\n}\n\nconfigure({ reporter: new CustomReporter() })\n```\n\n## 📈 Migration from v1.x\n\n```typescript\n// OLD (monolithic)\nimport { run, describe, test } from '@allystudio/act-test-runner'\nawait run()\n\n// NEW (modular)\nimport { runTests, describe, test } from '@allystudio/act-test-runner'\nawait runTests()\n```\n\n**Breaking Changes:**\n- `run()` → `runTests()`\n- Configuration moved to `configure()`\n- Accessibility expectations moved to `expectA11y()`\n- Advanced features require explicit plugin installation\n\n**Benefits:**\n- 🎯 Cleaner API surface\n- 📦 Smaller bundle size (tree-shakable)\n- 🚀 Better performance\n- 🔧 More flexible configuration\n- 🧩 Easier to extend\n\n## 📚 Documentation\n\n- [Architecture Guide](./ARCHITECTURE.md) - Detailed modular architecture\n- [Demo](./demo-modular.html) - Interactive browser demo\n- [Benchmarks](./benchmarks/) - Performance comparison tools\n\n## 🤝 Contributing\n\nThe modular architecture makes contributions easier:\n- **Core**: Focus on test execution performance\n- **Plugins**: Add new features without affecting core\n- **Reporters**: Create new output formats\n- **API**: Improve developer experience\n\n## 📄 License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-6e2214c2a596ba6359f38c8db5dd0ed2"}