mirror of
https://github.com/nushell/nushell
synced 2024-12-26 04:53:09 +00:00
feature: add the standard library tests to the PR template and the toolkit (#8629)
Related to #8525. # Description With #8525, the tests for the standard library have been enabled in the CI. The only places where these tests are missing are - the PR template - the toolkit This PR adds - `cargo run -- crates/nu-utils/standard_library/tests.nu` to the PR template - the same command as `toolkit test stdlib` - the `test stdlib` command to `toolkit check pr` # User-Facing Changes ``` $nothing ``` # Tests + Formatting the new output of `toolkit check pr`, with the same color code: > - 🟢 `toolkit fmt` > - 🟢 `toolkit clippy` > - 🟢 `toolkit test` > - 🟢 `toolkit test stdlib` # After Submitting ``` $nothing ```
This commit is contained in:
parent
bc6948dc89
commit
1ed645c6c2
2 changed files with 22 additions and 6 deletions
1
.github/pull_request_template.md
vendored
1
.github/pull_request_template.md
vendored
|
@ -18,6 +18,7 @@ Make sure you've run and fixed any issues with these commands:
|
||||||
- `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes)
|
- `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes)
|
||||||
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect` to check that you're using the standard code style
|
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect` to check that you're using the standard code style
|
||||||
- `cargo test --workspace` to check that all tests pass
|
- `cargo test --workspace` to check that all tests pass
|
||||||
|
- `cargo run -- crates/nu-utils/standard_library/tests.nu` to run the tests for the standard library
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
> from `nushell` you can also use the `toolkit` as follows
|
> from `nushell` you can also use the `toolkit` as follows
|
||||||
|
|
27
toolkit.nu
27
toolkit.nu
|
@ -35,6 +35,11 @@ export def test [
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# run the tests for the standard library
|
||||||
|
export def "test stdlib" [] {
|
||||||
|
cargo run -- crates/nu-utils/standard_library/tests.nu
|
||||||
|
}
|
||||||
|
|
||||||
# print the pipe input inside backticks, dimmed and italic, as a pretty command
|
# print the pipe input inside backticks, dimmed and italic, as a pretty command
|
||||||
def pretty-print-command [] {
|
def pretty-print-command [] {
|
||||||
$"`(ansi default_dimmed)(ansi default_italic)($in)(ansi reset)`"
|
$"`(ansi default_dimmed)(ansi default_italic)($in)(ansi reset)`"
|
||||||
|
@ -53,15 +58,18 @@ def report [
|
||||||
--fail-fmt: bool
|
--fail-fmt: bool
|
||||||
--fail-clippy: bool
|
--fail-clippy: bool
|
||||||
--fail-test: bool
|
--fail-test: bool
|
||||||
|
--fail-test-stdlib: bool
|
||||||
--no-fail: bool
|
--no-fail: bool
|
||||||
] {
|
] {
|
||||||
[fmt clippy test] | wrap stage
|
[fmt clippy test "test stdlib"]
|
||||||
|
| wrap stage
|
||||||
| merge (
|
| merge (
|
||||||
if $no_fail { [true true true] }
|
if $no_fail { [true true true true] }
|
||||||
else if $fail_fmt { [false $nothing $nothing] }
|
else if $fail_fmt { [false $nothing $nothing $nothing] }
|
||||||
else if $fail_clippy { [true false $nothing] }
|
else if $fail_clippy { [true false $nothing $nothing] }
|
||||||
else if $fail_test { [true true false] }
|
else if $fail_test { [true true false $nothing] }
|
||||||
else { [$nothing $nothing $nothing] }
|
else if $fail_test_stdlib { [true true true false] }
|
||||||
|
else { [$nothing $nothing $nothing $nothing] }
|
||||||
| wrap success
|
| wrap success
|
||||||
)
|
)
|
||||||
| upsert emoji {|it|
|
| upsert emoji {|it|
|
||||||
|
@ -194,5 +202,12 @@ export def "check pr" [
|
||||||
return (report --fail-test)
|
return (report --fail-test)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print $"running ('toolkit test stdlib' | pretty-print-command)"
|
||||||
|
try {
|
||||||
|
test stdlib
|
||||||
|
} catch {
|
||||||
|
return (report --fail-test-stdlib)
|
||||||
|
}
|
||||||
|
|
||||||
report --no-fail
|
report --no-fail
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue