Socket
Socket
Sign inDemoInstall

@stryker-mutator/core

Package Overview
Dependencies
186
Maintainers
4
Versions
96
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @stryker-mutator/core

The extendable JavaScript mutation testing framework


Version published
Weekly downloads
76K
decreased by-3.21%
Maintainers
4
Install size
32.2 MB
Created
Weekly downloads
 

Changelog

Source

8.2.6 (2024-02-25)

Bug Fixes

  • deps: update dependency commander to v12 (#4713) (76b1acd)
  • deps: update dependency npm-run-path to ~5.3.0 (#4752) (e440d3e)
  • instrumenter: support typescript constructors with code before super() (#4757) (bf85d37), closes #4744

Readme

Source

Mutation testing badge Build Status NPM Node version Slack Chat

StrykerJS

StrykerJS

Professor X: For someone who hates mutants... you certainly keep some strange company. William Stryker: Oh, they serve their purpose... as long as they can be controlled.

Introduction

For an introduction to mutation testing and StrykerJS features, see stryker-mutator.io.

Getting started

Please follow the quickstart on the website.

For small js projects, you can try the following command:

npm install --save-dev @stryker-mutator/core
# Only for small projects:
npx stryker run

It will run stryker with default values:

  • Uses npm test as your test command
  • Searches for files to mutate in the lib and src directories

Usage

$ npx stryker <command> [options] [configFile]

See usage on stryker-mutator.io

Supported mutators

See our website for the list of currently supported mutators.

Configuration

See configuration on stryker-mutator.io.

Programmatic use

Stryker can also be used programmatically from nodejs. It exports 2 classes for you to use: Stryker and StrykerCli.

import { Stryker, StrykerCli } from '@stryker-mutator/core';

Both classes can be used to run Stryker. The main difference is that Stryker is a slightly more low-level approach, while StrykerCli is the straight up CLI api.

In this example you can see how to use both.

async function main() {
  // Runs Stryker as if it was called directly from the cli. Not even returns a promise, it assumes to be allowed to call `process.exit`.
  new StrykerCli(process.argv /* RAW argv array */ ).run(); 

  // Runs Stryker, will not assume to be allowed to exit the process.
  const stryker = new Stryker({ concurrency: 4 } /* Partial Stryker options object */ );
  const mutantResults = await stryker.runMutationTest();
  // mutantResults or rejected with an error.
}

Stryker is written in TypeScript, so it is recommended to use Typescript as well to get the best developer experience.

Keywords

FAQs

Last updated on 25 Feb 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc