Skip to content

Commit 44b9493

Browse files
authored
chore: prepare tracing-mock 0.1.0-beta.1 (#3167)
# 0.1.0-beta.1 (November 29, 2024) [ [crates.io][crate-0.1.0-beta.1] ] | [ [docs.rs][docs-0.1.0-beta.1] ] `tracing-mock` provides tools for making assertions about what `tracing` diagnostics are emitted by code under test. - Initial beta release [docs-0.1.0-beta.1]: https://docs.rs/tracing-mock/0.1.0-beta.1 [crate-0.1.0-beta.1]: https://crates.io/crates/tracing-mock/0.1.0-beta.1
1 parent 3a792eb commit 44b9493

File tree

3 files changed

+50
-28
lines changed

3 files changed

+50
-28
lines changed

tracing-mock/CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# 0.1.0-beta.1 (November 29, 2024)
2+
3+
[ [crates.io][crate-0.1.0-beta.1] ] | [ [docs.rs][docs-0.1.0-beta.1] ]
4+
5+
`tracing-mock` provides tools for making assertions about what `tracing`
6+
diagnostics are emitted by code under test.
7+
8+
- Initial beta release
9+
10+
[docs-0.1.0-beta.1]: https://docs.rs/tracing-mock/0.1.0-beta.1
11+
[crate-0.1.0-beta.1]: https://crates.io/crates/tracing-mock/0.1.0-beta.1

tracing-mock/Cargo.toml

+13-2
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,29 @@
44

55
[package]
66
name = "tracing-mock"
7-
version = "0.1.0"
7+
version = "0.1.0-beta.1"
88
authors = [
99
"Eliza Weisman <eliza@buoyant.io>",
10+
"Hayden Stainsby <hds@caffeineconcepts.com>",
1011
"Tokio Contributors <team@tokio.rs>",
1112
]
1213
license = "MIT"
1314
readme = "README.md"
1415
repository = "https://github.com/tokio-rs/tracing"
1516
homepage = "https://tokio.rs"
17+
description = """
18+
Utilities for testing `tracing` and crates that uses it.
19+
"""
20+
categories = [
21+
"development-tools::testing"
22+
]
23+
keywords = [
24+
"tracing",
25+
"mock",
26+
"testing"
27+
]
1628
edition = "2018"
1729
rust-version = "1.63.0"
18-
publish = false
1930

2031
[dependencies]
2132
tracing = { path = "../tracing", version = "0.1.41", features = ["std", "attributes"], default-features = false }

tracing-mock/README.md

+26-26
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,21 @@
66

77
Utilities for testing [`tracing`] and crates that uses it.
88

9+
[![Crates.io][crates-badge]][crates-url]
10+
[![Documentation][docs-badge]][docs-url]
911
[![Documentation (master)][docs-master-badge]][docs-master-url]
1012
[![MIT licensed][mit-badge]][mit-url]
1113
[![Build Status][actions-badge]][actions-url]
1214
[![Discord chat][discord-badge]][discord-url]
1315

1416
[Documentation][docs-master-url] | [Chat][discord-url]
1517

18+
[crates-badge]: https://img.shields.io/crates/v/tracing-mock.svg
19+
[crates-url]: https://crates.io/crates/tracing-mock
20+
[docs-badge]: https://docs.rs/tracing-mock/badge.svg
21+
[docs-url]: https://docs.rs/tracing-mock/latest
1622
[docs-master-badge]: https://img.shields.io/badge/docs-master-blue
17-
[docs-master-url]: https://tracing-rs.netlify.com/tracing_mock
23+
[docs-master-url]: https://tracing.rs/tracing_mock
1824
[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg
1925
[mit-url]: https://github.com/tokio-rs/tracing/blob/master/tracing-mock/LICENSE
2026
[actions-badge]: https://github.com/tokio-rs/tracing/workflows/CI/badge.svg
@@ -32,40 +38,35 @@ by code under test.
3238
*Compiler support: [requires `rustc` 1.63+][msrv]*
3339

3440
[msrv]: #supported-rust-versions
41+
[`tracing`]: https://github.com/tokio-rs/tracing
3542

3643
## Usage
3744

38-
`tracing-mock` crate provides a mock
39-
[`Collector`](https://tracing-rs.netlify.app/tracing/#collectors)
40-
that allows asserting on the order and contents of
41-
[spans](https://tracing-rs.netlify.app/tracing/#spans) and
42-
[events](https://tracing-rs.netlify.app/tracing/#events).
45+
The `tracing-mock` crate provides a mock [`Subscriber`][tracing-subscriber] that
46+
allows asserting on the order and contents of [spans][tracing-spans] and
47+
[events][tracing-events].
4348

44-
As `tracing-mock` isn't available on [crates.io](https://crates.io/)
45-
yet, you must import it via git. When using `tracing-mock` with the
46-
`tracing` `0.1` ecosystem, it is important that you also override the
47-
source of any `tracing` crates that are transient dependencies. For
48-
example, the `Cargo.toml` for your test crate could contain:
49+
To get started with `tracing-mock`, check the documentation in the
50+
[`subscriber`][mock-subscriber-mod] module and [`MockSubscriber`] struct.
4951

50-
```toml
51-
[dependencies]
52-
lib-under-test = "1.0" # depends on `tracing`
52+
While `tracing-mock` is in beta, it is recommended that an exact version is
53+
specified in the cargo manifest. Otherwise, `cargo update` will take the latest
54+
beta version, which may contain breaking changes compared to previous betas.
5355

54-
[dev-dependencies]
55-
tracing-mock = { git = "https://github.com/tokio-rs/tracing", branch = "v0.1.x", version = "0.1" }
56-
tracing = { git = "https://github.com/tokio-rs/tracing", branch = "v0.1.x", version = "0.1" }
56+
To do so, add the following to `Cargo.toml`:
5757

58-
[patch.crates-io]
59-
tracing = { git = "https://github.com/tokio-rs/tracing", branch = "v0.1.x" }
60-
tracing-core = { git = "https://github.com/tokio-rs/tracing", branch = "v0.1.x" }
58+
```toml
59+
[dependencies]
60+
tracing-mock = "= 0.1.0-beta.1"
6161
```
6262

63-
## Examples
63+
[tracing-spans]: https://docs.rs/tracing/0.1/tracing/#spans
64+
[tracing-events]: https://docs.rs/tracing/0.1/tracing/#events
65+
[tracing-subscriber]: https://docs.rs/tracing/0.1/tracing/trait.Subscriber.html
66+
[mock-subscriber-mod]: https://docs.rs/tracing-mock/0.1.0-beta.1/tracing_mock/subscriber/index.html
67+
[`MockSubscriber`]: https://docs.rs/tracing-mock/0.1.0-beta.1/tracing_mock/subscriber/struct.MockSubscriber.html
6468

65-
The following examples are for the `master` branch. For examples that
66-
will work with `tracing` from [crates.io], please check the
67-
[v0.1.x](https://github.com/tokio-rs/tracing/tree/v0.1.x/tracing-mock)
68-
branch.
69+
## Examples
6970

7071
Below is an example that checks that an event contains a message:
7172

@@ -87,7 +88,6 @@ with_default(subscriber, || {
8788
});
8889

8990
handle.assert_finished();
90-
9191
```
9292

9393
Below is a slightly more complex example. `tracing-mock` asserts that, in order:

0 commit comments

Comments
 (0)