From 50a90a5dddcd5be234269bd1846b6ba43970043d Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Sat, 15 Feb 2025 16:04:00 +0100 Subject: [PATCH] test: run workerd tests with and without nodejs_compat --- tap/.workerd.sh | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/tap/.workerd.sh b/tap/.workerd.sh index 59a454ee2c..385f0b22fb 100755 --- a/tap/.workerd.sh +++ b/tap/.workerd.sh @@ -14,7 +14,9 @@ echo "Using workerd $WORKERD_VERSION, compatibility date $COMPATIBILITY_DATE" --outfile=tap/run-workerd.js \ tap/run-workerd.ts -cat < $(pwd)/tap/.workerd.capnp +generate_capnp() { + local compatibility_flags=$1 + cat < $(pwd)/tap/.workerd.capnp using Workerd = import "/workerd/workerd.capnp"; const config :Workerd.Config = ( @@ -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