Skip to content

Add CLI integration test for init command#44678

Merged
pelikhan merged 1 commit into
mainfrom
copilot/add-test-for-init-command
Jul 10, 2026
Merged

Add CLI integration test for init command#44678
pelikhan merged 1 commit into
mainfrom
copilot/add-test-for-init-command

Conversation

Copilot AI commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

No integration test existed to verify that gh aw init actually generates the expected files when run through the compiled binary.

New: pkg/cli/init_integration_test.go

Three integration tests (build tag integration) using the shared globalBinaryPath infrastructure from compile_integration_test.go:

  • TestInitCommandIntegration — runs init --no-mcp in a fresh git repo; asserts .gitattributes (with *.lock.yml linguist-generated entry), .github/skills/agentic-workflows/SKILL.md, .github/agents/agentic-workflows.md, and .vscode/settings.json are all created.
  • TestInitCommandNoSkillIntegration--no-skill suppresses the dispatcher skill while .gitattributes is still written.
  • TestInitCommandIdempotentIntegration — two sequential init runs produce no errors and no duplicate .gitattributes entries.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Add integration test for init command via compiled CLI binary Add CLI integration test for init command Jul 10, 2026
Copilot AI requested a review from pelikhan July 10, 2026 07:16
@github-actions

Copy link
Copy Markdown
Contributor

🤖 PR Triage

Field Value
Category test
Risk 🟢 Low
Score 38 / 100
Action ✅ auto_merge

Score breakdown: impact 18 + urgency 10 + quality 10

Rationale: Adds integration tests for init command with a build tag guard. Pure test addition; no production code modified. Auto-merge when CI passes.

Generated by 🔧 PR Triage Agent · 44.7 AIC · ⌖ 5.13 AIC · ⊞ 5.4K ·

@pelikhan pelikhan marked this pull request as ready for review July 10, 2026 07:33
Copilot AI review requested due to automatic review settings July 10, 2026 07:33
@pelikhan pelikhan merged commit d520c64 into main Jul 10, 2026
@pelikhan pelikhan deleted the copilot/add-test-for-init-command branch July 10, 2026 07:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an integration test suite (build tag integration) to exercise gh aw init end-to-end via the compiled CLI binary, verifying that repository initialization produces the expected on-disk artifacts.

Changes:

  • Introduces pkg/cli/init_integration_test.go with three integration tests covering default init behavior, --no-skill, and idempotency.
  • Reuses the existing globalBinaryPath integration-test binary infrastructure to run the real CLI.
Show a summary per file
File Description
pkg/cli/init_integration_test.go New integration tests validating gh aw init --no-mcp file generation, --no-skill suppression, and .gitattributes idempotency.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment on lines +34 to +38
originalWd, err := os.Getwd()
require.NoError(t, err, "Failed to get current working directory")

err = os.Chdir(tempDir)
require.NoError(t, err, "Failed to change to temp directory")
Comment on lines +46 to +50
// Copy the pre-built binary to this test's temp directory
binaryPath := filepath.Join(tempDir, "gh-aw")
err = fileutil.CopyFile(globalBinaryPath, binaryPath)
require.NoError(t, err, "Failed to copy gh-aw binary to temp directory")

Comment on lines +125 to +126
_, err = os.Stat(skillPath)
assert.True(t, os.IsNotExist(err), "dispatcher skill should NOT be created with --no-skill")
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.82.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants