41 lines
1.5 KiB
JavaScript
41 lines
1.5 KiB
JavaScript
const path = require('path')
|
|
|
|
const rootDir = path.resolve(__dirname, '..')
|
|
|
|
/**
|
|
* Jest project for the backend HTTP/API tests.
|
|
*
|
|
* These tests talk to a RUNNING backend over HTTP — they do not import server
|
|
* runtime code beyond the AppRouter type. Start the server first:
|
|
*
|
|
* cd apps/backend && bun run dev # wrangler dev on :8787
|
|
* bun run test:api # from apps/backend
|
|
*
|
|
* Credentials come from tests/.env (see tests/.env.example).
|
|
*/
|
|
module.exports = {
|
|
rootDir,
|
|
roots: ['<rootDir>/tests'],
|
|
testEnvironment: 'node',
|
|
testMatch: ['<rootDir>/tests/**/*.test.ts'],
|
|
setupFiles: ['<rootDir>/tests/setup.ts'],
|
|
clearMocks: true,
|
|
// The suites share one user/session and mutate shared data — run serially.
|
|
maxWorkers: 1,
|
|
testTimeout: 180000,
|
|
transform: {
|
|
'^.+\\.tsx?$': ['ts-jest', { tsconfig: '<rootDir>/tests/tsconfig.json' }],
|
|
},
|
|
moduleNameMapper: {
|
|
'^@/(.*)$': '<rootDir>/$1',
|
|
'^@packages/shared$': '<rootDir>/../../packages/shared',
|
|
'^@packages/shared/(.*)$': '<rootDir>/../../packages/shared/$1',
|
|
'^global-shared$': '<rootDir>/../../packages/shared',
|
|
'^global-shared/(.*)$': '<rootDir>/../../packages/shared/$1',
|
|
'^shared-types$': '<rootDir>/../shared-types',
|
|
'^sqliteService$': '<rootDir>/../../packages/db_helper_sqlite',
|
|
'^sqliteService/(.*)$': '<rootDir>/../../packages/db_helper_sqlite/$1',
|
|
'^common-ui$': '<rootDir>/../../packages/ui',
|
|
'^common-ui/(.*)$': '<rootDir>/../../packages/ui/$1',
|
|
},
|
|
}
|