{"record":{"id":"7e906ab007d6e441","repo":"linera-io/linera-protocol","slug":"tests-failed","errorCode":null,"errorMessage":"tests failed","messagePattern":"tests failed","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"linera-service/src/project.rs","lineNumber":111,"sourceCode":"        })?;\n        ensure!(\n            root.join(\"Cargo.toml\").exists(),\n            \"No Cargo.toml found at {}. \\\n             The path must point to a Rust project directory.\",\n            root.display()\n        );\n        Ok(Self { root })\n    }\n\n    /// Runs the unit and integration tests of an application.\n    pub fn test(&self) -> Result<()> {\n        let tests = Command::new(\"cargo\")\n            .arg(\"test\")\n            .args([\"--target\", CURRENT_PLATFORM])\n            .current_dir(&self.root)\n            .spawn()?\n            .wait()?;\n        ensure!(tests.success(), \"tests failed\");\n        Ok(())\n    }\n\n    /// Finds the workspace for a given crate. If the workspace\n    /// does not exist, returns the path of the crate.\n    fn workspace_root(&self) -> Result<&Path> {\n        let mut current_path = self.root.as_path();\n        loop {\n            let toml_path = current_path.join(\"Cargo.toml\");\n            if toml_path.exists() {\n                let toml = Manifest::from_path(toml_path)?;\n                if toml.workspace.is_some() {\n                    return Ok(current_path);\n                }\n            }\n            match current_path.parent() {\n                None => {\n                    break;","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-service/src/project.rs#L93-L129","documentation":"Project::test runs `cargo test --target <CURRENT_PLATFORM>` inside the project directory and surfaces any non-zero exit as 'tests failed'. This is the application's own Rust test suite failing, not Linera's; the wrapper itself carries no diagnostics, so cargo's output must be read separately.","triggerScenarios":"`linera project test <path>` where cargo test exits non-zero: failing assertions, compile errors in test code, or the CURRENT_PLATFORM rustup target not being installed.","commonSituations":"Broken application logic after edits; tests depending on external network or chain state; CI images missing the host platform target.","solutions":["Run `cargo test` in the project directory yourself to see the full failing output","Fix the failing assertions or test code","If cargo complains about the target, install it: `rustup target add <CURRENT_PLATFORM>`"],"exampleFix":"# before\n$ linera project test .\nerror: tests failed\n\n# after\n$ cd my-dapp && cargo test    # see full failure output, fix the tests\n$ cd .. && linera project test .","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"Wrap Project::test and, on the 'tests failed' anyhow error, re-run `cargo test` in the project directory to surface the failing test names — the wrapper propagates no cargo output, so the diagnostics must come from your own re-run.","preventionTips":["Run cargo test locally before linera project test or publish","Keep application tests hermetic (no network, no chain state)","Install the host rustup target in CI images"],"tags":["cli","project","cargo","testing"],"backgroundTag":"cargo-test-failed","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}