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

218
Vistas
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 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