Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

220
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!