test: fix .NET detection tests to use upgrade instead of init#1030
Conversation
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>
There was a problem hiding this comment.
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.vbprojtests to runinitfirst, thenupgrade - Update test names/messages to align expectations with upgrade-driven workflow installation
| 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'); |
There was a problem hiding this comment.
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).
| 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'); |
There was a problem hiding this comment.
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.
…s-to-main test: cherry-pick .NET detection test fix to main (from #1030)
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:
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.