Browse Source

update test running instructions in SKILL.md and AGENTS.md for clarity and usability

Yuki Takei 1 month ago
parent
commit
09d259fcef
2 changed files with 38 additions and 3 deletions
  1. 34 3
      .claude/skills/testing-patterns-with-vitest/SKILL.md
  2. 4 0
      apps/app/AGENTS.md

+ 34 - 3
.claude/skills/testing-patterns-with-vitest/SKILL.md

@@ -415,12 +415,43 @@ Before committing tests, ensure:
 
 ## Running Tests
 
+### From Monorepo Root (Recommended)
+
 ```bash
-# Run all tests for a package
+# Run all tests for a specific package
 turbo run test --filter @growi/app
+turbo run test --filter @growi/core
+
+# Or with Turborepo caching
+pnpm run test --filter @growi/app
+```
+
+### From Package Directory
+
+```bash
+# Run all tests
+pnpm vitest run
 
-# Run specific test file
-cd {package_dir} && pnpm vitest run src/components/Button/Button.spec.tsx
+# Run specific test file (use partial file name)
+pnpm vitest run yjs.integ
+pnpm vitest run helper.spec
+pnpm vitest run Button.spec
+
+# Run tests matching a pattern
+pnpm vitest run PageService
+```
+
+**File pattern tips**:
+- Use **partial file name** - Vitest automatically finds matching files
+- No need for `src/` prefix or full path
+- No need for `--project` flag - Vitest auto-detects based on file extension
+- Works across all packages (apps/app, packages/core, etc.)
+
+### Running Multiple Times (Flaky Test Detection)
+
+```bash
+# Repeat test execution to verify stability
+pnpm vitest run yjs.integ --repeat=10
 ```
 
 ## Summary: GROWI Testing Philosophy

+ 4 - 0
apps/app/AGENTS.md

@@ -29,6 +29,10 @@ pnpm run test                   # Run tests
 
 # Build
 pnpm run build                  # Build for production
+
+# Run Specific Tests
+pnpm vitest run yjs.integ       # Use partial file name
+pnpm vitest run helper.spec     # Vitest auto-finds matching files
 ```
 
 ### Key Directories