Skip to content

Commit

Permalink
Make browser test ws url configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
baelter committed Feb 7, 2025
1 parent eb22dd8 commit fef5ce6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"docs": "typedoc src/index.ts",
"lint": "eslint .",
"test": "vitest run --coverage",
"test-browser": "vitest --config ./vitest.config.browser.ts",
"test-browser": "VITE_WS_URL=$WS_URL vitest --config ./vitest.config.browser.ts",
"prebuild": "rm -rf dist lib types",
"build": "tsc && tsc --module commonjs --outDir lib/cjs && tsc --emitDeclarationOnly --removeComments false && rollup -c",
"postbuild": "echo '{\"type\": \"commonjs\"}' > lib/cjs/package.json",
Expand Down
8 changes: 5 additions & 3 deletions test-browser/websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import { AMQPWebSocketClient } from '../src/amqp-websocket-client.js';
import { AMQPMessage } from '../src/amqp-message.js';
import type { AMQPError } from "../src/amqp-error.js";

const WS_URL = import.meta.env.VITE_WS_URL || "ws://127.0.0.1:15670/ws/amqp"

function getNewClient(init?: {frameMax?: number, heartbeat?: number}): AMQPWebSocketClient {
return init
? new AMQPWebSocketClient({ url: "ws://127.0.0.1:15670/ws/amqp", ...init })
: new AMQPWebSocketClient("ws://127.0.0.1:15670/ws/amqp")
return init
? new AMQPWebSocketClient({ url: WS_URL, ...init })
: new AMQPWebSocketClient(WS_URL)
}

beforeEach(() => {
Expand Down

0 comments on commit fef5ce6

Please sign in to comment.