aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/bun.js/websocket.test.js35
1 files changed, 25 insertions, 10 deletions
diff --git a/test/bun.js/websocket.test.js b/test/bun.js/websocket.test.js
index 6a30f4c11..9bd114c47 100644
--- a/test/bun.js/websocket.test.js
+++ b/test/bun.js/websocket.test.js
@@ -3,6 +3,7 @@ import { unsafe, spawn, readableStreamToText } from "bun";
import { bunExe } from "bunExe";
import { gc } from "./gc";
+import { bunEnv } from "bunEnv";
const TEST_WEBSOCKET_HOST =
process.env.TEST_WEBSOCKET_HOST || "wss://ws.postman-echo.com/raw";
@@ -135,10 +136,11 @@ describe("WebSocket", () => {
});
describe("websocket in subprocess", () => {
+ var port = 8765;
it("should exit", async () => {
let messageReceived = false;
const server = Bun.serve({
- port: 8765,
+ port: port++,
fetch(req, server) {
if (server.upgrade(req)) {
return;
@@ -160,12 +162,13 @@ describe("websocket in subprocess", () => {
const subprocess = Bun.spawn({
cmd: [
bunExe(),
- "websocket-subprocess.ts",
+ import.meta.dir + "/websocket-subprocess.ts",
`http://${server.hostname}:${server.port}`,
],
stderr: "pipe",
stdin: "pipe",
stdout: "pipe",
+ env: bunEnv,
});
expect(await subprocess.exited).toBe(0);
@@ -175,10 +178,15 @@ describe("websocket in subprocess", () => {
it("should exit after killed", async () => {
const subprocess = Bun.spawn({
- cmd: [bunExe(), "websocket-subprocess.ts", TEST_WEBSOCKET_HOST],
+ cmd: [
+ bunExe(),
+ import.meta.dir + "/websocket-subprocess.ts",
+ TEST_WEBSOCKET_HOST,
+ ],
stderr: "pipe",
stdin: "pipe",
stdout: "pipe",
+ env: bunEnv,
});
subprocess.kill();
@@ -188,10 +196,15 @@ describe("websocket in subprocess", () => {
it("should exit with invalid url", async () => {
const subprocess = Bun.spawn({
- cmd: [bunExe(), "websocket-subprocess.ts", "invalid url"],
+ cmd: [
+ bunExe(),
+ import.meta.dir + "/websocket-subprocess.ts",
+ "invalid url",
+ ],
stderr: "pipe",
stdin: "pipe",
stdout: "pipe",
+ env: bunEnv,
});
expect(await subprocess.exited).toBe(1);
@@ -201,7 +214,7 @@ describe("websocket in subprocess", () => {
let messageReceived = false;
let start = 0;
const server = Bun.serve({
- port: 8765,
+ port: port++,
fetch(req, server) {
if (server.upgrade(req)) {
return;
@@ -225,22 +238,23 @@ describe("websocket in subprocess", () => {
const subprocess = Bun.spawn({
cmd: [
bunExe(),
- "websocket-subprocess.ts",
+ import.meta.dir + "/websocket-subprocess.ts",
`http://${server.hostname}:${server.port}`,
],
stderr: "pipe",
stdin: "pipe",
stdout: "pipe",
+ env: bunEnv,
});
expect(await subprocess.exited).toBe(0);
expect(messageReceived).toBe(true);
- server.stop();
+ server.stop(true);
});
it("should exit after server stop and 0 messages", async () => {
const server = Bun.serve({
- port: 8765,
+ port: port++,
fetch(req, server) {
if (server.upgrade(req)) {
return;
@@ -258,15 +272,16 @@ describe("websocket in subprocess", () => {
const subprocess = Bun.spawn({
cmd: [
bunExe(),
- "websocket-subprocess.ts",
+ import.meta.dir + "/websocket-subprocess.ts",
`http://${server.hostname}:${server.port}`,
],
stderr: "pipe",
stdin: "pipe",
stdout: "pipe",
+ env: bunEnv,
});
- server.stop();
+ server.stop(true);
expect(await subprocess.exited).toBe(0);
});
});
ss='logmsg'> * fix: avoid error on collectionType === 'unknown' * fix: ignore underscores in file globs * chore: clarify [!_] * fix: mismatch error not throwing * fix: bad collectionType var * test: no error for empty collection * chore: changeset 2023-05-30[ci] formatGravatar bholmesdev 4-5/+5 2023-05-30Markdoc - remove `$entry` variable (#7244)Gravatar Ben Holmes 16-257/+217 * refactor: remove entry prop from `getRenderModule()` * refactor: remove `$entry` from markdoc * test: update entry-prop -> variables test * refactor: unify `getEntryConfigByExt` * chore: clean up shared content / data get logic * docs: update `$entry` recommendation * chore: rename entry-prop -> variables * chore: changeset * chore: missed a spot 2023-05-30Markdoc: new README for Markdoc nodes (#7225)Gravatar Ben Holmes 1-46/+85 * docs: all-new nodes documentation * edit: `.astro` ONLY Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * edit: `.` outside links, line break Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * edit: such as, not like Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * edit: more Astro less probs Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * edit: reviewers React to Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * edit: tagz Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * chore: add `default: 'article'` for document * edit: reword client-side instructions * edit: prism stylesheet got lost * fix: heading -> blockquote --------- Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> 2023-05-30[ci] formatGravatar MoustaphaDev 1-1/+1 2023-05-30fix: prioritize dynamic prerendered routes over dynamic server routes (#7235)Gravatar Happydev 6-19/+361 * test: add unit tests * fix: prioritize prerendered routes * chore: fix test * add comment * test: try avoiding race condition * chore: changeset * try avoiding race conditions attempt #2 * try avoiding race conditions (attempt 3) * final fix hopefuly * tet: add more tests * sort conflicting dynamic routes aplhabetically * test: fix test 2023-05-30[ci] formatGravatar matthewp 1-5/+8 2023-05-30Bug 6672 (#7062)Gravatar wulinsheng123 10-0/+138 * fix miss a head when the templaterender has a promise * fix * add some test * test files move to md directory * fix add * delect file --------- Co-authored-by: wuls <linsheng.wu@beantechs.com>