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

[BUG] Crash when running any command from the command palette #1131

Closed
jwverzijden opened this issue Mar 27, 2024 · 2 comments · Fixed by #1132
Closed

[BUG] Crash when running any command from the command palette #1131

jwverzijden opened this issue Mar 27, 2024 · 2 comments · Fixed by #1132
Labels

Comments

@jwverzijden
Copy link

Describe the bug
I installed the extension, it immediately started testing some tests, not all, this is curious but not really the issue I want to point out.
I ran all tests manually, by selecting "run all tests" in the Command Palette, but my user session crashed and I had to log in again, not sure how that happened but it is very consistent. Activating any command related to this extension will crash my user session.

To Reproduce
Steps to reproduce the behavior:

  1. ctrl+shift+p
  2. select "run all tests"
  3. screen turns black, comes back on, my user is logged off, log back in and all applications have been closed, not just vscode, everything is closed.

Note: A sample repo will help us identify the bug much faster. 🙏
I made a new project to test if it is the configuration in the big project. I only added jest and 1 test, see codeblock below, click "run all tests" in the command palette, immediate crash. However I can run this test in the terminal with jest no issue.

const { test, describe, expect } = require('@jest/globals');
describe('describe', () => {
	test('test', () => {
		expect(true).toBe(true);
	});
});

Expected behavior
I expected

  1. the tests to run
  2. in case of an error or problem that no applications exit, not even vscode
  3. the error/problem is reported.
    Exiting my user session is not acceptable error handling.

Environment (please complete the following information):

  • vscode-jest version: 6.2.2
  • node -v: v21.6.1
  • npm -v or yarn --version: npm 10.2.4
  • jest or react-scripts (if you haven’t ejected) version: jest 29.6.3
  • your vscode-jest settings:
    • fresh install, everything is default
  • Operating system: Pop!_OS 22.04 LTS, GNOME 42.9, X11

Prerequisite

  • are you able to run jest from the command line? - yes
  • where do you run jest CLI from? - root directory of the project, anywhere in the project works the same.
  • how do you run your tests from the command line? (e.g., "npm run test" or "node_modules/.bin/jest") - npm run test which invokes jest --coverage --detectOpenHandles. Jest is installed globally with npm -g install jest:
~/project$ which jest
/usr/local/bin/jest
~/project$ ls -l /usr/local/bin/jest
lrwxrwxrwx 1 root root 36 Mar 11 15:07 /usr/local/bin/jest -> ../lib/node_modules/jest/bin/jest.js

Additional context
I'm not sure how to get more information on the crash, all applications are closed by the time I log back into my account. I don't really understand what happens here, I have never seen an application crash the entire user session like this, for example when my display driver crashes I stay logged in and can see what caused it when the driver restarts.

Maybe I'm just overlooking something but at the moment to me it feels like something is wrong with the extension.

@connectdotz
Copy link
Collaborator

@jwverzijden, thank you for bringing this issue to our attention. Although I couldn't replicate the crash (on MacOS), I did notice that the "Jest: Run All Tests" command isn't functioning as expected. Sorry about that, I will patch the command ASAP.

Here are a few observations/suggestions:

  1. It seems you might still be using an older version (v6.2.2). I recommend upgrading to the latest version of vscode-jest, v6.2.3, which resolves a focus issue potentially related to the crash you experienced.
  2. Concerning your startup experience, where "it immediately started testing some tests, not all...,". This behavior is controlled by the extension's jest.runModes setting. By default, it is set to "watch" mode, which launches Jest with the --watch option to automatically run tests related to code changes. If you prefer a more on-demand style experience, you can easily change it through the UI or by updating settings.json.
  3. As you're new to the extension, you might find the Getting Started section helpful. It introduces some common operations and insights on how to tailor the test environment to your preferences.
  4. For running tests, you might prefer the more intuitive approach of using the interactive UI instead of the command palette. For more information, please see the User Interface section.

Please let me know if updating and using the UI to run tests doesn't resolve the issue, or if you need further assistance.

@jwverzijden
Copy link
Author

It seems this was the cause of the crash, it is not happening anymore with 6.2.3.
Thanks for fixing it so quickly.

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

Successfully merging a pull request may close this issue.

2 participants