parroty / exvcr

HTTP request/response recording library for elixir, inspired by VCR.
MIT License
722 stars 132 forks source link

[Q] Tests run in iex session #93

Closed avocade closed 7 years ago

avocade commented 7 years ago

Probably a stupid-simple thing I've missed, but can't get the tests to stop running in the iex -S mix session every time I save a file… :)

Running mix test.watch in another terminal, but this occurs even when just running iex.

Here's the mix.exs file:

defmodule MyApp.Mixfile do
  use Mix.Project

  def project do
    [
      app: :my_app,
      version: "0.1.0",
      elixir: "~> 1.4.0",
      build_embedded: Mix.env == :production,
      start_permanent: Mix.env == :production,
      deps: deps(),
      preferred_cli_env: [
        vcr: :test, "vcr.delete": :test, "vcr.check": :test, "vcr.show": :test
      ],
    ]
  end

  defp deps do
    [
      ...
      {:httpoison, "~> 0.11.0"},
    ]
    ++ devdeps()
    ++ testdeps()
  end

  defp devdeps do
    [
      ...
      {:mix_test_watch, "~> 0.2", only: :dev},
    ]
  end

  defp testdeps do
    [
      ...
      {:exvcr, "~> 0.8", only: [:ci, :test], runtime: false},
    ]
  end
end

Let me know if someone need to see the config stuff as well.

Removing exvcr stops this behaviour.

avocade commented 7 years ago

Seems to be an issue with mix_test_watch, but it didn't start happening until we added exvcr… :) Maybe someone has insight into this.

avocade commented 7 years ago

And of course it was an issue with mix_test_watch not having runtime: false set in elixir 1.4… :)