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

216
Visualizações
Performing several tests together fails but performing each test individually works

I have several integration tests,

when I run the tests together - one test fail (the second test of search the word "exemple"),

but if I run them individually each one - they work (all tests pass individually)

if I put skip to one test (No matter which test) the tests work

My code is:

const supertest = require('supertest');
const app = require('../../app.js');

const api = supertest(app);

// data of the "example" word
const resultOfWordExample = {...};

describe('search word test', () => {
  test('of search the word "example" -> status: 200, body: { Items: [...example] }', async () => {
    const res = await api
      .get('/example')
      .expect(200)
      .expect('Content-Type', /application\/json/);

    expect(res.body).toEqual(resultOfWordExample);
  }, 10000);

  test('of search the word "exemple" -> status: 404, message: "no result for this word"', async () => {
    const res = await api
      .get('/exemple')
      .expect(404)
      .expect('Content-Type', /application\/json/);

    expect(res.body.error).toEqual('no result for this word');
  }, 10000);

  test('of search the word "example123" -> status: 400, message: "not word in English"', async () => {
    const res = await api
      .get('/example123')
      .expect(400)
      .expect('Content-Type', /application\/json/);

    expect(res.body.error).toEqual('not word in English');
  }, 10000);
});

afterAll(() => {
  app.killServer();
});

Does anyone know why this works like this?

about 4 years ago · Juan Pablo Isaza
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