[go: up one dir, main page]

Skip to content
This repository has been archived by the owner on Aug 1, 2021. It is now read-only.

tests which use scanner programmatically cannot run async #21

Open
stocks29 opened this issue Apr 19, 2021 · 0 comments
Open

tests which use scanner programmatically cannot run async #21

stocks29 opened this issue Apr 19, 2021 · 0 comments

Comments

@stocks29
Copy link

I have a test in my project which uses the scanner programmatically to ensure the project is only using allowed licenses. When attempting to use the async: true option with ExUnit.Case on this test, compilation fails on a random test file in the project with the error:

== Compilation error in file test/some_random_test.exs ==
** (MatchError) no match of right hand side value: {:error, :enoent}
    (elixir 1.11.3) lib/kernel/parallel_compiler.ex:416: Kernel.ParallelCompiler.require_file/2
    (elixir 1.11.3) lib/kernel/parallel_compiler.ex:316: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/7

After doing some research this appears to be due to some function changing directory. I suspect Mix.Dep.loaded or Mix.Dep.load_on_environment but I have not confirmed. Here are the relevant issues which describe what I believe to be the underlying problem:

elixir-lang/elixir#7699
getsentry/sentry-elixir#232
https://elixirforum.com/t/parallel-compiler-cannot-find-files-sometimes/12363/3

The short-term fix for my particular case is to set async: false on my test. That said, it would be nice to be able to run this test module in parallel with others.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant