Server/project/tests/CustomEnvironment.ts

29 lines
687 B
TypeScript
Raw Normal View History

import "reflect-metadata";
2023-10-26 22:01:38 +02:00
import { container } from "tsyringe";
import NodeEnvironment from "jest-environment-node";
2023-10-26 22:01:38 +02:00
import type { EnvironmentContext, JestEnvironmentConfig } from "@jest/environment";
import { Container } from "@spt-aki/di/Container";
2023-10-26 22:01:38 +02:00
export default class CustomEnvironment extends NodeEnvironment
{
constructor(config: JestEnvironmentConfig, context: EnvironmentContext)
{
super(config, context);
}
async setup(): Promise<void>
{
await super.setup();
Container.registerTypes(container);
this.global.container = container;
}
async teardown(): Promise<void>
{
await super.teardown();
}
}