forked from syntaxbullet/aurorabot
fix: Explicitly bind web server to 127.0.0.1 in tests and prevent the development build process from running in the test environment.
This commit is contained in:
@@ -92,11 +92,12 @@ import { createWebServer } from "./server";
|
||||
describe("Settings API", () => {
|
||||
let serverInstance: WebServerInstance;
|
||||
const PORT = 3009;
|
||||
const BASE_URL = `http://localhost:${PORT}`;
|
||||
const HOSTNAME = "127.0.0.1";
|
||||
const BASE_URL = `http://${HOSTNAME}:${PORT}`;
|
||||
|
||||
beforeEach(async () => {
|
||||
jest.clearAllMocks();
|
||||
serverInstance = await createWebServer({ port: PORT });
|
||||
serverInstance = await createWebServer({ port: PORT, hostname: HOSTNAME });
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
|
||||
@@ -37,7 +37,7 @@ export async function createWebServer(config: WebServerConfig = {}): Promise<Web
|
||||
|
||||
// Manage build process in development
|
||||
let buildProcess: Subprocess | undefined;
|
||||
const isDev = process.env.NODE_ENV !== "production";
|
||||
const isDev = process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test";
|
||||
|
||||
if (isDev) {
|
||||
logger.info("web", "Starting Web Bundler in Watch Mode...");
|
||||
|
||||
Reference in New Issue
Block a user