Skip to content

test: add mutation testing and mutation score badge - #11253

Merged
OSA413 merged 63 commits into
typeorm:masterfrom
OSA413:mutation-testing
Jan 5, 2026
Merged

OSA413 merged 63 commits into
typeorm:masterfrom
OSA413:mutation-testing

Conversation

@OSA413

@OSA413 OSA413 commented Jan 22, 2025 •

Copy link
Copy Markdown
Collaborator

Description of change

Adds mutations testing, the thing that shows the quality of our tests.

There will be a GitHub Action that runs once a month with the most databases it can handle and upload a report to the Stryker's Dashboard.

API key needs to be configured via enabling the repository in the Dashboard and added to the secrets for the repo.

Example badge is in this repo: https://github.com/OSA413/typeorm/

Example report is here: https://dashboard.stryker-mutator.io/reports/github.com/OSA413/typeorm/mutation-testing

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run format to apply prettier formatting
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes #0000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change
  • The new commits follow conventions explained in CONTRIBUTING.md

@coveralls

coveralls commented Jan 25, 2025 •

Copy link
Copy Markdown

Coverage Status

coverage: 80.88%. remained the same
when pulling 56774ee on OSA413:mutation-testing
into f1be21e on typeorm:master.

@alumni

alumni commented Dec 1, 2025 •

Copy link
Copy Markdown
Collaborator

I would at least keep the latest Postgres (has the most tests) and maybe the latest MariaDB or MySQL and one of the SQLite tests.

Would removing the CLI test (it's a GitHub issue test) from mutation testing at least be helpful? It takes quite a long time.

@OSA413

OSA413 commented Dec 1, 2025

Copy link
Copy Markdown
Collaborator Author

Would removing the CLI test (it's a github issue test) from mutation testing at least be helpful?

It runs it only when necessary - if mutant is not covered by the test, the test is not run.

Comment thread package.json Outdated
"@eslint/js": "^9.39.1",
"@google-cloud/spanner": "^8.3.1",
"@sap/hana-client": "^2.26.26",
"@stryker-mutator/core": "^8.7.1",

@alumni alumni Jan 5, 2026 •

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.

I think we can use ^9.4.0 since we already dropped node 18. It would also remove a lot of duplicate packages from the lockfile too ;)

If you switch to the new version: git fetch upstream && git checkout upstream/master -- pnpm-lock.yaml && pnpm install to avoid any leftovers in the lockfile (provided that upstream is typeorm/typeorm).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I've updated the lock file, check again please

Comment thread stryker.config.json Outdated
@@ -0,0 +1,13 @@
{
"$schema": "./node_modules/@stryker-mutator/core/schema/stryker-schema.json",
"packageManager": "npm",

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.

We switched to pnpm, can we update this and the workflow too? :)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done

Comment thread .github/workflows/mutation-test.yml Outdated

- run: npm ci
- run: cp .github/workflows/test/mutation-testing.ormconfig.json ormconfig.json
- run: npx stryker run

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.

pnpm exec stryker run (pnpx will download the latest stryker version from npm instead of using the one in the repo)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done


steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v6

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.

You need to setup pnpm before setting up node. Check the other workflows.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done

Comment thread stryker.config.json Outdated
{
"$schema": "./node_modules/@stryker-mutator/core/schema/stryker-schema.json",
"packageManager": "pnpm",
"buildCommand": "npm run compile",

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.

pnpm run compile

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done

@OSA413
OSA413 merged commit 5bb69d0 into typeorm:master Jan 5, 2026
37 checks passed
Cprakhar pushed a commit to Cprakhar/typeorm that referenced this pull request Jan 7, 2026
mgohin pushed a commit to mgohin/typeorm that referenced this pull request Jan 15, 2026
kranners pushed a commit to kranners/typeorm that referenced this pull request Mar 1, 2026
@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.

7 participants