Skip to content

test(windows): make the extensionless task test exercise the file it names - #11924

Merged
jdx merged 1 commit into
jdx:mainfrom
JamBalaya56562:test/windows-noext-task-coverage
Aug 14, 2026
Merged

jdx merged 1 commit into
jdx:mainfrom
JamBalaya56562:test/windows-noext-task-coverage

Conversation

@JamBalaya56562

@JamBalaya56562 JamBalaya56562 commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

It 'executes a task without extension' is green but never touches the file it names. Found while
checking a review comment on #11923 that assumed this test covered a working path.

The collision

BeforeAll writes two fixtures whose task names collapse to the same thing:

tasks\filetask.bat      @echo off / echo mytask
tasks\filetask          @echo off / echo mytask     <- no extension, the intended subject

Giving them different bodies shows which one runs:

$ cat tasks/filetask.bat  ->  echo FROM-BAT
$ cat tasks/filetask      ->  echo FROM-EXTENSIONLESS

$ MISE_WINDOWS_DEFAULT_FILE_SHELL_ARGS=bat mise tasks ls
filetask                       # one task, not two

$ MISE_WINDOWS_DEFAULT_FILE_SHELL_ARGS=bat mise run filetask
FROM-BAT                       # exit=0

The .bat supplies the task. Rename the extensionless fixture and the original assertion fails
immediately:

$ MISE_WINDOWS_DEFAULT_FILE_SHELL_ARGS=bat mise run noexttask
Error: no task noexttask found

There is a second defect behind the first. The working example in this same file,
It 'executes a task in pwsh', sets all three of windows_executable_extensions,
windows_default_file_shell_args and use_file_shell_for_executable_tasks. The broken test sets
one, and its value — "bat" — is not a shell.

Why this is not fixed by "make it run the extensionless file"

The behaviour the name claims is not reachable with in-box Windows tooling. Every combination
measured on 2026.8.4-DEBUG windows-x64:

configuration result
default mise tasks ls empty — is_executable wants an extension or a shebang
MISE_WINDOWS_EXECUTABLE_EXTENSIONS="" or ",exe" discovered
+ run it os error 193 — exec'd directly
+ MISE_USE_FILE_SHELL_FOR_EXECUTABLE_TASKS=1, shell cmd /c cmd: "not recognized as an internal or external command"
shell pwsh.exe -File / powershell.exe -File refused: "does not have a '.ps1' extension"
shell cscript //nologo //E:vbscript "Can't find script engine" — VBScript is gone on Windows 11

Only a POSIX shell can execute an extensionless script, and that is not in-box. mise already has
the mechanism for extensionless files: the shebang
— covered by
It 'executes a shebang task with bash' two tests below.

So the fix belongs in the test, not in mise.

The change

Test-only, one file.

  1. Rename the extensionless fixture to noexttask so it stops shadowing, and give it a
    distinguishable body.
  2. Replace the false claim with the rule that actually governs it — windows_executable_extensions
    is the discovery boundary. Deterministic, no external shell, mise tasks ls only:
It 'does not discover an extensionless file task by default' {
    $out = mise tasks ls | Out-String
    # Both guards matter for the negative assertion below: it would also hold if the command
    # had failed outright, or listed nothing at all.
    $LASTEXITCODE | Should -Be 0
    $out | Should -BeLike '*filetask*'
    $out | Should -Not -BeLike '*noexttask*'
}

It 'discovers an extensionless file task when the setting admits it' {
    # The leading comma is the empty entry, which is what matches a file with no extension.
    $env:MISE_WINDOWS_EXECUTABLE_EXTENSIONS = ",exe,bat,cmd"
    $out = mise tasks ls | Out-String
    $LASTEXITCODE | Should -Be 0
    $out | Should -BeLike '*noexttask*'
}

The exit-code check and the filetask positive control came out of review, and they are the
point: a bare Should -Not -BeLike is exactly the assertion this PR exists to fix. It would pass
if mise tasks ls crashed, and it would pass if the fixture had never been written — the same
class of green-but-empty test as the one being replaced.

  1. Save and restore the three shell settings in BeforeAll/AfterAll. BeforeEach clears them
    between tests inside this Describe, but Pester runs every suite in one process, so whatever
    the last test left set leaked into the next file. Also from review.

Both discovery assertions verified locally against a real mise tasks ls: filetask alone by
default, filetask and noexttask with the setting.

Coverage does not drop

The removed assertion had nothing behind it, and its neighbours already cover the paths that work:

path test
.bat file task It 'executes a task'
execution through the file shell It 'executes a task in pwsh' (sets all three settings)
extensionless with a shebang It 'executes a shebang task with bash'

What is added is the discovery boundary, which nothing covered.

Not done

No bash-based test of "extensionless through a POSIX file shell". It would be the literal reading
of the old name, but it depends on which bash.exe the runner resolves — on the machine this was
measured on that is C:\WINDOWS\system32\bash.exe, the WSL launcher, not Git Bash. I am not
building a test on a dependency I cannot inspect.

I also did not run the Pester suite: Windows tests cannot run in a Linux container, so windows-e2e
is the only place that exercises it.

Conflicts

#11923 adds a context to this same file. Whichever lands second should merge them.

Summary by CodeRabbit

