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", () => {
|
describe("Settings API", () => {
|
||||||
let serverInstance: WebServerInstance;
|
let serverInstance: WebServerInstance;
|
||||||
const PORT = 3009;
|
const PORT = 3009;
|
||||||
const BASE_URL = `http://localhost:${PORT}`;
|
const HOSTNAME = "127.0.0.1";
|
||||||
|
const BASE_URL = `http://${HOSTNAME}:${PORT}`;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
jest.clearAllMocks();
|
jest.clearAllMocks();
|
||||||
serverInstance = await createWebServer({ port: PORT });
|
serverInstance = await createWebServer({ port: PORT, hostname: HOSTNAME });
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export async function createWebServer(config: WebServerConfig = {}): Promise<Web
|
|||||||
|
|
||||||
// Manage build process in development
|
// Manage build process in development
|
||||||
let buildProcess: Subprocess | undefined;
|
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) {
|
if (isDev) {
|
||||||
logger.info("web", "Starting Web Bundler in Watch Mode...");
|
logger.info("web", "Starting Web Bundler in Watch Mode...");
|
||||||
|
|||||||
Reference in New Issue
Block a user