()
| 447 | #[test] |
| 448 | #[serial] |
| 449 | fn json_parser_errors_emit_error_envelopes() { |
| 450 | let env = TestEnv::new(); |
| 451 | |
| 452 | let root_missing = env |
| 453 | .command() |
| 454 | .args(["--output", "json"]) |
| 455 | .output() |
| 456 | .expect("nodeup --output json without subcommand"); |
| 457 | assert_json_parser_error(root_missing, "requires a subcommand"); |
| 458 | |
| 459 | let conflicting_flags = env |
| 460 | .command() |
| 461 | .args([ |
| 462 | "--output", |
| 463 | "json", |
| 464 | "toolchain", |
| 465 | "list", |
| 466 | "--quiet", |
| 467 | "--verbose", |
| 468 | ]) |
| 469 | .output() |
| 470 | .expect("nodeup --output json toolchain list conflict"); |
| 471 | assert_json_parser_error(conflicting_flags, "cannot be used with '--verbose'"); |
| 472 | |
| 473 | let missing_nested_arg = env |
| 474 | .command() |
| 475 | .args(["--output", "json", "toolchain", "link", "local-node"]) |
| 476 | .output() |
| 477 | .expect("nodeup --output json toolchain link missing path"); |
| 478 | assert_json_parser_error(missing_nested_arg, "required arguments were not provided"); |
| 479 | |
| 480 | let missing_install_runtime = env |
| 481 | .command() |
| 482 | .args(["--output", "json", "toolchain", "install"]) |
| 483 | .output() |
| 484 | .expect("nodeup --output json toolchain install missing runtime"); |
| 485 | assert_json_parser_error( |
| 486 | missing_install_runtime, |
| 487 | "required arguments were not provided", |
| 488 | ); |
| 489 | |
| 490 | let missing_uninstall_runtime = env |
| 491 | .command() |
| 492 | .args(["--output", "json", "toolchain", "uninstall"]) |
| 493 | .output() |
| 494 | .expect("nodeup --output json toolchain uninstall missing runtime"); |
| 495 | assert_json_parser_error( |
| 496 | missing_uninstall_runtime, |
| 497 | "required arguments were not provided", |
| 498 | ); |
| 499 | |
| 500 | let unknown_command = env |
| 501 | .command() |
| 502 | .args(["--output", "json", "unknown-command"]) |
| 503 | .output() |
| 504 | .expect("nodeup --output json unknown command"); |
| 505 | assert_json_parser_error(unknown_command, "unrecognized subcommand"); |
| 506 |
nothing calls this directly
no test coverage detected