Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mix test works but mix test <exunit file name> fails #43

Open
ymtszw opened this issue Nov 30, 2024 · 1 comment
Open

mix test works but mix test <exunit file name> fails #43

ymtszw opened this issue Nov 30, 2024 · 1 comment

Comments

@ymtszw
Copy link

ymtszw commented Nov 30, 2024

Situation

In mix project, you can mix test to run ExUnit tests that contains calls to Gleam APIs (e.g. :[email protected]), but it fails if you specifically target ExUnit test files with command line arguments.

Reproduction

  • Clone this repository
  • Install Erlang/Elixir/Gleam as per official doc
  • mix archive.install hex mix_gleam
  • cd test_projects/basic_project
  • mix deps.get
  • mix test
Result (Success):
$ mix test
Compiling 1 file (.gleam)
warning: Transitive dependency imported
  ┌─ /Users/yumatsuzawa/workspace/mix_gleam/test_projects/basic_project/_build/test/lib/basic_project/test/basic_project_test.gleam:1:1
  │
1 │ import gleeunit
  │ ^^^^^^^^^^^^^^^

The module gleeunit is being imported, but gleeunit, the package it
belongs to, is not a direct dependency of your package.
In a future version of Gleam this may become a compile error.

Run this command to add it to your dependencies:

gleam add gleeunit

warning: Redundant assertion
┌─ /Users/yumatsuzawa/workspace/mix_gleam/test_projects/basic_project/_build/test/lib/basic_project/test/basic_project_test.gleam:9:7

9 │ let assert World = basic_project.hello()
│ ^^^^^^ You can remove this

This assertion is redundant since the pattern covers all possibilities.

warning: Redundant assertion
┌─ /Users/yumatsuzawa/workspace/mix_gleam/test_projects/basic_project/_build/test/lib/basic_project/test/basic_project_test.gleam:13:7

13 │ let assert World = hello_elixir()
│ ^^^^^^ You can remove this

This assertion is redundant since the pattern covers all possibilities.

Compiling 2 files (.erl)
Running ExUnit with seed: 5817, max_cases: 16

....
Finished in 0.04 seconds (0.00s async, 0.04s sync)
1 doctest, 3 tests, 0 failures

  • mix test test/basic_project_test.exs

Result (Failure):

$ mix test test/basic_project_test.exs 
** (Mix) Unknown dependency test/basic_project_test.exs for environment test

Environments

  • OS: macOS Sonoma 14.7
  • Erlang: 27.1.1 (installed with mise)
  • Elixir: 1.17.3-otp-27 (installed with mise)
  • Gleam: 1.6.2 (installed with mise, asdf-community/asdf-gleam)
  • mix_gleam: 0.6.2
@ymtszw
Copy link
Author

ymtszw commented Nov 30, 2024

I cannot tell if the root problem lies in mix_gleam, gleam or mix.
Please redirect the issue if someone can point out.

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

No branches or pull requests

1 participant