refactor/perf(backend): provide metadata statically (#14601)

* wip

* Update ReactionService.ts

* Update ApiCallService.ts

* Update timeline.ts

* Update GlobalModule.ts

* Update GlobalModule.ts

* Update NoteEntityService.ts

* wip

* wip

* wip

* Update ApPersonService.ts

* wip

* Update GlobalModule.ts

* Update mock-resolver.ts

* Update RoleService.ts

* Update activitypub.ts

* Update activitypub.ts

* Update activitypub.ts

* Update activitypub.ts

* Update activitypub.ts

* clean up

* Update utils.ts

* Update UtilityService.ts

* Revert "Update utils.ts"

This reverts commit a27d4be764.

* Revert "Update UtilityService.ts"

This reverts commit e5fd9e004c.

* vuwa-

* Revert "vuwa-"

This reverts commit 0c3bd12472.

* Update entry.ts

* Update entry.ts

* Update entry.ts

* Update entry.ts

* Update jest.setup.ts
This commit is contained in:
syuilo
2024-09-22 12:53:13 +09:00
committed by GitHub
parent 3ad5c753fa
commit 023fa30280
55 changed files with 499 additions and 487 deletions

View File

@@ -6,12 +6,16 @@ import { MainModule } from '@/MainModule.js';
import { ServerService } from '@/server/ServerService.js';
import { loadConfig } from '@/config.js';
import { NestLogger } from '@/NestLogger.js';
import { INestApplicationContext } from '@nestjs/common';
const config = loadConfig();
const originEnv = JSON.stringify(process.env);
process.env.NODE_ENV = 'test';
let app: INestApplicationContext;
let serverService: ServerService;
/**
* テスト用のサーバインスタンスを起動する
*/
@@ -20,10 +24,10 @@ async function launch() {
console.log('starting application...');
const app = await NestFactory.createApplicationContext(MainModule, {
app = await NestFactory.createApplicationContext(MainModule, {
logger: new NestLogger(),
});
const serverService = app.get(ServerService);
serverService = app.get(ServerService);
await serverService.launch();
await startControllerEndpoints();
@@ -71,6 +75,20 @@ async function startControllerEndpoints(port = config.port + 1000) {
fastify.post<{ Body: { key?: string, value?: string } }>('/env-reset', async (req, res) => {
process.env = JSON.parse(originEnv);
await serverService.dispose();
await app.close();
await killTestServer();
console.log('starting application...');
app = await NestFactory.createApplicationContext(MainModule, {
logger: new NestLogger(),
});
serverService = app.get(ServerService);
await serverService.launch();
res.code(200).send({ success: true });
});