用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/opensearch-project/OpenSearch-Dashboards --skill test-changes命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | test_changes |
| description | Run Jest unit tests for files changed in the current branch |
| arguments | [{"name":"scope","description":"What to diff against: 'branch' (vs base branch, default), 'staged' (staged only), 'unstaged' (unstaged only), 'all-local' (staged + unstaged)","required":false},{"name":"base","description":"Base ref to diff against when scope=branch (default: auto-detects remote main/mainline)","required":false}] |
Find and run Jest tests relevant to locally changed files.
Based on the scope argument (default: branch):
# scope=branch (default): all changes since diverging from base branch
# Auto-detect base: use origin/main or origin/mainline, whichever exists
base="${base:-$(git rev-parse --verify origin/main 2>/dev/null && echo origin/main || echo origin/mainline)}"
git diff --name-only --diff-filter=ACMR "$base"...HEAD
# Also include uncommitted changes on top
git diff --name-only --diff-filter=ACMR HEAD
# scope=staged
git diff --cached --name-only --diff-filter=ACMR
# scope=unstaged
git diff --name-only --diff-filter=ACMR
# scope=all-local
git diff --name-only --diff-filter=ACMR HEAD
Filter to only .ts, .tsx, .js, .jsx files. Exclude files under target/, build/, node_modules/.
From the changed file list:
*.test.ts, *.test.tsx, *.test.js, *.test.jsx → run directly.For each changed source file (e.g., src/plugins/foo/bar.ts), check if any of these exist:
src/plugins/foo/bar.test.tssrc/plugins/foo/bar.test.tsxsrc/plugins/foo/bar.test.jsUse the first match found.
For any changed source file with no matching test file, print a warning:
⚠ No test file found for: src/plugins/foo/bar.ts
This is informational only — do not fail or block.
Combine all discovered test files (from changed test files + matched test files for source changes), deduplicate, then run:
yarn test:jest path/to/test1.test.ts path/to/test2.test.tsx ...
If no test files are found at all, report that and exit cleanly.
Summarize: