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

elixir: Fix mix test $ZED_SYMBOL task #11879

Merged
merged 3 commits into from
May 31, 2024
Merged

Conversation

feliperenan
Copy link
Contributor

@feliperenan feliperenan commented May 15, 2024

$ZED_SYMBOL doesn't really work here once that will try to do something like this:

mix test MyModule.MyModuleTest

instead of using the path of the file:

mix test test/my_module/my_module_test.exs

Release Notes:

  • Fix mix test $ZED_SYMBOL to use ZED_RELATIVE_FILE instead
  • Use ZED_RELATIVE_FILE instead of ZED_FILE to improve mix tasks results on Elixir umbrella projects

$ZED_SYMBOL doesn't really work here once that will try to do something
like this:

  mix test MyModule.MyModuleTest

instead of using the path of the file:

  mix test test/my_module/my_module_test.exs
Copy link

cla-bot bot commented May 15, 2024

We require contributors to sign our Contributor License Agreement, and we don't have @feliperenan on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@feliperenan
Copy link
Contributor Author

@cla-bot check

Copy link

cla-bot bot commented May 15, 2024

We require contributors to sign our Contributor License Agreement, and we don't have @feliperenan on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

Copy link

cla-bot bot commented May 15, 2024

The cla-bot has been summoned, and re-checked this pull request!

@feliperenan
Copy link
Contributor Author

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label May 15, 2024
Copy link

cla-bot bot commented May 15, 2024

The cla-bot has been summoned, and re-checked this pull request!

"command": "mix",
"args": ["test", "$ZED_SYMBOL"]
"args": ["test", "$ZED_FILE"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we could have another variable, something like ZED_RELATIVE_FILE_PATH. The reason is that when running this task within umbrella apps, that will output test runs for all projects even though they are skipped. For instance:

❯ mix test /Users/feliperenan/source/my_umbrella_app/apps/my_app/test/my_app_web/controllers/my_controller_test.exs
==> my_app
......

Finished in 1.9 seconds (1.9s async, 0.00s sync)
6 tests, 0 failures

Randomized with seed 45266
==> another_app_within_umbrella_app


Finished in 0.00 seconds (0.00s async, 0.00s sync)
0 failures

While, if we use the relative path, it would be:

❯ mix test apps/my_app/test/my_app_web/controllers/my_controller_test.exs
==> my_app
......

Finished in 1.3 seconds (1.3s async, 0.00s sync)
6 tests, 0 failures

Randomized with seed 507991

@maxdeviant maxdeviant changed the title Elixir - Fix task mix test $ZED_FILE elixir: Fix mix test $ZED_FILE task May 15, 2024
@maxdeviant maxdeviant changed the title elixir: Fix mix test $ZED_FILE task elixir: Fix mix test $ZED_SYMBOL task May 16, 2024
@baldwindavid
Copy link
Contributor

This must have gotten broken during the recent move of elixir support into an extension. I already had my own elixir tasks so didn't notice. As you mention, it would be nice to have something like $ZED_RELATIVE_PATH. A relative path is also necessary for using the browse functionality of the Github CLI (https://cli.github.com/manual/gh_browse).

@osiewicz
Copy link
Contributor

I've added ZED_RELATIVE_FILE in #12245

@feliperenan
Copy link
Contributor Author

Thank you @osiewicz. I just tested and it works like a charm. Just updated this PR to use ZED_RELATIVE_FILE as well.

@osiewicz osiewicz merged commit 2cff075 into zed-industries:main May 31, 2024
9 checks passed
osiewicz added a commit that referenced this pull request Jun 4, 2024
osiewicz added a commit to zed-industries/extensions that referenced this pull request Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants