ruby-lsp-rspec
ruby-lsp-rspec copied to clipboard
Missing environment context
The application I'm working on leverages direnv to seed the environment with necessary environment variables. When I attempt to run tests via this extension I can see that these environment variables aren't being populated.
Has there been any progress or insight here?
Why would you expect progress when you don't open a PR or even just do some research for possible solutions?
You know what, you're right. Thank you for calling me out on my crap attitude. I offer my apologies.
I appreciate it 🙂 Injecting envs to test environment has always been tricky as there's no a blessed way to load those envs. I've never used direnv but I'd assume the envs is NOT loaded directly to the user shell profile but needs to be injected in some way?
Yes, exactly. Direnv basically dynamically loads environment variables provided an .envrc file when your shell boots.
I don't think this problem is unique to this plugin though. You can see Vitest has a terminal option for running tests: https://github.com/vitest-dev/vscode?tab=readme-ov-file#workspace-configurations
@jherdman I believe using mise instead of direnv will fix your problem: https://mise.jdx.dev/dev-tools/shims.html 😉