Skip to content

Commit

Permalink
test: run workerd tests with and without nodejs_compat
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Feb 17, 2025
1 parent 5ea4d48 commit 50a90a5
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions tap/.workerd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ echo "Using workerd $WORKERD_VERSION, compatibility date $COMPATIBILITY_DATE"
--outfile=tap/run-workerd.js \
tap/run-workerd.ts

cat <<EOT > $(pwd)/tap/.workerd.capnp
generate_capnp() {
local compatibility_flags=$1
cat <<EOT > $(pwd)/tap/.workerd.capnp
using Workerd = import "/workerd/workerd.capnp";
const config :Workerd.Config = (
Expand All @@ -28,7 +30,30 @@ const tapWorker :Workerd.Worker = (
(name = "worker", esModule = embed "run-workerd.js")
],
compatibilityDate = "$COMPATIBILITY_DATE",
compatibilityFlags = $compatibility_flags
);
EOT
}

workerd test --verbose $(pwd)/tap/.workerd.capnp
run_test() {
local compatibility_flags=$1
generate_capnp "$compatibility_flags"
workerd test --verbose $(pwd)/tap/.workerd.capnp
return $?
}

run_test "[]"
NO_COMPAT=$?

run_test '["nodejs_compat"]'
COMPAT=$?

echo ""
echo "Workerd without nodejs_compat"
test $NO_COMPAT -eq 0 && echo " passed" || echo " failed"

echo ""
echo "Workerd with nodejs_compat"
test $COMPAT -eq 0 && echo " passed" || echo " failed"

test $NO_COMPAT -eq 0 && test $COMPAT -eq 0

0 comments on commit 50a90a5

Please sign in to comment.