upload file size limit increased in server.ts
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 1m9s

This commit is contained in:
2025-11-22 23:41:41 -08:00
parent d4d1857a04
commit 1e54b0754b
3 changed files with 25 additions and 18 deletions

View File

@@ -1,6 +1,5 @@
import { exec, ChildProcess } from 'child_process';
import { setup as globalSetup } from './global-setup';
import { pingBackend } from '../../services/apiClient';
import { logger } from '../../services/logger';
import { getPool } from '../../services/db/connection'; // Import getPool
@@ -33,6 +32,22 @@ export async function setup() {
console.error(`[SERVER STDERR]: ${data}`);
});
/**
* A local ping function that respects the VITE_API_BASE_URL from the test environment.
* This is necessary because the global apiClient's URL is configured for browser use.
*/
const pingTestBackend = async (): Promise<boolean> => {
const apiUrl = process.env.VITE_API_BASE_URL || 'http://localhost:3001/api';
try {
const response = await fetch(`${apiUrl.replace('/api', '')}/api/health/ping`);
if (!response.ok) return false;
const text = await response.text();
return text === 'pong';
} catch (error) {
return false;
}
};
const maxRetries = 10;
const retryDelay = 1000;
for (let i = 0; i < maxRetries; i++) {
@@ -42,7 +57,7 @@ export async function setup() {
throw new Error(`Server process exited with code ${serverProcess.exitCode}`);
}
if (await pingBackend()) {
if (await pingTestBackend()) {
console.log('✅ Backend server is running and responsive.');
return;
}

View File

@@ -1,21 +1,15 @@
// vitest.config.integration.ts
import path from 'path';
import { defineConfig } from 'vitest/config';
import { defineConfig, mergeConfig } from 'vitest/config';
import viteConfig from './vite.config';
/**
* This configuration is specifically for integration tests.
* It runs tests in a Node.js environment, as they need to interact with a live backend server.
* It MERGES with the main vite.config.ts to inherit plugins and aliases,
* then overrides the test-specific settings for a Node.js environment.
*/
export default defineConfig({
// Define the project root and aliases, just like in the main vite.config.ts.
// This is crucial for the test runner to correctly resolve module paths.
root: '.',
resolve: {
alias: {
'@': path.resolve(process.cwd(), './src'),
},
},
export default mergeConfig(viteConfig, defineConfig({
test: {
// Override settings from the main config for this specific test project.
name: 'integration',
environment: 'node',
// The path must be specific. By default, Vitest doesn't look in `src`
@@ -34,5 +28,5 @@ export default defineConfig({
reportsDirectory: '.coverage/integration',
clean: true,
},
},
});
}
}));

View File

@@ -1,6 +1,4 @@
// vitest.workspace.ts
// The `defineWorkspace` helper provides type-safety, but we can export the array
// directly to bypass any lingering TypeScript server issues.
/**
* Defines the workspace for Vitest, separating unit and integration test projects.