Repository navigation
feat(tasks): warn when a task_config.includes path does not exist #11883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
JamBalaya56562
wants to merge
1
commit into
jdx:main
from
JamBalaya56562:fix/task-warn-on-broken-includes
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # A task_config.includes entry that points at nothing used to be dropped in silence, so a typo or a | ||
| # moved file made tasks disappear with nothing to say why. | ||
| # See: https://github.com/jdx/mise/discussions/4792 | ||
|
|
||
| cat <<EOF >tasks.toml | ||
| [hello] | ||
| run = 'echo "hi"' | ||
| EOF | ||
|
|
||
| cat <<EOF >mise.toml | ||
| [task_config] | ||
| includes = ["gone.toml", "tasks.toml"] | ||
| EOF | ||
|
|
||
| # the surviving include still loads, and the dead one is now named | ||
| assert_contains "mise tasks 2>&1" "hello" | ||
| assert_contains "mise tasks 2>&1" "gone.toml" | ||
| assert_contains "mise tasks 2>&1" "does not exist" | ||
|
|
||
| # mise tasks validate reports it too, and says which include. | ||
| # These also pin the severity: assert_contains fails the test on a non-zero exit, and `validate` | ||
| # only exits non-zero when it found an *error*, so a passing assertion here is the warning-not-error | ||
| # check as well. | ||
| assert_contains "mise tasks validate 2>&1" "missing-include" | ||
| assert_contains "mise tasks validate --json 2>&1" "missing-include" | ||
|
|
||
| # a directory include is satisfied by the directory existing | ||
| mkdir -p mytasks | ||
| cat <<EOF >mytasks/fromdir | ||
| #!/usr/bin/env bash | ||
| echo "from dir" | ||
| EOF | ||
| chmod +x mytasks/fromdir | ||
|
|
||
| cat <<EOF >mise.toml | ||
| [task_config] | ||
| includes = ["mytasks", "tasks.toml"] | ||
| EOF | ||
|
|
||
| assert_contains "mise tasks 2>&1" "fromdir" | ||
| assert_not_contains "mise tasks 2>&1" "does not exist" | ||
|
|
||
| # The built-in default includes must never warn. Only one of the five default task directories | ||
| # usually exists, so warning on the rest would fire on nearly every mise invocation. | ||
| rm -f mise.toml | ||
| mkdir -p mise-tasks | ||
| cat <<EOF >mise-tasks/fromdefault | ||
| #!/usr/bin/env bash | ||
| echo "from default" | ||
| EOF | ||
| chmod +x mise-tasks/fromdefault | ||
|
|
||
| assert_contains "mise tasks 2>&1" "fromdefault" | ||
| assert_not_contains "mise tasks 2>&1" "does not exist" | ||
|
|
||
| # A glob matching nothing is the normal state of a directory whose task files are not written yet. | ||
| cat <<EOF >mise.toml | ||
| [task_config] | ||
| includes = ["empty/*.toml", "tasks.toml"] | ||
| EOF | ||
|
|
||
| assert_contains "mise tasks 2>&1" "hello" | ||
| assert_not_contains "mise tasks 2>&1" "does not exist" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.