setupPATH removes all directories from the test's PATH to ensure that it only uses the PATH set by devbox. The one exception is the testscript's bin directory, which contains the commands given to testscript.RunMain (such as devbox itself).
(env *testscript.Env)
| 37 | // directory, which contains the commands given to testscript.RunMain |
| 38 | // (such as devbox itself). |
| 39 | func setupPATH(env *testscript.Env) { |
| 40 | s, _, _ := strings.Cut(env.Getenv(envir.Path), string(filepath.ListSeparator)) |
| 41 | env.Setenv(envir.Path, s) |
| 42 | } |
| 43 | |
| 44 | // setupCacheHome sets the test's XDG_CACHE_HOME to a unique temp directory so |
| 45 | // that it doesn't share caches with other tests or the user's system. For |