**test(web-service): add cloud storage integration tests and update package settings**
- **Cloud Storage Integration Testing**:
- Added `cloud-storage.test.ts` to validate cloud storage configurations (AWS S3, Cloudflare R2, Google Cloud Storage) and local storage fallback behavior:
- Includes tests for environment variable priority and configuration detection.
- Ensures proper override with `FORCE_LOCAL_STORAGE` when specified.
- **Package Settings Updates**:
- Introduced `web-service-package/package.json` with configurations for building, running, testing, and deployment:
- Added NPM scripts for building (`npm run build`), development (`npm run dev`), and testing (`npm run test:cloud`).
- Configured dependencies and devDependencies for web service functionality and cloud integration.
- **Purpose**:
- This update ensures comprehensive cloud storage testing and provides structured project configurations for seamless development and deployment workflows.
This commit is contained in:
parent
2425b3ad42
commit
0c7e999a2f
14 changed files with 7241 additions and 0 deletions
61
web-service-package/vitest.config.ts
Normal file
61
web-service-package/vitest.config.ts
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
import { defineConfig } from 'vitest/config'
|
||||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
// Global test utilities
|
||||
globals: true,
|
||||
// Longer timeout for server startup/shutdown and HTTP requests
|
||||
testTimeout: 30000, // 30 seconds for web service operations
|
||||
hookTimeout: 30000,
|
||||
// Include test files in tests directory
|
||||
include: ['tests/**/*.{test,spec}.{js,ts}'],
|
||||
// Node environment for server testing
|
||||
environment: 'node',
|
||||
// Exclude unnecessary files
|
||||
exclude: [
|
||||
'node_modules/**',
|
||||
'dist/**',
|
||||
'src/**',
|
||||
'*.js' // Exclude old JS test files
|
||||
],
|
||||
// Use default reporter with summary
|
||||
reporters: ['default'],
|
||||
// Enable console output for debugging
|
||||
silent: false,
|
||||
// Don't bail on first failure to see all test results
|
||||
bail: 0,
|
||||
// Disable coverage by default
|
||||
coverage: {
|
||||
enabled: false
|
||||
},
|
||||
// Show detailed output for web service testing
|
||||
logHeapUsage: false,
|
||||
hideSkippedTests: false,
|
||||
printConsoleTrace: true,
|
||||
// Filter out server startup noise but keep important messages
|
||||
onConsoleLog: (log: string, type: 'stdout' | 'stderr'): false | void => {
|
||||
const noisePatterns: string[] = [
|
||||
'Brainy running in Node.js environment',
|
||||
'Using file system storage for Node.js environment',
|
||||
'Platform node has already been set',
|
||||
'Hi there 👋. Looks like you are running TensorFlow.js'
|
||||
]
|
||||
|
||||
// Return false (don't show) if log contains any noise pattern
|
||||
if (noisePatterns.some((pattern) => log.includes(pattern))) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
},
|
||||
// Resolve configuration for proper module handling
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': './src',
|
||||
'@tests': './tests'
|
||||
}
|
||||
},
|
||||
// Define test environment
|
||||
define: {
|
||||
'process.env.NODE_ENV': '"test"'
|
||||
}
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue