Ava: Parallel test failing when CI_NODE_TOTAL is strictly greater than total number of test files

Created on 18 Apr 2020  Â·  4Comments  Â·  Source: avajs/ava

How to reproduce

Consider an app with only 1 test file, index.spec.ts:

import test from 'ava';

test('pass', t => {
    t.pass();
});

and set the following environment variables

export CI_NODE_INDEX=0
export CI_NODE_TOTAL=3
export AVA_FORCE_CI='ci'

Run the test

$ ava

  ✔ pass

  Ran 1 test file out of 1 for job 1 of 3

  1 test passed

✨  Done in 1.83s.

Then change the CI_NODE_INDEX: export CI_NODE_INDEX=1

Expected

ava cannot find any test to run for this index (because there's only 1 test file in total) and exits with 0.

Current behavior

ava exits with code 1 because it can't find any test file.

$ ava

  ✖ Couldn’t find any files to test

error Command failed with exit code 1.

The use case is that I have a monorepo and I activate the parallelisation globally at CI level. Some of the monorepo projects have more than 1 file, some don’t.

bug help wanted scheduling

Most helpful comment

I've shipped the fix in v3.7.1.

All 4 comments

I agree, it should recognize this scenario and exit with code 0, and perhaps ✅ No files tested in this parallel run or something along those lines.

@novemberborn i’ll try to open a PR.

I've shipped the fix in v3.7.1.

I just want to say that I just notice this bug and I'm so pleased all I have to do is update ava :) :) thx everyone!

Was this page helpful?
0 / 5 - 0 ratings