mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
fix(testing): use vitest assertions in shutdown tests
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { ExpressAdapter } from '@nestjs/platform-express';
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import { expect } from 'chai';
|
||||
import * as http from 'http';
|
||||
import { AppModule } from '../src/app.module';
|
||||
|
||||
@@ -46,10 +45,10 @@ describe('Graceful Shutdown (Express)', () => {
|
||||
|
||||
// The in-flight request should finish successfully
|
||||
const response = await requestPromise;
|
||||
expect(response).to.equal('ok');
|
||||
expect(response).toBe('ok');
|
||||
|
||||
await closePromise;
|
||||
}).timeout(10000);
|
||||
}, 10000);
|
||||
|
||||
it('should return 503 for NEW queued requests on existing connections during shutdown', async () => {
|
||||
app = await NestFactory.create(AppModule, new ExpressAdapter() as any, {
|
||||
@@ -86,9 +85,9 @@ describe('Graceful Shutdown (Express)', () => {
|
||||
req1.on('error', () => {});
|
||||
|
||||
const status = await statusPromise;
|
||||
expect(status).to.equal(503);
|
||||
expect(status).toBe(503);
|
||||
|
||||
await closePromise;
|
||||
agent.destroy();
|
||||
}).timeout(10000);
|
||||
}, 10000);
|
||||
});
|
||||
|
||||
@@ -1,18 +1,30 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"types": ["vitest/globals"],
|
||||
"module": "commonjs",
|
||||
"target": "es2020",
|
||||
"strict": true,
|
||||
"declaration": false,
|
||||
"noImplicitAny": false,
|
||||
"removeComments": true,
|
||||
"noLib": false,
|
||||
"esModuleInterop": true,
|
||||
"baseUrl": ".",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"target": "ES2023",
|
||||
"sourceMap": true,
|
||||
"allowJs": true,
|
||||
"strictNullChecks": true,
|
||||
"outDir": "./dist",
|
||||
"paths": {
|
||||
"@nestjs/common": ["../../packages/common/index.ts"],
|
||||
"@nestjs/core": ["../../packages/core/index.ts"],
|
||||
"@nestjs/platform-express": ["../../packages/platform-express/index.ts"],
|
||||
"@nestjs/testing": ["../../packages/testing/index.ts"]
|
||||
"@nestjs/common": ["../../packages/common"],
|
||||
"@nestjs/common/*": ["../../packages/common/*"],
|
||||
"@nestjs/core": ["../../packages/core"],
|
||||
"@nestjs/core/*": ["../../packages/core/*"],
|
||||
"@nestjs/platform-express": ["../../packages/platform-express"],
|
||||
"@nestjs/platform-express/*": ["../../packages/platform-express/*"],
|
||||
"@nestjs/testing": ["../../packages/testing"],
|
||||
"@nestjs/testing/*": ["../../packages/testing/*"]
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*", "e2e/**/*"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user