import { INestApplication } from '@nestjs/common' ; import supertest from 'supertest' ; const use = require ( 'superagent-use' ) ; const captureError = require ( 'supertest-capture-error' ) ; export const request = ( app ) : supertest . SuperTest < supertest . Test > => use ( supertest ( app . getHttpServer ( ) ) ) . use ( captureError ( ( error , req ) => { error . message += ` at ${ req . url }\n Response Body:\n${ req . res . text }` ; error . stack = '' ; } ) ) ;