Skip to content

test: run a real Nushell in CI and the CLI tests on Windows - #753

Merged
linghengqian merged 1 commit into
version-fox:mainfrom
linghengqian:test/737-nushell-ci-windows-cli-fixture
Nov 12, 2026
Merged

linghengqian merged 1 commit into
version-fox:mainfrom
linghengqian:test/737-nushell-ci-windows-cli-fixture

Conversation

@linghengqian

Copy link
Copy Markdown
Member

Fixes #737: these are the last two unticked items of the issue (section 5, smaller items).

A real Nushell in CI

The vfox.nu that vfox generates was only checked as text. Whether vfox env sees the __VFOX_ORIG_PATH that the script records shows only in the order of PATH that a real session ends up with.

TestNushellSessionUsesTheBaselineItRecorded builds vfox, generates the configuration the documented way (vfox activate nushell $nu.default-config-dir), starts nu on it, and checks the PATH of the session when it starts and after a directory was put in front and the prompt hook ran, for the default (baseline) and for the legacy mode. Deleting the line that records the baseline, or moving it behind the first env call, makes it fail.

The new nushell job installs Nushell 0.117.0 from its release archive and checks the SHA-256 of the archive first (the digest is listed on the release page; bump both together). The test skips when nu is not installed, and the job sets VFOX_TEST_NUSHELL=1 so that an installation that went wrong fails instead of skipping.

If #720 lands, this job runs its template change against a real nu.

The CLI tests on Windows

cliFixture skipped on Windows, so the junction, .cmd and PATH separator cases had no end-to-end coverage. It runs there now:

  • USERPROFILE is set (os.UserHomeDir reads it, not HOME), commands are .cmd files (Windows only runs files with a PATHEXT extension), PATH is spelled the way each shell gets it (; natively, /c/... for the bash hook), links are junctions and hard links (no privilege needed), the short name in TEMP is resolved, and directories are named with os.MkdirTemp instead of the clock.
  • Selecting an SDK globally writes the user's PATH in the registry on Windows, so the fixture runs there only with VFOX_TEST_WINDOWS_REGISTRY=1, which the build job sets. Someone who runs go test ./... on a Windows machine skips these tests, as before.
  • Two tests are new: the PowerShell spelling of PATH (all platforms), and a baseline in the two forms that Git Bash hands to a native program (Windows only; the situation of [BUG]: On Windows, vfox use java@X doesn't change java when a JDK is in the system PATH and a global SDK is set #732).
  • TestInstallCommandUseOnShellWithoutHookSaysWhatFailed is skipped on Windows: without a hook use falls back to the global scope and opens a shell.

AGENTS.md says how to write CLI tests that work there.

Verification

  • Linux: go test ./cmd/commands with Nushell 0.117.0 on PATH, also with -race and with -shuffle=on -count=3.
  • CI on a fork branch with this commit: every job passes, the new nushell job included (run). In its Windows build job cmd/commands took 13.9 s at 52.3% coverage (Linux: 1.9 s at 54.5%).
  • What ran on windows-latest, from a throwaway fork branch (verbose run, which fails on purpose after printing every test; the real exit code was 0): 192 tests and subtests, 179 passed, 13 skipped, none failed. The skips are the Unix-only environment fixture in env_test.go, the no-hook install -u test, and the Nushell test. That branch carries the same tests. It differs in that the gate of the fixture also opens under GITHUB_ACTIONS (it could not carry the workflow change) and in an extra file that prints the tests. Its plain runs of cmd/commands took 10.6 s and 14.6 s, both at the same 52.3% coverage.

Not covered: Nushell runs on Linux only, so the Path and ; branch of the template for Windows is not exercised.

Part of version-fox#737 (section 5, smaller items).

Nushell: the vfox.nu that vfox generates was only checked as text, but
whether `vfox env` sees the __VFOX_ORIG_PATH that the script records shows
only in the order of PATH that a real session ends up with. A new job
installs a pinned Nushell release (the digest of the archive is checked), and
TestNushellSessionUsesTheBaselineItRecorded builds vfox, generates the
configuration the documented way, starts nu on it and checks the PATH of the
session for the default (baseline) and the legacy mode. The test skips
without nu; the job sets VFOX_TEST_NUSHELL=1, so that a missing nu fails.

Windows: cliFixture skipped there, so the junction, .cmd and PATH separator
cases had no end-to-end coverage. The fixture now sets USERPROFILE, writes
commands with an extension from PATHEXT, spells PATH the way each shell gets
it (';' natively, /c/... for the bash hook), makes links with junctions and
hard links, resolves the short name in TEMP and names directories with
os.MkdirTemp. Selecting an SDK globally writes the user's PATH in the
registry on Windows, so the fixture runs there only with
VFOX_TEST_WINDOWS_REGISTRY=1, which the build job sets. Two tests are new:
the PowerShell spelling of PATH, and a baseline in the form Git Bash holds it
(Windows only; the situation of version-fox#732).
Copilot AI lite review requested due to automatic review settings November 11, 2026 01:59
@codecov

codecov Bot commented Nov 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.21%. Comparing base (4754dfd) to head (e5ddf26).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #753   +/-   ##
=======================================
  Coverage   56.21%   56.21%           
=======================================
  Files         115      115           
  Lines        8576     8576           
=======================================
  Hits         4821     4821           
  Misses       3291     3291           
  Partials      464      464           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@linghengqian
linghengqian removed the request for review from Copilot November 11, 2026 02:02
@linghengqian linghengqian added the enhancement New feature or request label Nov 11, 2026
@linghengqian linghengqian added this to the 1.1.1 milestone Nov 11, 2026

@linghengqian linghengqian left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

CC @version-fox/vfox-committers @version-fox/vfox-maintainers . Please help review it.

@linghengqian
linghengqian merged commit 1446db1 into version-fox:main Nov 12, 2026
7 checks passed
@linghengqian
linghengqian deleted the test/737-nushell-ci-windows-cli-fixture branch November 12, 2026 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Follow-ups of #736: plugin updates, the path.mode default and vfox config

2 participants