Skip to content

Run some unit tests in parallel#3542

Open
henrymercer wants to merge 5 commits intomainfrom
henrymercer/parallel-unit-tests
Open

Run some unit tests in parallel#3542
henrymercer wants to merge 5 commits intomainfrom
henrymercer/parallel-unit-tests

Conversation

@henrymercer
Copy link
Contributor

Drop the --serial flag we pass to ava in favour of specifying which tests need to be run sequentially. These are typically ones which read and write environment variables. This speeds up the unit tests by 4x on my machine from ~24s to ~6s (measured fairly unscientifically by comparing 5 runs of each).

@henrymercer henrymercer requested a review from a team as a code owner March 4, 2026 11:49
Copilot AI review requested due to automatic review settings March 4, 2026 11:49
@github-actions github-actions bot added the size/XXL May be extremely hard to review label Mar 4, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the AVA test configuration to allow parallel test execution, while explicitly marking tests that rely on shared mutable state (notably process.env) as sequential to preserve correctness.

Changes:

  • Remove the global --serial flag from the ava npm script to enable parallel test runs.
  • Convert many unit tests to test.serial(...) where they mutate environment variables or other shared state.
  • Regenerate corresponding compiled lib/* JavaScript artifacts to reflect package.json changes.

Reviewed changes

Copilot reviewed 39 out of 39 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/workflow.test.ts Marks env-dependent workflow validation tests as serial.
src/util.test.ts Marks env-mutating util tests as serial (extra options, env var helpers, etc.).
src/upload-sarif.test.ts Marks SARIF upload macro tests and tmp-dir tests as serial.
src/trap-caching.test.ts Marks cache-related tests that touch env/event files as serial.
src/status-report.test.ts Marks status-report tests as serial to avoid env interference.
src/start-proxy/environment.test.ts Marks proxy environment tests as serial due to env mutations.
src/start-proxy.test.ts Marks start-proxy tests as serial (credentials/env/error-message behavior).
src/setup-codeql.test.ts Marks setup-codeql tests as serial (platform/env/toolcache stubbing).
src/overlay/status.test.ts Marks overlay cache status tests as serial (RUNNER_TEMP/cache stubbing).
src/overlay/index.test.ts Marks overlay change-file/cache-key tests as serial.
src/init.test.ts Marks tests that rely on shared env/stubs as serial.
src/init-action-post-helper.test.ts Marks init-post tests as serial (env-driven execution paths).
src/git-utils.test.ts Marks git-utils tests as serial (env + global stubbing of git helpers).
src/feature-flags/properties.test.ts Marks repository properties feature-flag tests as serial.
src/feature-flags.test.ts Marks feature flag tests as serial to avoid shared env/cache interference.
src/diff-informed-analysis-utils.test.ts Marks diff-informed analysis tests as serial.
src/dependency-caching.test.ts Marks dependency-caching tests as serial where env/stubs are involved.
src/database-upload.test.ts Marks database upload tests as serial (env + HTTP mocking).
src/cli-errors.test.ts Marks platform/arch stubbing tests as serial.
src/api-client.test.ts Marks API-client tests as serial.
src/analyze.test.ts Marks analyze status report test as serial.
src/analyses.test.ts Marks analysis-kinds and risk assessment tests as serial.
src/actions-util.test.ts Marks some actions-util tests as serial; further serialisation may be needed for github.context mutation.
package.json Removes ava --serial to allow parallel execution.
lib/upload-sarif-action.js Compiled output update (generated from TS / package changes).
lib/upload-sarif-action-post.js Compiled output update (generated).
lib/upload-lib.js Compiled output update (generated).
lib/start-proxy-action.js Compiled output update (generated).
lib/start-proxy-action-post.js Compiled output update (generated).
lib/setup-codeql-action.js Compiled output update (generated).
lib/resolve-environment-action.js Compiled output update (generated).
lib/init-action.js Compiled output update (generated).
lib/init-action-post.js Compiled output update (generated).
lib/autobuild-action.js Compiled output update (generated).
lib/analyze-action.js Compiled output update (generated).
lib/analyze-action-post.js Compiled output update (generated).

Base automatically changed from henrymercer/overlay-status-record-job to main March 4, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XXL May be extremely hard to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants