Skip to content

Ensure test files are executed in alphabetical order#5386

Merged
DavertMik merged 2 commits into
3.xfrom
fix/5384-alphabetical-test-order
Jan 15, 2026
Merged

Ensure test files are executed in alphabetical order#5386
DavertMik merged 2 commits into
3.xfrom
fix/5384-alphabetical-test-order

Conversation

@DenysKuchma
Copy link
Copy Markdown
Collaborator

Add sort() after loading test files to maintain alphabetical order: #5384

@DenysKuchma DenysKuchma requested a review from DavertMik January 14, 2026 13:55
@DavertMik DavertMik merged commit 9edec72 into 3.x Jan 15, 2026
11 of 14 checks passed
@kobenguyent kobenguyent deleted the fix/5384-alphabetical-test-order branch January 15, 2026 15:03
mirao added a commit to mirao/CodeceptJS that referenced this pull request Jan 26, 2026
…ng (codeceptjs#5412)

The sorting of test files in loadTests() (added in codeceptjs#5386) broke the
--by suite parallelization. When files were sorted before worker
distribution, all workers could receive the same tests instead of
different suites being distributed to different workers.

Fix: Move testFiles.sort() from loadTests() to run(). This ensures:
- Worker distribution uses original (unsorted) file order for consistent
  distribution across workers
- Test execution still uses alphabetical order (sorted in run())

Added unit test to verify files are not sorted after loadTests().

Fixes codeceptjs#5412

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
DavertMik pushed a commit that referenced this pull request Feb 8, 2026
…ng (#5412) (#5419)

The sorting of test files in loadTests() (added in #5386) broke the
--by suite parallelization. When files were sorted before worker
distribution, all workers could receive the same tests instead of
different suites being distributed to different workers.

Fix: Move testFiles.sort() from loadTests() to run(). This ensures:
- Worker distribution uses original (unsorted) file order for consistent
  distribution across workers
- Test execution still uses alphabetical order (sorted in run())

Added unit test to verify files are not sorted after loadTests().

Fixes #5412

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
mirao added a commit to mirao/CodeceptJS that referenced this pull request Feb 9, 2026
…ng (codeceptjs#5412)

The sorting of test files in loadTests() (added in codeceptjs#5386) broke the
--by suite parallelization. When files were sorted before worker
distribution, all workers could receive the same tests instead of
different suites being distributed to different workers.

Fix: Move testFiles.sort() from loadTests() to run(). This ensures:
- Worker distribution uses original (unsorted) file order for consistent
  distribution across workers
- Test execution still uses alphabetical order (sorted in run())

Added unit test to verify files are not sorted after loadTests().

Fixes codeceptjs#5412

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
mirao added a commit to mirao/CodeceptJS that referenced this pull request Feb 9, 2026
…ng (codeceptjs#5412)

The sorting of test files in loadTests() (added in codeceptjs#5386) broke the
--by suite parallelization. When files were sorted before worker
distribution, all workers could receive the same tests instead of
different suites being distributed to different workers.

Fix: Move testFiles.sort() from loadTests() to run(). This ensures:
- Worker distribution uses original (unsorted) file order for consistent
  distribution across workers
- Test execution still uses alphabetical order (sorted in run())

Added unit test to verify files are not sorted after loadTests().

Fixes codeceptjs#5412

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
kobenguyent pushed a commit that referenced this pull request Jun 3, 2026
…ng (4.x) (#5438)

* fix: run-workers --by suite parallelization broken by test file sorting (#5412)

The sorting of test files in loadTests() (added in #5386) broke the
--by suite parallelization. When files were sorted before worker
distribution, all workers could receive the same tests instead of
different suites being distributed to different workers.

Fix: Move testFiles.sort() from loadTests() to run(). This ensures:
- Worker distribution uses original (unsorted) file order for consistent
  distribution across workers
- Test execution still uses alphabetical order (sorted in run())

Added unit test to verify files are not sorted after loadTests().

Fixes #5412

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: adapt tests for CI environment

- alphabetical_order_test: avoid calling codecept.run() which hangs
  in CI due to container.started() and event listener setup; test
  loadTests() directly instead
- worker_test: revert custom config assertions to original 4.x
  relaxed values (exact counts are filesystem-dependent)
- worker_test: simplify distribution test to only verify suite
  distribution without assuming glob order

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test: remove fragile worker distribution test

The test depends on mocha.loadFiles() with full container globals
(Feature, Scenario) which aren't available in unit test context on CI.
The core fix (sort moved from loadTests to run) is already verified
by alphabetical_order_test.js.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Revert "test: remove fragile worker distribution test"

This reverts commit 5c03e7a.

* test: fix worker distribution test for CI compatibility

Compare loadTests() output against fresh globSync() to verify files
are not sorted, instead of assuming a specific non-alphabetical order.
This works regardless of filesystem glob order (ext4 vs others).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants