Skip to content

Commit

Permalink
Make integration tests only run when the flavor is supported
Browse files Browse the repository at this point in the history
  • Loading branch information
jhugman committed Dec 4, 2024
1 parent eb821d1 commit 69f6936
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion scripts/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,23 @@ while (( "$#" )); do
esac
done

supports_flavor() {
local fixture="$1"
local flavor="$2"

if [[ "$flavor" == "jsi" ]]; then
return 0
fi

local flavor_file="${fixture}/tests/bindings/.supported-flavors.txt"
if [[ -f "$flavor_file" ]]; then
if grep -q "$flavor" "$flavor_file"; then
return 0
fi
fi

return 1
}

for test in "${root}"/typescript/tests/*.test.ts ; do
echo "Running test $test"
Expand All @@ -43,13 +60,21 @@ for fixture in ${fixtures} ; do
if [[ " ${excluded_fixtures[@]} " =~ " ${fixture} " ]]; then
continue
fi
echo "Running fixture ${fixture}"

# This should all go in either an xtask or into our uniffi-bindgen command.
# This builds the crate into the target dir.
fixture_dir="${root}/fixtures/${fixture}"

if ! supports_flavor "${fixture_dir}" "${flavor}"; then
echo "Skipping fixture ${fixture}"
continue
fi

test_file="${fixture_dir}/tests/bindings/test_${fixture//-/_}.ts"
config_file="${fixture_dir}/uniffi.toml"
out_dir="${fixture_dir}/generated"

echo "Running fixture ${fixture}"
rm -Rf "${out_dir}" 2>/dev/null

cpp_dir="${out_dir}/cpp"
Expand Down

0 comments on commit 69f6936

Please sign in to comment.