跳到正文
cccskills
免费在 GitHub 公开

fix-test

Debug and fix failing bashdep tests systematically

中文简介正在准备中。当前显示原文说明。

Chemaclass/bashdep星标 19(GitHub 19 + cccskills 0)

实测评分 未实测

查看安装方法

包含的文件(1)

  • SKILL.md2.3 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Fix Test

Systematically debug and fix failing test(s) in tests/unit/bashdep_test.sh.

Workflow

1. Identify Failures

make test 2>&1
# Or, narrower:
lib/bashunit tests --filter <test_name>

Parse: which test functions fail, what assertions, what the actual vs expected was.

2. Categorize Each Failure

  • Test bug - wrong expected value, missing set_up reset, leaky state
  • Implementation bug - bashdep doesn't match expected behavior
  • Snapshot drift - output legitimately changed; snapshot needs updating
  • Environment issue - missing $TEST_DIR, hardcoded path that doesn't exist, missing fixture
  • Bash 3.2 compat regression - code uses a Bash 4+ feature
  • Mode-flag leak - BASHDEP_* global from a prior test wasn't reset

3. Fix

  • Test bug: correct the assertion, fixture, or set_up
  • Implementation bug: minimal fix in bashdep, follow TDD (regression test must already exist or be added now)
  • Snapshot drift: confirm the new output is correct, then lib/bashunit --update-snapshots tests/. Review the diff before committing
  • Environment: fix the fixture path; never hardcode /tmp/... outside snapshot tests
  • Bash 3.2 compat: swap to a 3.2-safe construct (see .claude/rules/bash-style.md)
  • Mode-flag leak: add the reset to set_up, or scope the change to the single test

4. Verify

lib/bashunit tests --filter <test_name>   # Specific test
make test                                  # Full suite
make sa && make lint                       # Static checks

5. Prevent Regression

  • Document the root cause in the commit message body when non-obvious
  • Add an edge-case test if the failure exposed a missing case
  • If the bug crossed mode-flag boundaries, add tests for each mode (dry-run, silent, verbose, force)

Debugging Tips

  • Use --filter "test_name" to run a single test in isolation
  • Add printf 'DEBUG: %s\n' "$var" >&2 temporarily - strip before commit
  • If a test passes alone but fails in the suite, suspect a leaked BASHDEP_* global; reset in set_up
  • For snapshot mismatches, diff the snapshot file vs current stdout before regenerating

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Add a new bashdep:: lifecycle command with TDD

中文简介正在准备中。当前显示原文说明。

Chemaclass/bashdep192026年10月20日 更新

commit

免费

Stage and commit changes using conventional commits format

中文简介正在准备中。当前显示原文说明。

Chemaclass/bashdep192026年10月20日 更新

Coverage gap analysis for the bashdep public API plus a bashdep::doctor audit

中文简介正在准备中。当前显示原文说明。

Chemaclass/bashdep192026年10月20日 更新

gh-issue

免费

Fetch a GitHub issue, create a branch, plan and implement with TDD, then open a PR

中文简介正在准备中。当前显示原文说明。

Chemaclass/bashdep192026年10月20日 更新

pr

免费

Push branch and create a GitHub PR following the bashdep PR template

中文简介正在准备中。当前显示原文说明。

Chemaclass/bashdep192026年10月20日 更新

Run a comprehensive pre-release validation checklist for bashdep

中文简介正在准备中。当前显示原文说明。

Chemaclass/bashdep192026年10月20日 更新

查看 Chemaclass 的全部技能

报告此技能的问题