Skip to content

chore(mutation testing): tweak Stryker for lower resource usage and decrease timeout for slow running mutants - #11901

Merged
OSA413 merged 5 commits into
typeorm:masterfrom
OSA413:master
Jan 12, 2026
Merged

OSA413 merged 5 commits into
typeorm:masterfrom
OSA413:master

Conversation

@OSA413

@OSA413 OSA413 commented Jan 8, 2026

Copy link
Copy Markdown
Collaborator

Description of change

So, this change brings a few tweaks for mutation testing for it to properly/better work in GHA.

  1. I changed number of concurrency from 6 to 4 because the runner often fails/disconnects after 2 hours of work, as the error says, it can be CPU, RAM, or network. So decreasing number of concurrent workers should do the trick here.

  2. I enabled the ignoreStatic flag to ignore static mutants (though that didn't help a lot). The logs didn't say that there's a problem with a lot of static mutants but I still decided to enable the flag because killing static mutants requires restart of the tests which is a bit slow. More info on static mutants is here https://stryker-mutator.io/docs/mutation-testing-elements/static-mutants/

These two changes decreased the running time from 3 hours to 2 hours, but I thought that that was not enough so I did another trick:

  1. I set timeout factor to 0.1 to cancel the slow running tests (it can also be that Stryker decided to re-run all the tests for a particular mutant) which decreased the running time by another hour. Basically, it makes each mutant to run no longer than 40 (300 * 0.1 + 5 + 5) seconds. The math behind this is described here: https://stryker-mutator.io/docs/stryker-js/configuration/#timeoutms-number

All the steps didn't change the mutation score that much (53.958070324303065 comparing to the final 53.94989967523737).

In results, the mutation testing should run in just an hour!

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • This pull request links relevant issues as Fixes #00000
  • There are new or updated tests validating the change (tests/**.test.ts)
  • Documentation has been updated to reflect this change (docs/docs/**.md)

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Aggressive Timeout

The timeoutFactor of 0.1 is extremely aggressive and may cause legitimate slow-running tests to be killed prematurely, potentially missing real bugs. This could lead to false negatives where mutants survive not because the tests are inadequate, but because they timed out. Consider monitoring the mutation score over time to ensure this doesn't significantly impact test effectiveness.

"timeoutFactor": 0.1,
"_comment": "This config was generated using 'stryker init'. Please take a look at: https://stryker-mutator.io/docs/stryker-js/configuration/ for more information."

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jan 8, 2026 •

Copy link
Copy Markdown

PR Code Suggestions ✨

Latest suggestions up to 172c90c

CategorySuggestion                                                                                                                                    Impact
Possible issue
Increase timeout factor to prevent false positives

Increase the timeoutFactor from 0.1 to a more reasonable value, such as 1.0, to
prevent false positives in mutation testing results caused by premature
timeouts.

stryker.config.json [17]

-"timeoutFactor": 0.1,
+"timeoutFactor": 1.0,
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies that a timeoutFactor of 0.1 is very low and could lead to misleading mutation testing results by incorrectly timing out valid mutants.

Medium
  • More

Previous suggestions

Suggestions up to commit 3c6d066
CategorySuggestion                                                                                                                                    Impact
Possible issue
Increase timeout factor to reasonable value

Increase the timeoutFactor from 0.1 to a more reasonable value, such as the
default of 1.5, to prevent premature timeouts during mutation testing.

stryker.config.json [17]

-"timeoutFactor": 0.1,
+"timeoutFactor": 1.5,
Suggestion importance[1-10]: 9

__

Why: The suggestion correctly identifies that a timeoutFactor of 0.1 is extremely low and will likely cause mutation tests to fail due to timeouts, making the results unreliable.

High
Suggestions up to commit d99ae8f
CategorySuggestion                                                                                                                                    Impact
Possible issue
Increase timeout factor for test stability

Increase the timeoutFactor from 0.1 to a safer value, such as 1.0, to prevent
mutants from being incorrectly marked as "Timeout" due to minor test speed
fluctuations.

stryker.config.json [17]

-"timeoutFactor": 0.1,
+"timeoutFactor": 1.0,
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies that the newly added timeoutFactor of 0.1 is very low and could cause flaky mutation tests, providing a sound explanation and a safer alternative.

Medium

@OSA413

OSA413 commented Jan 8, 2026

Copy link
Copy Markdown
Collaborator Author

About qodo's suggestion, making all the changes actually decreased the number of timeout-ed mutants by 5 (initial (545 survived, 75 timed out) and final (539 survived, 70 timed out))

@G0maa
G0maa self-requested a review January 10, 2026 16:18

@gioboa gioboa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM 👏

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jan 10, 2026 •

Copy link
Copy Markdown

Code Review by Qodo (Alpha)

(Review updated until commit 172c90c)

🐞 Bugs (1) 📘 Rule Violations (0) 📎 Requirement Gaps (0) 💡 Suggestions (0)

Grey Divider


Action Required

1. Critically Low Timeout Factor Causes Test Failures 🐞 Bug
Description
• The timeoutFactor of 0.1 will cause widespread test failures by reducing test timeouts to only 10%
  of their original values
• With mocha's base timeout of 90,000ms, mutation tests will timeout after just 9 seconds, and tests
  with explicit 120,000ms timeouts will fail after 12 seconds
• Database integration tests involving schema creation, migrations, and complex queries across
  multiple database services (MySQL, MariaDB, PostgreSQL) cannot complete within such short timeouts
• Stryker's default timeoutFactor is 1.5 (150%), making 0.1 an extreme outlier that will break the
  mutation testing pipeline

reliability

Code

stryker.config.json[17]

+  "timeoutFactor": 0.1,
Evidence
The mocha configuration sets a base timeout of 90,000ms, and some tests explicitly require
120,000ms. With timeoutFactor of 0.1, these become 9,000ms and 12,000ms respectively. The mutation
testing workflow runs against real database services, making adequate timeouts critical for test
reliability.

.mocharc.json[9-9]
test/github-issues/8975/issue-8975.test.ts[56-56]
.github/workflows/mutation-test.yml[12-43]

Agent Prompt
## Issue Description
The timeoutFactor in stryker.config.json is set to 0.1, which reduces test timeouts to only 10% of their original values. This will cause test failures during mutation testing, especially for database integration tests that require significant time for schema operations and queries.

## Issue Context
- Mocha base timeout: 90,000ms (90 seconds)
- Some tests explicitly use: 120,000ms (120 seconds)
- With timeoutFactor 0.1: Tests timeout after 9-12 seconds
- Stryker default timeoutFactor: 1.5 (150%)
- Mutation testing runs against real database services (MySQL, MariaDB, PostgreSQL)

## Fix Focus Areas
- stryker.config.json[17-17]: Change "timeoutFactor": 0.1 to a value between 1.5 and 3.0

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider


Previous review results

Results up to commit 3c6d066


🐞 Bugs (1) 📘 Rule Violations (0) 📎 Requirement Gaps (0) 💡 Suggestions (0)

Grey Divider
Action Required
1. Extremely Low Timeout Factor Breaks Tests 🐞 Bug
Description
• The timeoutFactor of 0.1 will cause mutation tests to timeout prematurely and fail
• With the base Mocha timeout of 90 seconds, Stryker will only allow 9 seconds (90000ms × 0.1) per
  mutated test run
• TypeORM's integration tests involve multiple database systems (MySQL, MariaDB, PostgreSQL, Oracle,
  SAP HANA) requiring significantly more than 9 seconds to execute
• The default timeoutFactor is typically 1.5 (150% of original timeout); values below 1.0 are rarely
  appropriate for complex test suites

reliability

Code

stryker.config.json[17]

+  "timeoutFactor": 0.1,
Evidence
The base test timeout is 90 seconds as configured in .mocharc.json. The mutation testing workflow
runs against multiple database services requiring complex integration tests. With timeoutFactor of
0.1, the effective timeout becomes 9 seconds (90000ms × 0.1), which is insufficient for database
operations. This will cause systematic test failures in the mutation testing pipeline.

.mocharc.json[9-9]
.github/workflows/mutation-test.yml[12-43]
stryker.config.json[17-17]

Agent Prompt
## Issue Description
The timeoutFactor in stryker.config.json is set to 0.1, which is extremely low and will cause mutation tests to fail due to premature timeouts. With the base Mocha timeout of 90 seconds, this results in only 9 seconds per mutated test run, which is insufficient for TypeORM's database integration tests.

## Issue Context
- TypeORM runs integration tests against multiple database systems (MySQL, MariaDB, PostgreSQL, Oracle, SAP HANA)
- The base test timeout is configured as 90 seconds in .mocharc.json
- Stryker's timeoutFactor multiplies the base timeout to determine how long to wait for mutated tests
- The default and recommended timeoutFactor is typically 1.5 (150% of original timeout)
- Values below 1.0 are rarely appropriate for complex test suites with I/O operations

## Fix Focus Areas
- stryker.config.json[17-17]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Persistent review updated to latest commit 172c90c

@OSA413
OSA413 merged commit a1a561c into typeorm:master Jan 12, 2026
11 checks passed
mgohin pushed a commit to mgohin/typeorm that referenced this pull request Jan 15, 2026
…ecrease timeout for slow running mutants (typeorm#11901)

Co-authored-by: Naor Peled <[email protected]>
kranners pushed a commit to kranners/typeorm that referenced this pull request Mar 1, 2026
…ecrease timeout for slow running mutants (typeorm#11901)

Co-authored-by: Naor Peled <[email protected]>
@pkuczynski pkuczynski added this to the 1.0 milestone Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants