Skip to content

Commit

Permalink
[meta] prepare docs + releases
Browse files Browse the repository at this point in the history
  • Loading branch information
sunshowers committed Dec 10, 2024
1 parent f822dab commit 00e79ba
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 1 deletion.
5 changes: 5 additions & 0 deletions nextest-runner/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [0.69.0-b.3] - 2024-12-06

See the changelog for [cargo-nextest 0.9.86-b.3](https://nexte.st/changelog#0.9.86-b.3).

## [0.69.0-b.2] - 2024-12-06

See the changelog for [cargo-nextest 0.9.86-b.2](https://nexte.st/changelog#0.9.86-b.2).
Expand Down Expand Up @@ -506,6 +510,7 @@ Thanks to [Guiguiprim](https://github.com/Guiguiprim) for their contributions to

- Initial version.

[0.69.0-b.3]: https://github.com/nextest-rs/nextest/releases/tag/nextest-runner-0.69-0.b.3
[0.69.0-b.2]: https://github.com/nextest-rs/nextest/releases/tag/nextest-runner-0.69-0.b.2
[0.69.0-b.1]: https://github.com/nextest-rs/nextest/releases/tag/nextest-runner-0.69-0.b.1
[0.68.0]: https://github.com/nextest-rs/nextest/releases/tag/nextest-runner-0.68.0
Expand Down
3 changes: 2 additions & 1 deletion site/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,11 @@ nav:
- docs/configuration/per-test-overrides.md
- "More configuration":
- "Specifying platforms": docs/configuration/specifying-platforms.md
- "Environment variables": docs/configuration/env-vars.md
- "Minimum versions": docs/configuration/minimum-versions.md
- "Heavy tests": docs/configuration/threads-required.md
- "Mutual exclusion and rate-limiting": docs/configuration/test-groups.md
- "Environment variables": docs/configuration/env-vars.md
- "Extra arguments": docs/configuration/extra-args.md
- docs/configuration/setup-scripts.md
- Machine-readable output:
- "About output formats": docs/machine-readable/index.md
Expand Down
19 changes: 19 additions & 0 deletions site/src/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@ toc_depth: 1
This page documents new features and bugfixes for cargo-nextest. Please see the [stability
policy](https://nexte.st/docs/stability/) for how versioning works with cargo-nextest.

## [0.9.86-b.3] - 2024-12-09

Since beta 2:

### Added

- Added a way to pass in extra arguments to the test binary at runtime, via
`run-extra-args`. See [*Passing in extra arguments*].

### Fixed

- When [adding extra files to an archive], nextest now ignores empty and `.`
path components in the specification while joining the specified `path`. This
means that archives won't accidentally get duplicated entries.

[*Passing in extra arguments*]: https://nexte.st/docs/configuration/extra-args/
[adding extra files to an archive]: https://nexte.st/docs/ci-features/archiving/#adding-extra-files-to-an-archive

## [0.9.86-b.2] - 2024-12-06

Since beta 1:
Expand Down Expand Up @@ -1255,6 +1273,7 @@ Supported in this initial release:
- [Test retries](https://nexte.st/book/retries.md) and flaky test detection
- [JUnit support](https://nexte.st/book/junit.md) for integration with other test tooling

[0.9.86-b.3]: https://github.com/nextest-rs/nextest/releases/tag/cargo-nextest-0.9.86-b.3
[0.9.86-b.2]: https://github.com/nextest-rs/nextest/releases/tag/cargo-nextest-0.9.86-b.2
[0.9.86-b.1]: https://github.com/nextest-rs/nextest/releases/tag/cargo-nextest-0.9.86-b.1
[0.9.85]: https://github.com/nextest-rs/nextest/releases/tag/cargo-nextest-0.9.85
Expand Down
92 changes: 92 additions & 0 deletions site/src/docs/configuration/extra-args.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
icon: material/pencil
---

# Passing in extra arguments

<!-- md:version 0.9.86 -->

!!! warning

This is an advanced feature, and it can cause your tests to silently stop
working if used incorrectly. Use with caution.

In some situations, it can be helpful to pass extra arguments into a test binary
at runtime. Nextest supports `run-extra-args` for this purpose.

## Use case: running tests on the main thread

In some environments like macOS, the initial thread created for the process,
also known as the _main thread_ or _UI thread_, is special. Tests in these
environments will often require that they always be run on the main thread (see
[#1959]). This is sometimes called "single-threaded mode", but that is a bit of
a misnomer. What matters is that the main thread of the _test_ is the same as
the main thread of the _process_.

Even though nextest uses a separate process for each test, that isn't a
guarantee that the test will be run on the main thread of the process. In fact,
the standard libtest harness and most other harnesses will create a separate
thread to run the test in, and use the main thread only to manage the test
thread.

As a workaround, some custom test harnesses support passing in arguments to
force the test to run on the main thread. For example, with [libtest-mimic],
passing in `--test-threads=1` as an extra argument forces the test to run on the
main thread.

For more about custom test harnesses and libtest-mimic, see [*Custom test
harnesses*](../design/custom-test-harnesses.md).

!!! note "You must use a custom test harness"

If your goal is to run tests on the main thread of their corresponding
processes, `--test-threads=1` by itself will not by itself achieve that. The
standard libtest harness does not run tests on the main thread with
`--test-threads=1`: see [Cargo issue #104053].

You must also use a custom test harness. Our recommendation is
[libtest-mimic], which follows this behavior with `--test-threads=1`.

You may also use another custom test harness, though note the [compatibility
rules]. Your harness may use a different argument for this purpose; in that
case, replace `--test-threads=1` with the appropriate argument in the
examples below.

[#1959]: https://github.com/nextest-rs/nextest/discussions/1959
[Cargo issue #104053]: https://github.com/rust-lang/rust/issues/104053
[libtest-mimic]: https://github.com/LukasKalbertodt/libtest-mimic
[compatibility rules]: ../design/custom-test-harnesses.md#manually-implementing-a-test-harness

## Defining extra arguments

Extra arguments are typically defined via [per-test
settings](per-test-overrides.md).


To run all tests in the `gui-tests` package with the `--test-threads=1`
argument:

```toml title="Extra arguments in <code>.config/nextest.toml</code>"
[[profile.default.overrides]]
filter = "package(gui-tests)"
run-extra-args = ["--test-threads=1"]
```

You can also define extra arguments that apply globally to all tests:

```toml
[profile.default]
run-extra-args = ["--test-threads=1"]
```

Nextest's CI ensures that with libtest-mimic, the above configuration will run
tests on the main thread.

### Notes

Extra arguments are not passed in at list time, only at runtime. List-time extra
arguments may be supported in the future if there's a compelling use case.

Extra arguments are passed directly to the test binary, and nextest does not
interpret them in any way. Passing in the wrong arguments can cause your tests
to silently stop working.

0 comments on commit 00e79ba

Please sign in to comment.