Skip to content

test: fix .NET detection tests to use upgrade instead of init#1030

Merged
tamirdresher merged 1 commit into
devfrom
fix/dotnet-detection-tests-use-upgrade
Apr 23, 2026
Merged

test: fix .NET detection tests to use upgrade instead of init#1030
tamirdresher merged 1 commit into
devfrom
fix/dotnet-detection-tests-use-upgrade

Conversation

@tamirdresher

Copy link
Copy Markdown
Collaborator

Summary

The 3 dotnet project type tests (.slnx, .fsproj, .vbproj) in migrate-directory.test.cjs expected squad-ci.yml to be created during squad init. Since PR #847 (commit f522840), init intentionally skips CI/CD workflows — they are installed by squad upgrade.

Changes

Changed the 3 tests to:

  1. Run init first (creates .squad/ structure, no CI workflows)
  2. Run upgrade (installs CI/CD workflows including project-type-specific ones)

This matches the existing pattern in Group 7 (the migrate+upgrade test at line 302).

Context

These are the last 3 test failures blocking the 0.9.4 release. Brady confirmed option (b) — change tests to use upgrade. See discussion in contributors chat.

Fixes the 3 remaining test failures after PR #1005.

The 3 dotnet project type tests (.slnx, .fsproj, .vbproj) expected
squad-ci.yml to be created during init. Since PR #847 init intentionally
skips CI/CD workflows (they are installed by upgrade). Change the tests
to run init first (creates .squad/ structure) then upgrade (installs
CI workflows including project-type-specific ones).

Fixes the last 3 test failures blocking the 0.9.4 release.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 23, 2026 05:30

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

Updates the .NET project-type detection tests to reflect the post-#847 behavior where squad init no longer installs CI/CD workflows, and workflows are instead installed via squad upgrade.

Changes:

  • Adjust .slnx, .fsproj, and .vbproj tests to run init first, then upgrade
  • Update test names/messages to align expectations with upgrade-driven workflow installation

Comment on lines +279 to 283
const result = runSquad(['upgrade'], tmpDir);
assert.equal(result.exitCode, 0, `upgrade should succeed: ${result.stdout}`);

const ciPath = path.join(tmpDir, '.github', 'workflows', 'squad-ci.yml');
const ciContent = fs.readFileSync(ciPath, 'utf8');

Copilot AI Apr 23, 2026

Copy link

Choose a reason for hiding this comment

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

fs.readFileSync(ciPath, 'utf8') is called without first asserting that squad-ci.yml exists. If upgrade fails to write the workflow, the test will throw with a less-informative ENOENT stack trace instead of a clear assertion failure. Add an assert.ok(fs.existsSync(ciPath), ...) before reading the file (as done in the .slnx test).

Copilot uses AI. Check for mistakes.
Comment on lines +294 to 298
const result = runSquad(['upgrade'], tmpDir);
assert.equal(result.exitCode, 0, `upgrade should succeed: ${result.stdout}`);

const ciPath = path.join(tmpDir, '.github', 'workflows', 'squad-ci.yml');
const ciContent = fs.readFileSync(ciPath, 'utf8');

Copilot AI Apr 23, 2026

Copy link

Choose a reason for hiding this comment

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

fs.readFileSync(ciPath, 'utf8') is executed without verifying the workflow file exists first. If upgrade doesn't create squad-ci.yml, the test will fail with an ENOENT error rather than an assertion message. Add an assert.ok(fs.existsSync(ciPath), ...) before reading the file for clearer failures.

Copilot uses AI. Check for mistakes.
@tamirdresher tamirdresher merged commit ec07f38 into dev Apr 23, 2026
10 checks passed
@tamirdresher tamirdresher deleted the fix/dotnet-detection-tests-use-upgrade branch April 23, 2026 05:39
tamirdresher pushed a commit that referenced this pull request Apr 23, 2026
Same fix as PR #1030 on dev. Changes 3 tests in Group 6 from init-only
to init+upgrade pattern, matching the behavior change from PR #847.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bradygaster added a commit that referenced this pull request Apr 24, 2026
…s-to-main

test: cherry-pick .NET detection test fix to main (from #1030)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants