feat: Introduce knex for database migrations
- Adds knex.js to manage database schema changes systematically. - Creates an initial migration file based on `hyungi_schema_v2.sql` to represent the current database state. - Adds npm scripts (`db:migrate`, `db:rollback`, etc.) for easy execution of migration tasks. - Archives legacy SQL files and old migration scripts into the `db_archive/` directory to prevent confusion and clean up the project structure.
This commit is contained in:
91
api.hyungi.net/jest.config.js
Normal file
91
api.hyungi.net/jest.config.js
Normal file
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
* Jest 설정 파일
|
||||
*
|
||||
* TK-FB-Project 테스트 환경 설정
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
// Node.js 환경에서 테스트 실행
|
||||
testEnvironment: 'node',
|
||||
|
||||
// 커버리지 리포트 저장 디렉토리
|
||||
coverageDirectory: 'coverage',
|
||||
|
||||
// 커버리지 수집 대상 파일
|
||||
collectCoverageFrom: [
|
||||
'controllers/**/*.js',
|
||||
'services/**/*.js',
|
||||
'models/**/*.js',
|
||||
'middlewares/**/*.js',
|
||||
'utils/**/*.js',
|
||||
'!**/node_modules/**',
|
||||
'!**/coverage/**',
|
||||
'!**/tests/**',
|
||||
'!index.js' // 서버 시작 파일 제외
|
||||
],
|
||||
|
||||
// 테스트 파일 패턴
|
||||
testMatch: [
|
||||
'**/tests/**/*.test.js',
|
||||
'**/tests/**/*.spec.js'
|
||||
],
|
||||
|
||||
// 테스트 실행 전 설정 파일
|
||||
setupFilesAfterEnv: ['<rootDir>/tests/setup.js'],
|
||||
|
||||
// 상세 출력 모드
|
||||
verbose: true,
|
||||
|
||||
// 커버리지 수집 활성화
|
||||
collectCoverage: false, // 기본은 false, npm run test:coverage에서만 true
|
||||
|
||||
// 커버리지 리포트 형식
|
||||
coverageReporters: ['text', 'lcov', 'html', 'json-summary'],
|
||||
|
||||
// 커버리지 임계값 (이 값 이하면 테스트 실패)
|
||||
coverageThreshold: {
|
||||
global: {
|
||||
branches: 50,
|
||||
functions: 50,
|
||||
lines: 50,
|
||||
statements: 50
|
||||
}
|
||||
},
|
||||
|
||||
// 테스트 타임아웃 (밀리초)
|
||||
testTimeout: 10000,
|
||||
|
||||
// 모듈 경로 매핑 (선택사항)
|
||||
moduleNameMapper: {
|
||||
'^@/(.*)$': '<rootDir>/$1',
|
||||
'^@controllers/(.*)$': '<rootDir>/controllers/$1',
|
||||
'^@services/(.*)$': '<rootDir>/services/$1',
|
||||
'^@models/(.*)$': '<rootDir>/models/$1',
|
||||
'^@utils/(.*)$': '<rootDir>/utils/$1',
|
||||
'^@middlewares/(.*)$': '<rootDir>/middlewares/$1'
|
||||
},
|
||||
|
||||
// 무시할 경로
|
||||
testPathIgnorePatterns: [
|
||||
'/node_modules/',
|
||||
'/coverage/',
|
||||
'/dist/'
|
||||
],
|
||||
|
||||
// 병렬 테스트 실행 워커 수 (기본값: CPU 코어 수 - 1)
|
||||
// maxWorkers: 4,
|
||||
|
||||
// 실패한 테스트만 재실행 옵션
|
||||
// bail: 1, // 첫 번째 실패 시 중단
|
||||
|
||||
// 테스트 결과 리포터
|
||||
reporters: [
|
||||
'default',
|
||||
// ['jest-junit', { outputDirectory: 'coverage', outputName: 'junit.xml' }]
|
||||
],
|
||||
|
||||
// 글로벌 설정
|
||||
globals: {
|
||||
'NODE_ENV': 'test'
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user