Eliminate all code paths, configuration, and documentation related to running without authentication. Require AUTH_SECRET and BASE_URL at startup, updating middleware, server logic, and runtime checks to assume auth is always enabled. Simplify onboarding, settings, and test helpers to reflect mandatory auth. Update environment examples, Docker and deployment docs, and CI/test configs. Remove no-auth-specific UI flows, test cases, and feature toggles.
64 lines
2.3 KiB
TypeScript
64 lines
2.3 KiB
TypeScript
import { defineConfig } from 'vitest/config';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
if (!process.env.AUTH_SECRET?.trim()) {
|
|
process.env.AUTH_SECRET = 'vitest-auth-secret';
|
|
}
|
|
|
|
if (!/^https?:\/\//.test(process.env.BASE_URL ?? '')) {
|
|
process.env.BASE_URL = 'http://localhost:3003';
|
|
}
|
|
|
|
const srcDir = fileURLToPath(new URL('./src/', import.meta.url));
|
|
const computeCoreIndex = fileURLToPath(new URL('./compute/core/src/index.ts', import.meta.url));
|
|
const computeCoreApiContracts = fileURLToPath(new URL('./compute/core/src/api-contracts/index.ts', import.meta.url));
|
|
const computeCoreControlPlane = fileURLToPath(new URL('./compute/core/src/control-plane/index.ts', import.meta.url));
|
|
const computeCoreLocalRuntime = fileURLToPath(new URL('./compute/core/src/local-runtime.ts', import.meta.url));
|
|
const computeCoreTypes = fileURLToPath(new URL('./compute/core/src/types/index.ts', import.meta.url));
|
|
const alias = [
|
|
{ find: /^@openreader\/compute-core$/, replacement: computeCoreIndex },
|
|
{ find: /^@openreader\/compute-core\/api-contracts$/, replacement: computeCoreApiContracts },
|
|
{ find: /^@openreader\/compute-core\/control-plane$/, replacement: computeCoreControlPlane },
|
|
{ find: /^@openreader\/compute-core\/local-runtime$/, replacement: computeCoreLocalRuntime },
|
|
{ find: /^@openreader\/compute-core\/types$/, replacement: computeCoreTypes },
|
|
{ find: /^@\//, replacement: `${srcDir}` },
|
|
{ find: '@', replacement: srcDir },
|
|
];
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias,
|
|
},
|
|
test: {
|
|
alias,
|
|
reporters: process.env.CI ? ['default', 'github-actions'] : ['default'],
|
|
projects: [
|
|
{
|
|
resolve: {
|
|
alias,
|
|
},
|
|
test: {
|
|
name: 'openreader',
|
|
environment: 'node',
|
|
include: ['tests/unit/**/*.vitest.spec.ts'],
|
|
setupFiles: ['tests/unit/setup-env.ts'],
|
|
},
|
|
},
|
|
{
|
|
test: {
|
|
name: 'compute-core',
|
|
environment: 'node',
|
|
include: ['compute/core/tests/control-plane/**/*.test.ts'],
|
|
},
|
|
},
|
|
{
|
|
test: {
|
|
name: 'compute-worker',
|
|
environment: 'node',
|
|
include: ['compute/worker/tests/{unit,api}/**/*.test.ts'],
|
|
setupFiles: ['compute/worker/tests/setup-env.ts'],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
});
|