diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e8ea875a6..98e2e8ec4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -89,6 +89,7 @@ jobs: ./test_curl_commands.sh tests/*.curl ./test_html_output.py tests/*.html xmllint --noout tests/*.html + ./report-html.sh - name: Archive production artifacts uses: actions/upload-artifact@v2 if: ${{ always() }} diff --git a/integration/report-html.sh b/integration/report-html.sh index b86b7abbf..553562885 100755 --- a/integration/report-html.sh +++ b/integration/report-html.sh @@ -4,13 +4,13 @@ set +e rm -rf report/* find tests -name "*.hurl" | sort | while read -r hurl_file; do - options=("--json report/tests.json" "--html report/html" "--output /dev/null") + options=("--json report/tests.json" "--report-html report/html" "--output /dev/null") if test -f "${hurl_file%.*}.options"; then options+=("$(cat "${hurl_file%.*}.options")") fi cmd="hurl $hurl_file ${options[*]}" echo "$cmd" - $cmd >/tmp/test.stdout 2>/tmp/test.stderr + $cmd exit_code=$? if [ "$exit_code" -gt 4 ]; then diff --git a/packages/hurl/src/cli/options.rs b/packages/hurl/src/cli/options.rs index e1b38ee2e..6bca32c27 100644 --- a/packages/hurl/src/cli/options.rs +++ b/packages/hurl/src/cli/options.rs @@ -227,6 +227,13 @@ pub fn app() -> App<'static, 'static> { .value_name("[PROTOCOL://]HOST[:PORT]") .help("Use proxy on given protocol/host/port"), ) + .arg( + clap::Arg::with_name("report_html") + .long("report-html") + .value_name("DIR") + .help("Generate html report to dir") + .takes_value(true), + ) .arg( clap::Arg::with_name("summary") .long("summary") @@ -311,7 +318,19 @@ pub fn parse_options(matches: ArgMatches) -> Result { let fail_fast = !matches.is_present("fail_at_end"); let file_root = matches.value_of("file_root").map(|value| value.to_string()); let follow_location = matches.is_present("follow_location"); - let html_dir = if let Some(dir) = matches.value_of("html") { + + // deprecated + // Support --report-html and --html only for the current version + if matches.is_present("html") { + eprintln!("The option --html is deprecated. It has been renamed to --report-html."); + eprintln!("It will be removed in the next version"); + } + let report_html = if let Some(dir) = matches.value_of("html") { + Some(dir) + } else { + matches.value_of("report_html") + }; + let html_dir = if let Some(dir) = report_html { let path = Path::new(dir); if !path.exists() { match std::fs::create_dir(path) {