When you run anything at the top level (eg a script or the REPL) you can use any package in the load path, which normally includes the current project, the global v1.8 project and all the stdlibs.
However when a package is imported it can only use whatever is listed in its Project.toml deps and when a package is tested it can use only it’s Project.toml deps and extras.test.