Summary by CodeRabbit

  • Bug Fixes

    • Improved Windows task discovery behavior for tasks without file extensions.
    • Extensionless tasks are now excluded by default and can be enabled through executable extension settings.
  • Tests

    • Added Windows coverage to verify extensionless task discovery and environment settings are preserved between tests.
    • Replaced a duplicate fixture with a dedicated extensionless task fixture.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 534bf389-eb23-4120-b614-6b8501ca7d4d

📥 Commits

Reviewing files that changed from the base of the PR and between 6ffa77d and 3c11c21.

📒 Files selected for processing (1)
  • e2e-win/task.Tests.ps1
🚧 Files skipped from review as they are similar to previous changes (1)
  • e2e-win/task.Tests.ps1

📝 Walkthrough

Walkthrough

The Windows task tests preserve inherited environment variables across the suite. They use a distinct noexttask fixture and verify default exclusion and opt-in discovery for extensionless tasks.

Changes

Windows task discovery

Layer / File(s) Summary
Environment state and test fixtures
e2e-win/task.Tests.ps1
The suite saves and restores inherited trust and Windows shell environment variables. The extensionless fixture is now a distinct noexttask task.
Extensionless task discovery coverage
e2e-win/task.Tests.ps1
The tests verify that noexttask is excluded by default and discovered when MISE_WINDOWS_EXECUTABLE_EXTENSIONS contains an empty entry.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: ⚪ Minimal · up to 3c11c

This change corrects Windows task-discovery coverage without altering product behavior or runtime configuration, so no actionable merge-blocking risk remains beyond normal checks and review.

Possibly related PRs

  • jdx/mise#11923: Covers related Windows task discovery and execution tests in the same file.

Poem

A rabbit guards the task test state,
Restoring variables at the gate.
No extension keeps its place unseen,
Until an empty entry turns the screen.
Hop, noexttask is found! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title relates to the Windows extensionless task test, although the final changes focus on discovery behavior and fixture separation.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@e2e-win/task.Tests.ps1`:
- Around line 61-64: Update the test setup around the extensionless-file test to
capture the original process-level MISE_WINDOWS_EXECUTABLE_EXTENSIONS value in
BeforeAll, then restore it in AfterAll; reassign the saved value when non-null
and remove Env:\MISE_WINDOWS_EXECUTABLE_EXTENSIONS when it was originally null.
- Around line 53-64: Update both extensionless task discovery tests to capture
the `mise tasks ls` output, assert `$LASTEXITCODE` is 0, and then perform the
existing `noexttask` output assertion. Preserve the current expected
presence/absence behavior in the tests.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 7e52f19e-4636-4628-99b3-cc1af2b04be2

📥 Commits

Reviewing files that changed from the base of the PR and between 44dc62d and 6ffa77d.

📒 Files selected for processing (1)
  • e2e-win/task.Tests.ps1

Comment thread e2e-win/task.Tests.ps1 Resolved
Comment thread e2e-win/task.Tests.ps1 Resolved
@JamBalaya56562
JamBalaya56562 force-pushed the test/windows-noext-task-coverage branch 2 times, most recently from 282678f to 3c11c21 Compare August 13, 2026 00:49
@JamBalaya56562
JamBalaya56562 marked this pull request as ready for review August 13, 2026 18:46
@greptile-apps

greptile-apps Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR corrects the Windows extensionless-task test so it validates task discovery rather than accidentally exercising the colliding .bat fixture.

  • Renames the extensionless fixture to give it a distinct task name.
  • Tests default exclusion and configured inclusion of extensionless file tasks.
  • Preserves and restores process-level task and trust settings across the shared Pester run.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
e2e-win/task.Tests.ps1 The revised fixtures and assertions directly exercise Windows extensionless-task discovery, while setup and teardown preserve inherited process environment values.

Reviews (3): Last reviewed commit: "test(windows): make the extensionless ta..." | Re-trigger Greptile

@JamBalaya56562
JamBalaya56562 marked this pull request as draft August 13, 2026 20:19
@JamBalaya56562
JamBalaya56562 marked this pull request as ready for review August 14, 2026 00:16
@JamBalaya56562
JamBalaya56562 marked this pull request as draft August 14, 2026 00:21
…names

`It 'executes a task without extension'` was green but never touched the file
it named. Two fixtures collapsed to the same task name (`filetask.bat` and
`filetask`), and the `.bat` is what ran, so the extensionless path had no
coverage at all.

Rename the extensionless fixture to `noexttask` so it stops shadowing, and
replace the false assertion with the rule that actually governs it:
`windows_executable_extensions` is the discovery boundary for a file with no
extension and no shebang. The behaviour the old name claimed -- executing an
extensionless file directly -- is not reachable with in-box Windows tooling, so
the fix belongs in the test, not in mise.

Also save and restore the shell settings the suite sets, and
`MISE_TRUSTED_CONFIG_PATHS`: Pester runs every suite in one process, so an
`AfterAll` that only removes them leaks into the next suite.
@JamBalaya56562
JamBalaya56562 force-pushed the test/windows-noext-task-coverage branch from 3c11c21 to fda5d0a Compare August 14, 2026 01:11
@JamBalaya56562
JamBalaya56562 marked this pull request as ready for review August 14, 2026 01:30
@jdx
jdx merged commit 5acedfc into jdx:main Aug 14, 2026
30 checks passed
@JamBalaya56562
JamBalaya56562 deleted the test/windows-noext-task-coverage branch August 14, 2026 01:37
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