nextest_metadata/
exit_codes.rs

1// Copyright (c) The nextest Contributors
2// SPDX-License-Identifier: MIT OR Apache-2.0
3
4/// Documented exit codes for `cargo nextest` failures.
5///
6/// `cargo nextest` runs may fail for a variety of reasons. This structure documents the exit codes
7/// that may occur in case of expected failures.
8///
9/// Unknown/unexpected failures will always result in exit code 1.
10pub enum NextestExitCode {}
11
12impl NextestExitCode {
13    /// No errors occurred and nextest exited normally.
14    pub const OK: i32 = 0;
15
16    /// Running `cargo metadata` produced an error.
17    pub const CARGO_METADATA_FAILED: i32 = 102;
18
19    /// Building tests produced an error.
20    pub const BUILD_FAILED: i32 = 101;
21
22    /// An error was encountered while attempting to double-spawn a nextest process.
23    pub const DOUBLE_SPAWN_ERROR: i32 = 70;
24
25    /// No tests were selected to run, but no other errors occurred.
26    ///
27    /// This is an advisory exit code generated if nextest is run with `--no-tests=fail` (soon to
28    /// become the default). See [discussion #1646] for more.
29    ///
30    /// [discussion #1646]: https://github.com/nextest-rs/nextest/discussions/1646
31    pub const NO_TESTS_RUN: i32 = 4;
32
33    /// One or more tests failed.
34    pub const TEST_RUN_FAILED: i32 = 100;
35
36    /// Creating an archive produced an error.
37    pub const ARCHIVE_CREATION_FAILED: i32 = 103;
38
39    /// Creating a test list produced an error.
40    pub const TEST_LIST_CREATION_FAILED: i32 = 104;
41
42    /// A setup script failed.
43    pub const SETUP_SCRIPT_FAILED: i32 = 105;
44
45    /// `cargo nextest replay` was run on an incomplete run.
46    pub const INCOMPLETE_RUN: i32 = 106;
47
48    /// Writing data to stdout or stderr produced an error.
49    pub const WRITE_OUTPUT_ERROR: i32 = 110;
50
51    /// Downloading an update resulted in an error.
52    pub const UPDATE_ERROR: i32 = 90;
53
54    /// An update was available and `--check` was requested.
55    pub const UPDATE_AVAILABLE: i32 = 80;
56
57    /// A downgrade was requested but not performed.
58    pub const UPDATE_DOWNGRADE_NOT_PERFORMED: i32 = 81;
59
60    // TODO: change this to UPDATE_CANCELLED
61    /// An update was available but the user cancelled it.
62    pub const UPDATE_CANCELED: i32 = 82;
63
64    /// A user issue happened while setting up a nextest invocation.
65    pub const SETUP_ERROR: i32 = 96;
66
67    /// An experimental feature was used without the environment variable to enable it.
68    pub const EXPERIMENTAL_FEATURE_NOT_ENABLED: i32 = 95;
69
70    /// A filterset failed to parse.
71    pub const INVALID_FILTERSET: i32 = 94;
72
73    /// A self-update was requested but this version of cargo-nextest cannot perform self-updates.
74    pub const SELF_UPDATE_UNAVAILABLE: i32 = 93;
75
76    /// The current version of nextest did not meet repository or tool requirements.
77    ///
78    /// *Since nextest 0.9.55*.
79    pub const REQUIRED_VERSION_NOT_MET: i32 = 92;
80
81    /// The current version of nextest is older than the minimum recommended version.
82    ///
83    /// This advisory exit code is only produced by `cargo nextest show-config version`.
84    ///
85    /// *Since nextest 0.9.55*.
86    pub const RECOMMENDED_VERSION_NOT_MET: i32 = 10;
87}