Is your feature request related to a problem? Please describe.
Support more setup options in the NestJS app setup
Describe the solution you'd like
export function setupApp(
app: INestApplication,
logLevel: Logger.LogLevel = Logger.FATAL,
): void {
app.enableVersioning({
type: VersioningType.URI,
defaultVersion: "1alpha1",
});
// Turn off the logger
const logger = app.get(Logger);
logger.level(logLevel);
app.use(bodyParser.json({ limit: "1mb" }));
app.useGlobalPipes(
new ValidationPipe({
transform: true,
exceptionFactory: (errors: ValidationError[]) =>
new UnprocessableEntityException(
errors.map((e) => Object.values(e.constraints ?? {})).flat(),
),
}),
);
}
What we want:
describe("Describe", () => {
let teardownTests: SetupTestsTeardown;
let url: URL;
beforeEach(async () => {
const result = await setupTests({
server: {
appModule: AppModule,
// Hook definitions here
},
});
teardownTests = result.teardownTests;
url = new URL("/v1alpha1/pathways", result.outputs.server.output.origin);
});
afterEach(async () => {
await teardownTests();
});
// ....
});
Describe alternatives you've considered
N/A
Is your feature request related to a problem? Please describe.
Support more setup options in the NestJS app setup
Describe the solution you'd like
What we want:
Describe alternatives you've considered
N/A