Jiken

This library allows developers to simulate failures in their Mix applications. Different functions are configured to fail with specific errors, and revert to their normal operation after.

It is intended to be used in development, but eventually the goal is to support staging usage as well.

Installation

The package can be installed by adding jiken to your list of dependencies in mix.exs: Make sure to include it only in the :dev environment.

def deps do
  [
    {:jiken, "~> 0.0.1", only: [:dev]}
  ]
end

Usage

This is how a function can be dynamically mocked with Jiken.

iex> Jiken.Dummy()
"Hello, world!"
:ok 

iex> Jiken.set(Jiken.Dummy, :greet, fn -> IO.puts("Hello, simulation!") end)

iex> Jiken.Dummy()
Hello, simulation!
:ok

iex> Jiken.reset(Jiken.Dummy)
:ok

iex> Jiken.Dummy()
Hello, world!
:ok

Roadmap

Inspirations

The biggest inspirations for this library are the following:

Copyright and License

Copyright (c) 2024 Nikolay Dyulgerov

This library is MIT licensed. See the LICENSE.md for details.