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

.bashrc PATH variable not being honored on Gnome + Wayland #1028

Open
darkbasic opened this issue Jun 6, 2023 · 13 comments
Open

.bashrc PATH variable not being honored on Gnome + Wayland #1028

darkbasic opened this issue Jun 6, 2023 · 13 comments

Comments

@darkbasic
Copy link

Environment

  1. vscode-jest version: v5.2.3
  2. node -v: v18.16.0
  3. npm -v or yarn --version: 4.0.0-rc.44 (corepack)
  4. npm ls jest or npm ls react-scripts (if you haven’t ejected):
@mikro-orm/[email protected] /home/niko/devel/mikro-orm
├─┬ @side/[email protected]
│ └── [email protected] deduped
├── [email protected]
└─┬ [email protected]
  └── [email protected] deduped
  1. your vscode-jest settings if customized: default
  2. Operating system: Gentoo Linux ppc64le (Raptor CS Talos 2 w/ IBM Power 9)

Prerequisite

  • are you able to run jest test from the command line? Yes
  • how do you run your tests from the command line? (for example: npm run test or node_modules/.bin/jest) yarn test

Steps to Reproduce

Clone this repo: https://github.com/mikro-orm/mikro-orm/tree/v6
Checkout to the v6 branch.
yarn install
Open vscode (Ozone Wayland) via the Gnome applications launcher under Wayland.
Wait for the error in the jest terminal:

Jest (mikro-orm)

[info] auto config:

found:
  rootPath: /home/niko/devel/mikro-orm
  jestCommandLine: yarn test


[warn] possible process env issue detected, restarting with a login-shell...


/bin/bash: line 1: yarn: command not found
TERM environment variable not set.


[error] failed to retrieve test file list. TestExplorer might show incomplete test items

[info] jest process failed to start, most likely due to env or project configuration issues, please see: https://github.com/jest-community/vscode-jest/blob/master/README.md#jest-failed-to-run

Relevant Debug Info

Symlinking /home/niko/.local/share/fnm/node-versions/v18.16.0/installation/bin/yarn to /usr/bin/yarn fixes the issue so it's definitely a PATH problem, which is weird because the bash terminal in vscode works:

image

Also starting vscode from the console instead of the Gnome application launcher works as well.
Vscode has been compiled from source, it's not a flatpak.

There are other applications which don't get access to environment variables when launched via the Gnome application launcher, like darktable. For them I ended up setting ~/.config/environment.d:

niko@talos2 ~ $ cat ~/.config/environment.d/rusticl.conf 
RUSTICL_ENABLE=radeonsi

which works for darktable.

Since I'm using fnm I use the following command to set the PATH and the other env variables in .bashrc:

eval "$(fnm env --arch ppc64le --use-on-cd)"

which returns the following:

export PATH="/run/user/1000/fnm_multishells/13209_1686066405749/bin":$PATH
export FNM_MULTISHELL_PATH="/run/user/1000/fnm_multishells/13209_1686066405749"
export FNM_VERSION_FILE_STRATEGY="local"
export FNM_DIR="/home/niko/.local/share/fnm"
export FNM_NODE_DIST_MIRROR="https://nodejs.org/dist"
export FNM_LOGLEVEL="info"
export FNM_ARCH="ppc64le"
__fnm_use_if_file_found() {
    if [[ -f .node-version || -f .nvmrc ]]; then
    fnm use --silent-if-unchanged
fi

}

__fnmcd() {
    \cd "$@" || return $?
    __fnm_use_if_file_found
}

alias cd=__fnmcd
__fnm_use_if_file_found

Not sure if ~/.config/environment.d is able to evaluate shell commands like eval "$(fnm env --arch ppc64le --use-on-cd)", but it doesn't work. I also cannot copy-paste the resulting variables because the number after fnm_multishells changes every time you run it.

Expected Behavior

It should makes use of the PATH from .bashrc.

Actual Behavior

image

@connectdotz
Copy link
Collaborator

hmmm... can you examine the process env in the spawned jest shell by following the instruction here: How to see more debug info (self-diagnosis)?, as well as the logs about spawned command and if it is using login shell etc.

@darkbasic
Copy link
Author

node:electron/js2c/renderer_init:89 Electron Security Warning (enableBlinkFeatures) This renderer process has additional "enableBlinkFeatures"
  enabled. This exposes users of this app to some security risk. If you do not
  need this feature, you should disable it.

For more information and help, consult
https://electronjs.org/docs/tutorial/security.
This warning will not show up
once the app is packaged.
(anonymous) @ node:electron/js2c/renderer_init:89
log.ts:441   ERR Extension 'ms-vscode.js-debug CANNOT USE these API proposals 'portsAttributes, findTextInFiles, workspaceTrust, tunnels'. You MUST start in extension development mode or use the --enable-proposed-api command line flag
log.ts:441   ERR [eamodio.gitlens]: editor/lineNumber/context is a proposed menu identifier. It requires 'package.json#enabledApiProposals: ["contribEditorLineNumberMenu"]' and is only available when running out of dev or with the following command line switch: --enable-proposed-api eamodio.gitlens
console.ts:137 [Extension Host] [mikro-orm/ProcessSessionManager] scheduling jest process: list-test-files
console.ts:137 [Extension Host] spawning process with command=yarn test --listTests --json --watchAll=false options: Objectcwd: "/home/niko/devel/mikro-orm"detached: trueenv: ANT_HOME: "/usr/share/ant"CASROOT: "/usr"CHROME_DESKTOP: "Electron.desktop"CONFIG_PROTECT: "/usr/share/gnupg/qualified.txt /usr/share/config /usr/lib64/libreoffice/program/sofficerc"CONFIG_PROTECT_MASK: "/etc/sandbox.d /etc/php/cli-php8.1/ext-active/ /etc/php/cgi-php8.1/ext-active/ /etc/php/apache2-php8.1/ext-active/ /etc/php/fpm-php8.1/ext-active/ /etc/php/phpdbg-php8.1/ext-active/ /etc/fonts/fonts.conf /etc/gentoo-release /etc/dconf /etc/ca-certificates.conf /etc/revdep-rebuild"CSF_GraphicShr: "/usr/lib64/opencascade/libTKOpenGl.so"CSF_IGESDefaults: "/usr/share/opencascade/resources/XSTEPResource"CSF_MDTVTexturesDirectory: "/usr/share/opencascade/resources/Textures"CSF_MIGRATION_TYPES: "/usr/share/opencascade/resources/StdResource/MigrationSheet.txt"CSF_PluginDefaults: "/usr/share/opencascade/resources/StdResource"CSF_SHMessage: "/usr/share/opencascade/resources/SHMessage"CSF_STEPDefaults: "/usr/share/opencascade/resources/XSTEPResource"CSF_ShadersDirectory: "/usr/share/opencascade/resources/Shaders"CSF_StandardDefaults: "/usr/share/opencascade/resources/StdResource"CSF_StandardLiteDefaults: "/usr/share/opencascade/resources/StdResource"CSF_UnitsDefinition: "/usr/share/opencascade/resources/UnitsAPI/Units.dat"CSF_XCAFDefaults: "/usr/share/opencascade/resources/StdResource"CSF_XSMessage: "/usr/share/opencascade/resources/XSMessage"CSF_XmlOcafResource: "/usr/share/opencascade/resources/XmlOcafResource"DBUS_SESSION_BUS_ADDRESS: "unix:path=/run/user/1000/bus"DESKTOP_SESSION: "gnome"DISPLAY: ":1"EDITOR: "/bin/nano"ELECTRON_NO_ATTACH_CONSOLE: "1"ELECTRON_RUN_AS_NODE: "1"GCC_SPECS: ""GDK_BACKEND: "x11"GDMSESSION: "gnome"GDM_LANG: "en_US.UTF-8"GIO_LAUNCHED_DESKTOP_FILE: "/usr/share/applications/code-oss.desktop"GIO_LAUNCHED_DESKTOP_FILE_PID: "3579387"GJS_DEBUG_OUTPUT: "stderr"GJS_DEBUG_TOPICS: "JS ERROR;JS LOG"GSETTINGS_BACKEND: "dconf"GTK_MODULES: "canberra-gtk-module"HOME: "/home/niko"INFOPATH: "/usr/share/gcc-data/powerpc64le-unknown-linux-gnu/12/info:/usr/share/binutils-data/powerpc64le-unknown-linux-gnu/2.39/info:/usr/share/info"INVOCATION_ID: "ba7692fb2fa54f2db5fa6909550befb4"JAVAC: "/etc/java-config-2/current-system-vm/bin/javac"JAVA_HOME: "/etc/java-config-2/current-system-vm"JDK_HOME: "/etc/java-config-2/current-system-vm"JOURNAL_STREAM: "8:29268"LADSPA_PATH: "/usr/lib64/ladspa"LANG: "en_US.UTF-8"LESS: "-R -M --shift 5"LESSOPEN: "|lesspipe %s"LEX: "flex"LOGNAME: "niko"LV2_PATH: "/usr/lib64/lv2"MAIL: "/var/mail/niko"MANAGERPID: "2026"MANPAGER: "manpager"MANPATH: "/etc/java-config-2/current-system-vm/man:/usr/share/gcc-data/powerpc64le-unknown-linux-gnu/12/man:/usr/share/binutils-data/powerpc64le-unknown-linux-gnu/2.39/man:/etc/java-config-2/current-system-vm/man/:/usr/lib64/php8.1/man/:/usr/local/share/man:/usr/share/man:/usr/lib/rust/man:/usr/lib/llvm/16/share/man:/usr/lib/llvm/15/share/man"MOTD_SHOWN: "pam"MOZ_GMP_PATH: "/usr/lib64/nsbrowser/plugins/gmp-gmpopenh264/system-installed"NO_AT_BRIDGE: "1"NPM_CONFIG_GLOBALCONFIG: "/etc/npm/npmrc"NPM_CONFIG_NODEDIR: "/usr/lib64/electron-19/node/"ORIGINAL_XDG_CURRENT_DESKTOP: "GNOME"PAGER: "/usr/bin/less"PATH: "/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/bin:/usr/lib/llvm/16/bin:/usr/lib/llvm/15/bin:/usr/lib64/opencascade/bin"PWD: "/home/niko"QEMU_LD_PREFIX: "/home/niko/chroots/arch-x86_64"QT_IM_MODULE: "ibus"RADV_PERFTEST: "gpl"ROOTPATH: "/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/bin:/usr/lib/llvm/16/bin:/usr/lib/llvm/15/bin"RUSTICL_ENABLE: "radeonsi"SESSION_MANAGER: "local/talos2:@/tmp/.ICE-unix/2134,unix/talos2:/tmp/.ICE-unix/2134"SHELL: "/bin/bash"SHLVL: "0"SSH_AGENT_PID: "2096"SSH_AUTH_SOCK: "/run/user/1000/keyring/ssh"SYSTEMD_EXEC_PID: "2152"USER: "niko"USERNAME: "niko"VSCODE_AMD_ENTRYPOINT: "vs/workbench/api/node/extensionHostProcess"VSCODE_CLI: "1"VSCODE_CODE_CACHE_PATH: "/home/niko/.config/Code - OSS/CachedData/fdb61c765fe88271c90a0d9fec1c0eb276bb00c5"VSCODE_CWD: "/home/niko"VSCODE_HANDLES_UNCAUGHT_ERRORS: "true"VSCODE_IPC_HOOK: "/run/user/1000/vscode-dab5a489-1.78-main.sock"VSCODE_NLS_CONFIG: "{\"locale\":\"en-us\",\"osLocale\":\"en\",\"availableLanguages\":{},\"_languagePackSupport\":true}"VSCODE_PID: "3579405"WINDOWPATH: "2"XAUTHORITY: "/run/user/1000/gdm/Xauthority"XCURSOR_THEME: "Adwaita"XDG_CONFIG_DIRS: "/etc/xdg"XDG_CURRENT_DESKTOP: "GNOME"XDG_DATA_DIRS: "/usr/share/gnome:/usr/local/share:/usr/share:/usr/share/gdm"XDG_MENU_PREFIX: "gnome-"XDG_RUNTIME_DIR: "/run/user/1000"XDG_SESSION_CLASS: "user"XDG_SESSION_DESKTOP: "gnome"XDG_SESSION_TYPE: "x11"XMODIFIERS: "@im=ibus"XZ_DEFAULTS: "-T0"[[Prototype]]: Objectshell: true[[Prototype]]: Objectconstructor: ƒ Object()hasOwnProperty: ƒ hasOwnProperty()isPrototypeOf: ƒ isPrototypeOf()propertyIsEnumerable: ƒ propertyIsEnumerable()toLocaleString: ƒ toLocaleString()toString: ƒ toString()valueOf: ƒ valueOf()__defineGetter__: ƒ __defineGetter__()__defineSetter__: ƒ __defineSetter__()__lookupGetter__: ƒ __lookupGetter__()__lookupSetter__: ƒ __lookupSetter__()__proto__: (...)get __proto__: ƒ __proto__()set __proto__: ƒ __proto__()
console.ts:137 [Extension Host] [mikro-orm/JestExt] found undefined testFiles
log.ts:441   ERR [Extension Host] [mikro-orm/JestExt] failed to retrieve test file list. TestExplorer might show incomplete test items error @mikro-orm/[email protected]: The engine "yarn" is incompatible with this module. Expected version ">=3.2.0". Got "1.22.19"
error Commands cannot run with an incompatible environment.

console.ts:137 [Extension Host] [mikro-orm/JestExt] failed to retrieve test file list. TestExplorer might show incomplete test items error @mikro-orm/[email protected]: The engine "yarn" is incompatible with this module. Expected version ">=3.2.0". Got "1.22.19"
error Commands cannot run with an incompatible environment.

I @ console.ts:137
log.ts:421  INFO [perf] Render performance baseline is 191ms
Object
cwd: "/home/niko/devel/mikro-orm"
detached: true
env:
ANT_HOME: "/usr/share/ant"
CASROOT: "/usr"
CHROME_DESKTOP: "Electron.desktop"
CONFIG_PROTECT: "/usr/share/gnupg/qualified.txt /usr/share/config /usr/lib64/libreoffice/program/sofficerc"
CONFIG_PROTECT_MASK: "/etc/sandbox.d /etc/php/cli-php8.1/ext-active/ /etc/php/cgi-php8.1/ext-active/ /etc/php/apache2-php8.1/ext-active/ /etc/php/fpm-php8.1/ext-active/ /etc/php/phpdbg-php8.1/ext-active/ /etc/fonts/fonts.conf /etc/gentoo-release /etc/dconf /etc/ca-certificates.conf /etc/revdep-rebuild"
CSF_GraphicShr: "/usr/lib64/opencascade/libTKOpenGl.so"
CSF_IGESDefaults: "/usr/share/opencascade/resources/XSTEPResource"
CSF_MDTVTexturesDirectory: "/usr/share/opencascade/resources/Textures"
CSF_MIGRATION_TYPES: "/usr/share/opencascade/resources/StdResource/MigrationSheet.txt"
CSF_PluginDefaults: "/usr/share/opencascade/resources/StdResource"
CSF_SHMessage: "/usr/share/opencascade/resources/SHMessage"
CSF_STEPDefaults: "/usr/share/opencascade/resources/XSTEPResource"
CSF_ShadersDirectory: "/usr/share/opencascade/resources/Shaders"
CSF_StandardDefaults: "/usr/share/opencascade/resources/StdResource"
CSF_StandardLiteDefaults: "/usr/share/opencascade/resources/StdResource"
CSF_UnitsDefinition: "/usr/share/opencascade/resources/UnitsAPI/Units.dat"
CSF_XCAFDefaults: "/usr/share/opencascade/resources/StdResource"
CSF_XSMessage: "/usr/share/opencascade/resources/XSMessage"
CSF_XmlOcafResource: "/usr/share/opencascade/resources/XmlOcafResource"
DBUS_SESSION_BUS_ADDRESS: "unix:path=/run/user/1000/bus"
DESKTOP_SESSION: "gnome"
DISPLAY: ":1"
EDITOR: "/bin/nano"
ELECTRON_NO_ATTACH_CONSOLE: "1"
ELECTRON_RUN_AS_NODE: "1"
GCC_SPECS: ""
GDK_BACKEND: "x11"
GDMSESSION: "gnome"
GDM_LANG: "en_US.UTF-8"
GIO_LAUNCHED_DESKTOP_FILE: "/usr/share/applications/code-oss.desktop"
GIO_LAUNCHED_DESKTOP_FILE_PID: "3579387"
GJS_DEBUG_OUTPUT: "stderr"
GJS_DEBUG_TOPICS: "JS ERROR;JS LOG"
GSETTINGS_BACKEND: "dconf"
GTK_MODULES: "canberra-gtk-module"
HOME: "/home/niko"
INFOPATH: "/usr/share/gcc-data/powerpc64le-unknown-linux-gnu/12/info:/usr/share/binutils-data/powerpc64le-unknown-linux-gnu/2.39/info:/usr/share/info"
INVOCATION_ID: "ba7692fb2fa54f2db5fa6909550befb4"
JAVAC: "/etc/java-config-2/current-system-vm/bin/javac"
JAVA_HOME: "/etc/java-config-2/current-system-vm"
JDK_HOME: "/etc/java-config-2/current-system-vm"
JOURNAL_STREAM: "8:29268"
LADSPA_PATH: "/usr/lib64/ladspa"
LANG: "en_US.UTF-8"
LESS: "-R -M --shift 5"
LESSOPEN: "|lesspipe %s"
LEX: "flex"
LOGNAME: "niko"
LV2_PATH: "/usr/lib64/lv2"
MAIL: "/var/mail/niko"
MANAGERPID: "2026"
MANPAGER: "manpager"
MANPATH: "/etc/java-config-2/current-system-vm/man:/usr/share/gcc-data/powerpc64le-unknown-linux-gnu/12/man:/usr/share/binutils-data/powerpc64le-unknown-linux-gnu/2.39/man:/etc/java-config-2/current-system-vm/man/:/usr/lib64/php8.1/man/:/usr/local/share/man:/usr/share/man:/usr/lib/rust/man:/usr/lib/llvm/16/share/man:/usr/lib/llvm/15/share/man"
MOTD_SHOWN: "pam"
MOZ_GMP_PATH: "/usr/lib64/nsbrowser/plugins/gmp-gmpopenh264/system-installed"
NO_AT_BRIDGE: "1"
NPM_CONFIG_GLOBALCONFIG: "/etc/npm/npmrc"
NPM_CONFIG_NODEDIR: "/usr/lib64/electron-19/node/"
ORIGINAL_XDG_CURRENT_DESKTOP: "GNOME"
PAGER: "/usr/bin/less"
PATH: "/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/bin:/usr/lib/llvm/16/bin:/usr/lib/llvm/15/bin:/usr/lib64/opencascade/bin"
PWD: "/home/niko"
QEMU_LD_PREFIX: "/home/niko/chroots/arch-x86_64"
QT_IM_MODULE: "ibus"
RADV_PERFTEST: "gpl"
ROOTPATH: "/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/bin:/usr/lib/llvm/16/bin:/usr/lib/llvm/15/bin"
RUSTICL_ENABLE: "radeonsi"
SESSION_MANAGER: "local/talos2:@/tmp/.ICE-unix/2134,unix/talos2:/tmp/.ICE-unix/2134"
SHELL: "/bin/bash"
SHLVL: "0"
SSH_AGENT_PID: "2096"
SSH_AUTH_SOCK: "/run/user/1000/keyring/ssh"
SYSTEMD_EXEC_PID: "2152"
USER: "niko"
USERNAME: "niko"
VSCODE_AMD_ENTRYPOINT: "vs/workbench/api/node/extensionHostProcess"
VSCODE_CLI: "1"
VSCODE_CODE_CACHE_PATH: "/home/niko/.config/Code - OSS/CachedData/fdb61c765fe88271c90a0d9fec1c0eb276bb00c5"
VSCODE_CWD: "/home/niko"
VSCODE_HANDLES_UNCAUGHT_ERRORS: "true"
VSCODE_IPC_HOOK: "/run/user/1000/vscode-dab5a489-1.78-main.sock"
VSCODE_NLS_CONFIG: "{\"locale\":\"en-us\",\"osLocale\":\"en\",\"availableLanguages\":{},\"_languagePackSupport\":true}"
VSCODE_PID: "3579405"
WINDOWPATH: "2"
XAUTHORITY: "/run/user/1000/gdm/Xauthority"
XCURSOR_THEME: "Adwaita"
XDG_CONFIG_DIRS: "/etc/xdg"
XDG_CURRENT_DESKTOP: "GNOME"
XDG_DATA_DIRS: "/usr/share/gnome:/usr/local/share:/usr/share:/usr/share/gdm"
XDG_MENU_PREFIX: "gnome-"
XDG_RUNTIME_DIR: "/run/user/1000"
XDG_SESSION_CLASS: "user"
XDG_SESSION_DESKTOP: "gnome"
XDG_SESSION_TYPE: "x11"
XMODIFIERS: "@im=ibus"
XZ_DEFAULTS: "-T0"
[[Prototype]]: Object
shell: true
[[Prototype]]: Object

@connectdotz
Copy link
Collaborator

In the console log, did you see anything regarding running a login shell? Also, did you by any chance customize vscode's terminal/shell settings?

@darkbasic
Copy link
Author

I don't think I've seen anything about login shells:
image

did you by any chance customize vscode's terminal/shell settings?

I don't think so, if you have any particular setting you want me to look for let me know.

@connectdotz
Copy link
Collaborator

if you have any particular setting you want me to look for let me know.

The setting that could change the terminal shell profiles, such as terminal.integrated.profiles.* or terminal.integrated.defaultProfile.*... Basically, I am trying to see why you can run it in a terminal but not in the extension.

If you just run the default bash shell in the terminal, all your setting is in .bashrc, and you didn't start code from a terminal already configured correctly - then it is most likely you need to start the extension with a login shell so it will source the .bashrc in each child process we spawned for jest run. Not very efficient, but it should closely mimic running jest from a terminal.

Let me know what happens after you set the shell setting accordingly.

@darkbasic
Copy link
Author

The setting that could change the terminal shell profiles, such as terminal.integrated.profiles.* or terminal.integrated.defaultProfile.*

Nope, all default.

Let me know what happens after you set the shell setting accordingly.

Didn't work. To recap:

  • In Gnome Console the $PATH is correct and it is as follows:
niko@talos2 ~ $ echo $PATH
/run/user/1000/fnm_multishells/4137624_1686684513110/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/bin:/usr/lib/llvm/16/bin:/usr/lib/llvm/15/bin:/usr/lib64/opencascade/bin:/home/niko/Android/Sdk/emulator:/home/niko/Android/Sdk/platform-tools
  • With vscode default settings if I open vscode from the Gnome Console and I open a (bash) terminal the PATH is correct:
    image
  • With vscode default settings if I open vscode from the Gnome Console jest gets the correct PATH:
    image
  • If I open vscode from the Gnome Console and "jest.shell": {"path": "/bin/bash", "args": ["--login"]} in settings.json jest does NOT get the correct PATH:
    image
  • If I open vscode from the Gnome Console and "jest.shell": {"path": "/bin/bash", "args": []} in settings.json jest gets the correct PATH.
  • With vscode default settings if I open vscode from the Gnome application launcher and I open a (bash) terminal the PATH is correct.
  • With vscode default settings if I open vscode from the Gnome application launcher jest does NOT get the correct PATH.
  • If I open vscode from the Gnome application launcher and I also add "jest.shell": {"path": "/bin/bash", "args": ["--login"]} to settings.json jest does NOT get the correct PATH.
  • If I open vscode from the Gnome application launcher and I also add "jest.shell": {"path": "/bin/bash", "args": []} to settings.json jest does NOT get the correct PATH.

@connectdotz
Copy link
Collaborator

Ok, thanks for the detailed info. This leads me to think maybe none of your login profiles (.bash_profile, .bash_login, or .profile, which the login shell will source) sourced the .bashrc? That would explain your situation.🤔

If it is indeed the case, and you can't add the .bashrc to your login profiles, then you need to find a way to source .bashrc explicitly... maybe modify your test script in package.json like this:

"scripts": {
    "test": "bash -c 'source ~/.bashrc && yarn actual-test'",
    "actual-test": "<the_original_test_command>"
  },

But make sure it can find "yarn" to kick off the rest. Anyway, let's verify the root cause first. Once we know what it is, I am sure there will be a lot more solutions you can devise.

@darkbasic
Copy link
Author

This leads me to think maybe none of your login profiles (.bash_profile, .bash_login, or .profile, which the login shell will source) sourced the .bashrc?

I think that .bash_profile does:

# /etc/skel/.bash_profile

# This file is sourced by bash for login shells.  The following line
# runs your .bashrc and is recommended by the bash info pages.
if [[ -f ~/.bashrc ]] ; then
        . ~/.bashrc
fi

maybe modify your test script in package.json like this

That does indeed work, but I cannot do so in a project where I'm just an external contributor.

@darkbasic
Copy link
Author

darkbasic commented Jun 14, 2023

Anyway, let's verify the root cause first. Once we know what it is, I am sure there will be a lot more solutions you can devise.

I have the feeling that this might be Gnome on Wayland specific (or to be precise gdm on Wayland specific I'd guess), because I had a similar issue before:
image
Neither .bashrc nor .bash_profile nor .profile would work (didn't try .bash_login though) and I had to resort to ~/.config/environment.d which I think expects VAR=something and doesn't support running eval "$(fnm env --arch ppc64le --use-on-cd)".

@connectdotz
Copy link
Collaborator

connectdotz commented Jun 14, 2023

maybe... the other alternative is to directly modify jest.jestCommandLine to do the sourcing and launch the test command directly (without going through yarn).

@darkbasic
Copy link
Author

darkbasic commented Jun 14, 2023

Weirdly "jest.jestCommandLine": "source ~/.bashrc && yarn jest" doesn't work either, in fact here is the output of "jest.jestCommandLine": "source ~/.bashrc && echo $PATH":

/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/bin:/usr/lib/llvm/16/bin:/usr/lib/llvm/15/bin:/usr/lib64/opencascade/bin --testLocationInResults --json --useStderr --outputFile /tmp/jest_runner_mikro_orm_1000.json --watch --no-coverage --reporters default --reporters /home/niko/.vscode-oss/extensions/orta.vscode-jest-5.2.3/out/reporter.js --colors

Also I cannot set so globally because not every project uses yarn.

@connectdotz
Copy link
Collaborator

you need to put them into the same bash session, try "jest.jestCommandLine": "bash -c 'source ~/.bashrc && yarn test'"

Also I cannot set so globally because not every project uses yarn.

You don't need to use yarn, copy the actual test script from project.json and use it directly in jestCommandLine.

Not sure what you mean by globally? jest.jestCommandLine is configured per workspace folder... did I miss something?

@darkbasic
Copy link
Author

darkbasic commented Jun 15, 2023

you need to put them into the same bash session, try "jest.jestCommandLine": "bash -c 'source ~/.bashrc && yarn test'"

Nope, it's the same unfortunately.

Not sure what you mean by globally? jest.jestCommandLine is configured per workspace folder... did I miss something?

You can configure it either per-workspace or per-user and I'm doing the latter (~/.config/Code\ -\ OSS/User/settings.json).
I could do it per-workspace but since I work on dozens of different projects it would be quite annoying to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants