Exciting release!Introducing "safe npm". Learn more
Socket
Log inDemoInstall

automutate-tests

Package Overview
Dependencies
5
Maintainers
1
Versions
17
Issues
File Explorer

Advanced tools

automutate-tests

Test harness for automutate consumers.

    0.5.0latest
    GitHub

Version published
Maintainers
1
Weekly downloads
756
decreased by-13.8%

Weekly downloads

Readme

Source

automutate-tests

End-to-end test utilities for packages that rely on automutate.

Usage

automutate-tests exports a describeMutationTestCases function that takes in three arguments:

  1. Root path to search under for cases
  2. A method to create a mutation provider for each file.
  3. Names of files that test cases are composed of.

Its describe method takes in a a directory path containing test case directories.

Note that TestsFactory expects global describe and it functions to be declared. If you're using a runner like Mocha or Jasmine this will work. It also expects chai to be explicitly installed.

npm install --save-dev chai mocha

Sample Usage

Define a test file with JavaScript or TypeScript similar to the following:

import { describeMutationTestCases } from "automutate-tests"; import * as path from "path"; import { MyMutationsProvider } from "./MyMutationsProvider"; describeMutationTestCases( path.join(__dirname, "cases"), (fileName, settingsFileName) => new MyMutationsProvider(fileName, settingsFileName), { actual: "actual.txt", expected: "expected.txt", original: "original.txt", settings: "settings.txt" }); };

Then, create a directory named cases with at least one sub-directory ("case"). Each case should contain files named expected.txt and original.txt with your extension.

When tests are run, the original.txt file will be copied to an actual.txt file and mutated. It should then contain the same contents as the expected.txt file.

Keywords

FAQs

Last updated on 25 Jul 2022

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • 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