aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-02-24 20:34:09 -0800
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-02-24 20:34:09 -0800
commit0694bbce005a2b293d9506bedb752383c2a56750 (patch)
treeda7e9deba81ee6a6becd2bf56d920bd628d000d9
parent3bd12180de2ada44c20a7222b9990393e1cf12af (diff)
downloadbun-0694bbce005a2b293d9506bedb752383c2a56750.tar.gz
bun-0694bbce005a2b293d9506bedb752383c2a56750.tar.zst
bun-0694bbce005a2b293d9506bedb752383c2a56750.zip
Add a simple HMR test
Diffstat (limited to '')
-rw-r--r--integration/apps/bun-create-next.sh42
1 files changed, 40 insertions, 2 deletions
diff --git a/integration/apps/bun-create-next.sh b/integration/apps/bun-create-next.sh
index b92bff2c0..4f19e535d 100644
--- a/integration/apps/bun-create-next.sh
+++ b/integration/apps/bun-create-next.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+set -euo pipefail
+
# The important part of this test: make sure that bun.js successfully loads
# The most likely reason for this test to fail is that something broke in the JavaScriptCore <> bun integration
killall -9 $(basename $BUN_BIN) || echo ""
@@ -13,7 +15,43 @@ if (($?)); then
exit 1
fi
+echo "hi!" >/tmp/next-app/public/file.txt
+echo "export default 'string';" >/tmp/next-app/file.js
+
cd /tmp/next-app
-BUN_CRASH_WITHOUT_JIT=1 $BUN_BIN --port 8087 &
+BUN_CRASH_WITHOUT_JIT=1 $BUN_BIN dev --port 8087 &
sleep 0.1
-curl --fail http://localhost:8087/ && killall -9 $(basename $BUN_BIN) && echo "✅ bun create next passed."
+curl --fail -Ss http://localhost:8087/
+
+if [[ "$(curl --fail -sS http://localhost:8087/file.txt)" != "hi!" ]]; then
+ echo ""
+ echo ""
+ echo ""
+ echo "ERR: Expected 'hi!', got '$(curl --fail -sS http://localhost:8087/file.txt)'"
+ killall -9 $(basename $BUN_BIN) || echo ""
+ exit 1
+fi
+
+if [[ "$(curl --fail -sS http://localhost:8087/file.js)" != *"string"* ]]; then
+ echo ""
+ echo ""
+ echo ""
+ echo "ERR: Expected file to contain string got '$(curl --fail -sS http://localhost:8087/file.js)'"
+ killall -9 $(basename $BUN_BIN) || echo ""
+ exit 1
+fi
+
+# very simple HMR test
+echo "export default 'string';" >/tmp/next-app/file2.js
+sleep 0.1
+
+if [[ "$(curl --fail -sS http://localhost:8087/file2.js)" != *"string"* ]]; then
+ echo ""
+ echo ""
+ echo ""
+ echo "ERR: Expected file to contain string got '$(curl --fail -sS http://localhost:8087/file2.js)'"
+ killall -9 $(basename $BUN_BIN) || echo ""
+ exit 1
+fi
+
+killall -9 $(basename $BUN_BIN) || echo ""