Specs do not load Shell environment variables (activationHooks core:loaded-shell-environment)


#1

I’ve just learned about Atom’s activationHooks and added the following to the package.json:

  "activationHooks": [
    "core:loaded-shell-environment"
  ],

I was previously using shell-env and now switching to using process.env:

  shellEnv()
    .then((env) ->
      console.log("env", env, process.env)
      # return env
      return process.env
    )

This works as a user within Atom: shellEnv === process.env.

However, when I am running specs using Window: Run Package Specs the process.env is incorrect!

Most importantly, the PATH environment variable is incorrect.

What is the recommended way to setup specs to ensure the process.env has been loaded by Atom correctly?
Thank you in advance!


Update: Turns out when I open Atom via Finder (I’m using a Mac) and not with the Terminal it breaks as described above. However, if I open Atom via Terminal with atom . or similar then it will correctly load the environment variables into process.env.