Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

210
Vistas
Share compiled module reference across test cases

I have got a standard unit test for nestjs application

// test.spec.ts

describe('test case', () => {

  beforeAll(async () => {
    module = await createTestingModule();
  });
});

// testSetup.ts

export async function createTestingModule() {
  return Test.createTestingModule({
      imports: [AppModule],
  }).compile();
}

But Test.createTestingModule is called in every test case which takes some time. Can I somehow save the reference to the compiled module and reuse it in other tests?

  • first test runs createTestingModule, compiles the module and save the reference
  • next tests runs createTestingModule, but instead of compiling it they will use reference

Script I use to run tests jest --setupFiles dotenv/config --coverage --runInBand --detectOpenHandles --forceExit --logHeapUsage

I was trying to store it in process object but i think its not possible this way.

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda