Add bats-core unit tests
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 54/100
調査の方向性
Start with src/scripts/lib/*.sh to understand the listed functions, then review .github/workflows/test-runner.yaml and the existing shell lint configuration. Add isolated Bats tests under tests/ using sandboxed environment variables and stub binaries; run them with bats tests/ and the existing lint checks. Done means the specified library targets have unit coverage, a fast CI job runs it, and the README explains local testing.
索引モデルが issue の本文から書いたものです。
説明
Context
~80 bash scripts with zero unit tests. src/scripts/lib/*.sh define sourced, reusable functions — ideal unit targets — but the only automated coverage is slow, container-based integration (test-runner.yaml cli/config/full/master jobs) plus post-run scripts/validate*.sh gates. No fast feedback loop exists for lib logic.
Spec
1. Tooling
- Install bats-core locally (release tarball) plus
bats-support/bats-assert/bats-file. - Layout:
tests/lib/<name>.batsmirroringsrc/scripts/lib/,tests/helpers/setup.bash(sandbox/stub loader),tests/stubs/(fake binaries),tests/fixtures/(package lists, dotfiles trees, manifest lines).
2. Unit-test targets (source lib, call in isolation)
src/scripts/lib/dotfiles-install.sh—expand_home_path,copy_dotfile_file,link_dotfiles_xdg_config_dirs,install_dotfiles_from_manifest: sandboxHOME/XDG_CONFIG_HOME, assert copy idempotency, backup-then-symlink of pre-existing~/.config/<app>.src/scripts/lib/package-install.sh—append_packages_from_file,install_pacman_packages_from_file(s),install_collected_*,install_aur_packages*: stubpacmanonPATH, fixture lists, assert invocation args and continuation-on-failure.src/scripts/lib/aur-repo-add.sh/aur-repos.sh—add_arch_repo_if_missing,setup_repo_from_manifest_line,add_pacman_repos_parallel: stubpacman/git; assert idempotency (no duplicate repo entries).src/scripts/lib/run.sh/env.sh—ensure_temp_dir,run_script:TEMP_DIRdefaulting, best-effort (|| true) exit tolerance.src/scripts/lib/parallel.sh—parallel_run_best_effort,parallel_wait_pids,parallel_wait_pids_best_effort: pid log bookkeeping, failure aggregation.src/scripts/lib/zsh-login.sh(zsh_login_safe,ensure_zshrc_login_safe),git-submodules.sh(ensure_submodules_syncedwith a sandbox git repo),gnome-session.sh(gnome_session_activewith a fakedbus-send/gnome-shell).
3. Approach
setup()per test:mktemp -dsandbox; exportHOME,TEMP_DIR,PROJECT_ROOTinto it; prependtests/stubs/toPATH. No network, no real system mutation.- Exclude leaf installers (
src/scripts/install/**) — guarded one-liners already exercised by container CI.
4. CI
- Add a fast
unit-testsjob (ubuntu-latest, no docker) to.github/workflows/test-runner.yamlbefore the container jobs: checkout → setup bats →bats tests/. Usebats-core/bats-actionpinned to the full-length commit SHA of its latest release (repo pinning convention), passingBATS_LIB_PATHfrom itslib-pathoutput. - Extend
lint:shell-style globs sotests/**.bats/helpers are covered by the existing shellcheck/shfmt quality gate.
5. Docs
- README "Testing" section: local bats install +
bats tests/; note unit vs. container-integration split.
Out of scope
Leaf script side effects, container integration jobs, scripts/validate*.sh gates.
- 主要言語
- Shell
- スター
- 1
- フォーク
- 0
- 平均マージ
- 5時間 34分
- マージ済み PR(30日)
- 4
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
似ている issue
-
難易度 2/5 1時間未満 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
posthog
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
DobermanCore/Doberman-Core#827 ·
メンテナーはふだん 1 日以内に返信
-
category:enhancement status:needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
nushell/nushell#19546 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
release.yml fetches the GitHub CLI keyring with a bare curl, the one workflow download with no retryオープンbug ci phase:10 priority:p3
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
jimmy058910/jmo-security-repo#1629 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
achisolomon/software-factory#182 ·