Stream: contributing

Topic: Json CI failure Question


view this post on Zulip Luke Boswell (Apr 12 2023 at 08:13):

Question regarding #5163 CI failure.

I would love to know why I am not seeing these failures when I run tests locally?

I'm pretty confident I have fixed the bugs in the implementation I was seeing before. Now I wonder I am missing something else that is specific to CI?

This is how I am reproducing the tests locally.

% cargo test --release -p test_gen --test test_gen

## gives

test result: ok. 1297 passed; 0 failed; 21 ignored; 0 measured; 0 filtered out; finished in 531.06s

Here is one that is a FAIL on that last CI run.

fn decode_record_two_fields_string_and_string_infer_local_var_destructured() {
    assert_evals_to!(
        indoc!(
            r#"
            app "test" imports [Json] provides [main] to "./platform"

            main =
                decoded = Str.toUtf8 "{\"first\":\"ab\",\"second\":\"cd\"}" |> Decode.fromBytes Json.fromUtf8
                when decoded is
                    Ok {first, second} -> Str.concat first second
                    _ -> "something went wrong"
            "#
        ),
        RocStr::from("abcd"),
        RocStr
    )
}

However if I add it like this to the Json builtin and run cargo run --release -- test crates/compiler/builtins/roc/Json.roc it is a PASS.

expect
    input = Str.toUtf8 "{\"first\":\"ab\",\"second\":\"cd\"}"
    actual =
        when Decode.fromBytes input fromUtf8 is
            Ok {first, second} -> Str.concat first second
            _ -> "something went wrong"

    actual == "abcd"

view this post on Zulip Anton (Apr 12 2023 at 09:05):

I think you need to explicitly enable the gen-wasm feature like this:

cargo test --locked --release --package test_gen --no-default-features --features gen-wasm -- --test-threads=1

view this post on Zulip Luke Boswell (Apr 12 2023 at 09:12):

Thank you. I'll see if I can figure out why they fail in the rust tests, but not in Roc tests.

view this post on Zulip Brendan Hansknecht (Apr 12 2023 at 14:43):

Also, we have a shortcut command for that cargo test-gen-wasm and cargo test-gen-llvm-wasm


Last updated: Jul 06 2025 at 12:14 UTC