Skip to content

Commit

Permalink
feat(init): add create-stryker package (stryker-mutator#4644)
Browse files Browse the repository at this point in the history
Add a `create-stryker` package which allows for `npm init stryker` 🎉. Also, document this as the preferred way of initializing StrykerJS.
---------

Co-authored-by: Nico Jansen <[email protected]>
  • Loading branch information
lex-funy and nicojs authored Jan 29, 2024
1 parent 365d7a1 commit dc103cf
Show file tree
Hide file tree
Showing 9 changed files with 285 additions and 57 deletions.
35 changes: 8 additions & 27 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,53 +19,34 @@ cd my-project

## 2 Install

The easiest way to get started with Stryker is by installing the stryker-cli globally.
It is a small package which forwards commands to your local Stryker instance.
The easiest way to get started with Stryker is by using the `npm init stryker` command.

```bash
npm install -g stryker-cli
npm init stryker
```

Optionally, you could also install Stryker directly yourself.
This command will first install Stryker and then run the Stryker initializer. During the initialization, you'll be asked a series of questions to help set up Stryker for your project.

```bash
npm install --save-dev @stryker-mutator/core
```

If you choose to not install the stryker-cli, use `npx stryker` (after installing `@stryker-mutator/core` locally) instead of `stryker` for the rest of the quickstart.

---

## 3 Configure

Run this command to configure Stryker.

```bash
stryker init
```

If you're asked to install Stryker, choose **Yes**. Follow the questionnaire.

Please let us know if your option is missing here [by opening an issue](https://github.com/stryker-mutator/stryker-js/issues/new).
If you're asked to install Stryker, choose **Yes**.

After the init is done, inspect the `stryker.config.mjs` file.

For more information on what these options mean, take a look at [the Configuration docs page](./configuration.md)

---

## 4 Let's kill some mutants
## 3 Let's kill some mutants

Run Stryker to mutation test your project

```bash
stryker run
npx stryker run
```

Have troubles running Stryker? Try running with trace logging.
Have troubles running Stryker? Try running with trace logging. You can also take a look at our [troubleshooting guide](./troubleshooting.md).

```bash
stryker run --logLevel trace
npx stryker run --logLevel trace
```

You can also have a look at [the Configuration docs page](./configuration.md) for more information about the configuration.
Expand Down
233 changes: 203 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions packages/create-stryker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[![Slack Chat](https://img.shields.io/badge/slack-chat-brightgreen.svg?logo=slack)](https://join.slack.com/t/stryker-mutator/shared_invite/enQtOTUyMTYyNTg1NDQ0LTU4ODNmZDlmN2I3MmEyMTVhYjZlYmJkOThlNTY3NTM1M2QxYmM5YTM3ODQxYmJjY2YyYzllM2RkMmM1NjNjZjM)

![Stryker](https://github.com/stryker-mutator/stryker-js/raw/master/stryker-80x80.png)

# Create Stryker

An initialer for StrykerJS! Run it with: `npm init stryker`. See [getting started](../../docs/getting-started.md) for more information.
Loading

0 comments on commit dc103cf

Please sign in to comment.