This is the contribution guide for StrykerJS. Great to have you here! Here are a few ways you can help make this project better.
- Simon de Lang: Stryker dev. Started Stryker as part of his thesis at Info Support. simondel on github.
- Nico Jansen: Stryker dev. Originally came up with the idea for the mutation testing framework as a thesis at Info Support. nicojs on github or @_nicojs on twitter
Get in touch with us through twitter or via the Stryker Slack.
Please adhere to our editorconfig and eslint rules. If you're using vscode, please install the following extensions:
We configured the tslint extension to run on save in or vscode workspace.
We use Lerna to manage the packages in this repository. You don't have to install it globally. The packages themselves can be found in the packages folder. Commands such as npm test
can be executed from the root of the project but executing them inside of a package folder is more time efficient. However, we suggest running npm test
in the root of the project before a commit to ensure that everything still works. To get Stryker running locally, please follow these steps:
- Clone the repository
- Install dependencies using
npm install
in the root of the project - Run
npm run build
in the root of the project once. - Use
npm start
to run the TypeScript compiler in watch mode. Any changes you make to TypeScript files will automatically compile.
After that, you're ready to go. If you're using vscode, please setup that as well.
Here are some common tasks to use. Just remember that they don't include compiling of the sources. So they all assume the latest code is compiled and ready to go:
- Use
npm test
to run the unit tests. Usingnpm test
in one of the package folders also works. - Use
npm run e2e
will install and execute the end to end tests (located in the e2e folder). These take a while. - Use
npm run perf
will install and execute the performance tests (located in the perf folder). These take a while.
To run local changes you made in StrykerJS in an actual project you have two options:
- You can use install-local to install StrykerJS with plugins in your project. Don't forget to include
instrumenter
,core
,util
andapi
in each install. For example, if you want to install Stryker with the jest-runner:cd my-project npx install-local ../stryker-js/packages/core ../stryker-js/packages/util ../stryker-js/packages/api ../stryker-js/packages/instrumenter ../stryker-js/packages/jest-runner
- You can simply cd into your test project, add your plugin inside
"plugins"
configuration and run Stryker from the command line. For example:This way you can also debug from vscode using the "Attach" configuration and running Stryker fromcd my-project open stryker.conf.json # Add `"plugins": ["/home/username/stryker-js/packages/karma-runner/dist/src/index.js"]` inside the stryker.conf.json # If you use typescript checker and you get an error : Cannot find Checker plugin "typescript" # then add the typescript checker local path to the `plugin` as well: # "plugins": ["/Users/username/stryker-js/packages/karma-runner/dist/src/index.js", "/Users/username/stryker-js/packages/typescript-checker/dist/src/index.js"], /home/username/stryker-js/packages/core/bin/stryker run
my-project
like this:node --inspect-brk /home/username/stryker-js/packages/core/bin/stryker run
.
We've chosen to check in our vscode configuration. This makes development unified amongst stryker developers. VSCode is an open source code editor maintained by Microsoft. For more info and the download link, please visit https://code.visualstudio.com/.
We recommend you to install the following plugins:
- editorconfig, to adhere to our white spacing rules.
- eslint extension
- code spell checker, no particular reason, just prevent common typos.
After cloning this repo, open the workspace with $ code workspace.code-workspace
(or open code and use file -> Open Workspace...).
Some quick notes to help you get started:
- On the left side, you can see all stryker projects and plugins. Open files from there.
- Use
CTRL+Shift+B
(or⌘+Shift+B
on OSX) to run the build task. This runsnpm start
, compiling any changes you make in the background. - Use
CTRL+Shift+D
(or⌘⇧D
on OSX) to open up the debug pane. Here you can select a config to run. For example: select "Unit tests (stryker-api)" to run the unit tests for thestryker-api
package.
- You can run the tests with
CTRL+F5
(or⌃F5
on OSX). - You can debug the tests with
F5
(alsoF5
on OSX). Setting breakpoints in your code and inspecting variables all work as expected.
Have fun!
We support mutation testing Stryker with Stryker! After you got Stryker working locally, you can follow these steps to mutation test Stryker:
- Make sure all Stryker packages are build:
npm run build
- Navigate to the package you want to mutation test, for example
cd packages/core
- Run
npm run stryker
New features are welcome! Either as requests or proposals.
- Please create an issue first or let us know via the Stryker Slack
- Create a fork on your github account.
- When writing your code, please conform to the existing coding style.
See .editorconfig, the typescript guidelines and our tslint.json
- You can check if there are lint issues using
npm run lint
. - You can automatically fix a lot of lint issues using
npm run lint:fix
- You can check if there are lint issues using
- Please create or edit unit tests or integration tests.
- Run the tests using
npm test
- When creating commits, please conform to the angular commit message style.
Namely in the form
<type>(<scope>): <subject>\n\n[body]
- Type: feat, fix, docs, style, refactor, test, chore.
- Scope can the the file or group of files (not a strict right or wrong)
- Subject and body: present tense (
changedchange,addedadd) and include motivation and contrasts with previous behavior
Don't get discouraged! We estimate that the response time from the maintainers is around a day or so.
As StrykerJS uses the Abstract Syntax Tree (AST) to create mutations, we recommend you to use ASTExplorer to get familiar with the concepts involved.
Found a bug? Don't worry, we'll fix it, or you can ;)
Please report a bug report on our issues page. In this please:
- Label the issue as bug
- Explain what the bug is in clear English
- Include reproduction steps This can be an example project, code snippet, etc
- Include the expected behavior.
- Include actual behavior.
- Add more details if required (e.g. which browser, which test runner, which versions, etc)
Do you want to help? Great! These are a few things you can do:
- Evangelize mutation testing Mutation testing is still relatively new, especially in JavaScript. Please help us get the word out there! Share your stories in blog posts an on social media. Please inform us about it!
- Did you use StrykerJS? Your feedback is very valuable to us. Good and bad! Please contact us and let us know what you think!