Skip to main content

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    pub const NO_TESTS_RUN: i32 = 4;
27
28    /// One or more tests failed.
29    pub const TEST_RUN_FAILED: i32 = 100;
30
31    /// Creating an archive produced an error.
32    pub const ARCHIVE_CREATION_FAILED: i32 = 103;
33
34    /// Creating a test list produced an error.
35    pub const TEST_LIST_CREATION_FAILED: i32 = 104;
36
37    /// A setup script failed.
38    pub const SETUP_SCRIPT_FAILED: i32 = 105;
39
40    /// `cargo nextest replay` was run on an incomplete run.
41    pub const INCOMPLETE_RUN: i32 = 106;
42
43    /// Writing data to stdout or stderr produced an error.
44    pub const WRITE_OUTPUT_ERROR: i32 = 110;
45
46    /// Downloading an update resulted in an error.
47    pub const UPDATE_ERROR: i32 = 90;
48
49    /// An update was available and `--check` was requested.
50    pub const UPDATE_AVAILABLE: i32 = 80;
51
52    /// A downgrade was requested but not performed.
53    pub const UPDATE_DOWNGRADE_NOT_PERFORMED: i32 = 81;
54
55    // TODO: change this to UPDATE_CANCELLED
56    /// An update was available but the user cancelled it.
57    pub const UPDATE_CANCELED: i32 = 82;
58
59    /// A user issue happened while setting up a nextest invocation.
60    pub const SETUP_ERROR: i32 = 96;
61
62    /// An experimental feature was used without the environment variable to enable it.
63    pub const EXPERIMENTAL_FEATURE_NOT_ENABLED: i32 = 95;
64
65    /// A filterset failed to parse.
66    pub const INVALID_FILTERSET: i32 = 94;
67
68    /// A self-update was requested but this version of cargo-nextest cannot perform self-updates.
69    pub const SELF_UPDATE_UNAVAILABLE: i32 = 93;
70
71    /// The current version of nextest did not meet repository or tool requirements.
72    ///
73    /// *Since nextest 0.9.55*.
74    pub const REQUIRED_VERSION_NOT_MET: i32 = 92;
75
76    /// The current version of nextest is older than the minimum recommended version.
77    ///
78    /// This advisory exit code is only produced by `cargo nextest show-config version`.
79    ///
80    /// *Since nextest 0.9.55*.
81    pub const RECOMMENDED_VERSION_NOT_MET: i32 = 10;
82
83    /// All tests in this run passed, but some outstanding tests from the rerun
84    /// chain were not run (due to a narrowed scope).
85    ///
86    /// This exit code indicates a partial success: the tests that ran all
87    /// passed, but additional reruns are needed to complete the full test suite.
88    pub const RERUN_TESTS_OUTSTANDING: i32 = 5;
89}