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

[Bug]: The package @athenna/test needs to be dynamically imported #69

Closed
jlenon7 opened this issue Sep 22, 2023 · 0 comments · Fixed by #70
Closed

[Bug]: The package @athenna/test needs to be dynamically imported #69

jlenon7 opened this issue Sep 22, 2023 · 0 comments · Fixed by #70
Labels
bug Something isn't working

Comments

@jlenon7
Copy link
Member

jlenon7 commented Sep 22, 2023

Version

4.4.1

Steps to reproduce

  1. Install production dependencies only in any Athenna application.
  2. Try to run the application
  3. Error happens

Expected behavior

I expect that my Facades does not depend on @athenna/test package to be able to work.

Actual behavior

The @athenna/test package needs to be installed as production dependency to run an Athenna application.

Additional context

A good way to fix this is to use Module.safeImport() method and save the value in a constant. The value will only be used when calling mock related methods of Facades (this kind of methods are used for testing purposes only, so we are assuming that the user will not use them in production).

Environment

System:
    OS: macOS 13.5.2
    CPU: (8) arm64 Apple M1 Pro
    Memory: 77.44 MB / 16.00 GB
    Shell: 5.9 - /opt/homebrew/bin/zsh
  Binaries:
    Node: 18.14.2 - ~/.nvm/versions/node/v18.14.2/bin/node
    npm: 9.5.0 - ~/.nvm/versions/node/v18.14.2/bin/npm
@jlenon7 jlenon7 added the bug Something isn't working label Sep 22, 2023
@jlenon7 jlenon7 linked a pull request Sep 23, 2023 that will close this issue
7 tasks
@jlenon7 jlenon7 closed this as completed Sep 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant