Skip to content

🎥 Make videos programmatically with React

update CONTRIBUTING.md for Mutation Testing Setup

Tobias Boner25d98d0a55af
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 30df1b9546..227e1d7e60 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -15,10 +15,15 @@ Please note that this project is released with a [Contributor Code of Conduct](C
Clone the repo and run
```console
+
npm i
+
npx lerna bootstrap
+
npm run build
+
npx lerna bootstrap
+
```
to set up the project. Make sure to run `npx lerna bootstrap` twice - the reason is that during the build phase new CLI binaries are being created so another symlink is necessary. You only have to do this once.
@@ -26,9 +31,43 @@ to set up the project. Make sure to run `npx lerna bootstrap` twice - the reason
We recommend keeping a terminal open with the command
```console
+
npm run watch
+
```
running to keep the monorepos building and synchronized.
As a testbed, you can use the `example` folder. Run `npm start` to trigger the preview and `npm run render` to trigger the render process.
+
+### Mutation Testing
+
+In case you want to check the quality of your test code while contributing, you can use mutation testing with the help of the [Stryker Mutator](https://stryker-mutator.io/).
+
+#### Stryker Setup
+
+To setup mutation testing in the core package, cd to the `packages/core`directory and then run `npm i @stryker-mutator/core @stryker-mutator/jest-runner`. Further, add a `stryker.conf.json` file in the same directory.
+
+**Example stryker.conf.json:**
+
+ {
+ "$schema": "./node_modules/@stryker-mutator/core/schema/stryker-schema.json",
+ "packageManager": "npm",
+ "reporters": [ "html", "clear-text", "progress" ],
+ "testRunner": "jest",
+ "mutate": [
+ // specify files to mutate!
+ "src/interpolate.ts",
+ "src/volume-prop.ts",
+ "src/config/codec.ts",
+ "src/config/image-format.ts"
+ ],
+ "coverageAnalysis": "off"
+ }
+
+Under `"mutate"` you can specify the files you want stryker to mutate for you.
+Then to run the mutation tests use `npx stryker run`.
+In case you run into error on _Windows_ where Stryker and Jest won't run any test cases, try one of these [workarounds](https://github.com/stryker-mutator/stryker-js/issues/2122#issuecomment-605783668).
+After running Stryker you can find the report under `packages/core/reports/mutation` and see how many mutants have been killed by your test cases and how many have survived.
+
+Once you have checked your test code quality with the help of mutation testing, make sure to omit any Stryker related changes from your code before contributing.
diff --git a/packages/core/README.md b/packages/core/README.md
index f459685677..ec4fbea1de 100644
--- a/packages/core/README.md
+++ b/packages/core/README.md
@@ -4,7 +4,7 @@
</a>
</p>
-![Statements](https://img.shields.io/badge/Coverage-81.05%25-yellow.svg) ![Branches](https://img.shields.io/badge/Coverage-77.03%25-red.svg) ![Functions](https://img.shields.io/badge/Coverage-65.33%25-red.svg) ![Lines](https://img.shields.io/badge/Coverage-80.29%25-yellow.svg)
+![Statements](https://img.shields.io/badge/Coverage-81.29%25-yellow.svg) ![Branches](https://img.shields.io/badge/Coverage-73.56%25-red.svg) ![Functions](https://img.shields.io/badge/Coverage-65.89%25-red.svg) ![Lines](https://img.shields.io/badge/Coverage-80.55%25-yellow.svg)
Remotion is a suite of libraries building a fundament for **creating videos programmatically using React.**