NadavT
NadavT

Reputation: 113

Vitest concurrent skippes it block

I am trying to run two it blocks in parallel

 describe('First test', () => {
  it.concurrent('This runs with concurrent', async ({ expect }) => {
    let count = 0;
    await vi.waitUntil(() => {
      count += 1; return count === 10;
    }, { timeout: 10000, interval: 500 });
    expect(true).toBeTruthy();
  });

  it.concurrent('This also runs with concurrent', async ({ expect }) => {
    let count = 0;
    await vi.waitUntil(() => {
      count += 1; return count === 10;
    }, { timeout: 10000, interval: 500 });
    expect(true).toBeTruthy();
  });
});

this is according to Vitest docs

I also tried describe.concurrent which also supposed to work according to Vitest

this is my config:

export default defineConfig({
  test: {
    watch: false,
    pool: 'forks',
    testTimeout: 7200000,
    reporters: ['default', new AllureReporter({})],
  },
});

The result is that only the first it runs I guess it is something in config that supposed to support this but I could not find any explanation in their docs

Upvotes: 1

Views: 53

Answers (1)

NadavT
NadavT

Reputation: 113

Found the answer: the issue is in allure-vitest package https://github.com/allure-framework/allure-js/blob/main/packages/allure-vitest/src/setup.ts

  if (!existsInTestPlan(ctx, globalThis.allureTestPlan as TestPlanV1)) {
    // @ts-ignore
    ctx.task.meta.allureRuntimeMessages = [
      {
        type: "metadata",
        data: {
          labels: [{ name: ALLURE_SKIPPED_BY_TEST_PLAN_LABEL, value: "true" }],
        },
      },
    ];
    ctx.skip();
    return;
  }

I had to remove ctx.skip() in order for this to not skip

Upvotes: 0

Related Questions