Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

209
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda