vitest-dev / vscode

VS Code extension for Vitest
https://vitest.dev/vscode
MIT License
754 stars 85 forks source link

Not working on macOS #44

Closed searene closed 1 year ago

searene commented 2 years ago

Describe the bug Maybe I didn't use the addon in the correct way? But simply put, the addon is not working at all. After installing it, I saw the testing tab, I saw the little error beside the test, but no matter where I click, the test is not running.

To Reproduce

  1. Git clone this repository: https://github.com/zxch3n/vitest-ext-basic-example
  2. Run node setup.mjs.
  3. Open it with VSCode.
  4. Click on the arrow beside the test to start testing. Nothing happens.

Expected behavior It should start testing.

Screenshots

image

Environment

{
  "System": {
    "OS": "macOS 12.4"
  },
  "Binaries": {
    "Node": {
      "version": "18.2.0",
      "path": "~/.nvm/versions/node/v18.2.0/bin/node"
    },
    "Yarn": {
      "version": "1.22.18",
      "path": "/usr/local/bin/yarn"
    },
    "npm": {
      "version": "8.9.0",
      "path": "~/.nvm/versions/node/v18.2.0/bin/npm"
    }
  },
  "IDEs": {
    "VSCode": {
      "version": "1.67.2",
      "path": "/usr/local/bin/code"
    }
  },
  "npmPackages": {
    "vite": {
      "installed": "2.9.9",
      "wanted": "^2.9.9"
    },
    "vitest": {
      "installed": "0.12.10",
      "wanted": "^0.12.6"
    }
  }
}
fauxparse commented 2 years ago

+1

emanuelarcos commented 2 years ago

+1

zxch3n commented 2 years ago

Could you switch to the pre-release version and check whether it acts the same? If so, please attach the output log from Vitest to help me locate the issue.

image

I'm also using macOS, but I cannot reproduce this error. I need you guys' help, thanks.

searene commented 2 years ago

@zxch3n

Hi, how to switch to the pre-release version? Are there any guidelines?

zxch3n commented 2 years ago

@searene You can do it in the extension homepage

image
searene commented 2 years ago

@zxch3n Hi,

After I started the 1 + 1 = 2 test by clicking here using the pre-release version

image

I got the following output:

[INFO 8:53:41 PM] Vitest Workspace [vitest-ext-basic-example]: Vitest version = 0.12.10
[INFO 8:55:01 PM] Tests run start
[INFO 8:55:01 PM] [Workspace "vitest-ext-basic-example] Run tests from workspace
[INFO 8:55:01 PM] [Execute Vitest] ./node_modules/.bin/vitest /Users/joey/WebstormProjects/vitest-ext-basic-example/add.test.ts -t add 1 + 1
[INFO 8:55:01 PM] Start api process at port 65185
[INFO 8:55:01 PM] [RUN] ./node_modules/.bin/vitest /Users/joey/WebstormProjects/vitest-ext-basic-example/add.test.ts -t add 1 + 1
[INFO 8:55:01 PM] [RUN.cwd] /Users/joey/WebstormProjects/vitest-ext-basic-example
[INFO 8:55:01 PM] WS Close
[INFO 8:55:01 PM] WS Close
[INFO 8:55:01 PM] WS Close
[INFO 8:55:02 PM] WS Close
[INFO 8:55:02 PM] WS Close
[INFO 8:55:02 PM] WS Opened
[INFO 8:55:02 PM] WS Opened
[INFO 8:55:02 PM] 

 DEV  v0.12.10 /Users/joey/WebstormProjects/vitest-ext-basic-example

      API started at http://localhost:65185

[INFO 8:55:03 PM] Vitest api process finished
[INFO 8:55:03 PM] [Workspace "vitest-ext-basic-example] Test run finished
[INFO 8:55:03 PM] Tests run end
[INFO 8:55:03 PM] WS Close
[INFO 8:55:03 PM] WS Close
[INFO 8:55:03 PM] API PROCESS EXIT
[INFO 8:55:03 PM] Vitest api process finished
[Error 8:55:03 PM] 
Failed to get any result
( Vitest should be configured to be able to run from project root )

Error when running
    ./node_modules/.bin/vitest /Users/joey/WebstormProjects/vitest-ext-basic-example/add.test.ts -t add 1 + 1

cwd: /Users/joey/WebstormProjects/vitest-ext-basic-example
node: v18.2.0

env.PATH: /Users/joey/.nvm/versions/node/v18.2.0/bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/joey/.cargo/bin:/Users/joey/apps/fd:/Users/joey/.emacs.d/bin

[Error 8:55:03 PM] 

 DEV  v0.12.10 /Users/joey/WebstormProjects/vitest-ext-basic-example

      API started at http://localhost:65185

[INFO 8:55:03 PM]  ↓ add.test.ts  (1 test | 1 skipped)

Test Files  1 skipped (1)

     Tests  1 skipped (1)

      Time  909ms (in thread 0ms, Infinity%)

 PASS  Waiting for file changes...

       press h to show help, press q to quit

Seems like the test is skipped. By the way, when I ran the test manually outside of VSCode using the following command:

./node_modules/.bin/vitest /Users/joey/WebstormProjects/vitest-ext-basic-example/add.test.ts -t add 1 + 1

The test is passed as expected:

 DEV  v0.12.10 /Users/joey/WebstormProjects/vitest-ext-basic-example

 √ add.test.ts (1)

Test Files  1 passed (1)
     Tests  1 passed (1)
      Time  796ms (in thread 2ms, 39794.48%)

 PASS  Waiting for file changes...
       press h to show help, press q to quit
benbender commented 2 years ago

Same problem on m1-osx with a solid-project :/

benblazak commented 2 years ago

Works for me, following the steps to reproduce on an M1 Mac Mini, using the pre-release version of the plugin. Node 18.4.0 (and npm, not yarn, if that makes a difference).

I am having problems getting it to work in a svelte project (even a newly initialized one) though.

niktek commented 2 years ago

m1 Mac, svelte-kit project, it can see all the tests, but can't run them:

[INFO 3:01:36 pm] Tests run start
[INFO 3:01:36 pm] [Workspace "dev-skeleton] Run tests from workspace
[INFO 3:01:36 pm] [Execute Vitest] vitest /Users/nik/code/github/dev-skeleton/src/lib/Accordion/AccordionGroup.test.ts -t Accordion.svelte Renders without props
[INFO 3:01:36 pm] Start api process at port 55986
[INFO 3:01:36 pm] [RUN] vitest /Users/nik/code/github/dev-skeleton/src/lib/Accordion/AccordionGroup.test.ts -t Accordion.svelte Renders without props
[INFO 3:01:36 pm] [RUN.cwd] /Users/nik/code/github/dev-skeleton
[INFO 3:01:36 pm] WS Close
[INFO 3:01:37 pm] WS Close
[INFO 3:01:37 pm] WS Close
[INFO 3:01:37 pm] WS Close
[INFO 3:01:37 pm] WS Close

pnpm test runs the tests in the console fine.

Changed to npm and it got a lot further, but still didn't show any coloured tests:

[INFO 3:10:34 pm] Vitest Workspace [dev-skeleton]: Vitest version = 0.19.1
[INFO 3:10:51 pm] WS Close
[INFO 3:10:52 pm] 

 DEV  v0.19.1 /Users/nik/code/github/dev-skeleton

      API started at http://localhost:51204

[INFO 3:10:53 pm]  ✓ src/lib/Paginator/Paginator.test.ts  (2 tests) 22ms

 ✓ src/lib/CodeBlock/CodeBlock.test.ts  (1 test) 38ms

 ✓ src/lib/Button/Button.test.ts  (3 tests) 44ms

 ✓ src/lib/Avatar/Avatar.test.ts  (6 tests) 43ms

[INFO 3:10:53 pm] WS Close
[INFO 3:10:53 pm] WS Close
[INFO 3:10:54 pm]  ✓ src/lib/Accordion/AccordionItem.test.ts  (3 tests) 18ms

 ✓ src/lib/RangeSlider/RangeSlider.test.ts  (4 tests) 35ms

 ✓ src/lib/Table/DataTable.test.ts  (2 tests) 28ms

 ✓ src/lib/ConicGradient/ConicGradient.test.ts  (2 tests) 18ms

[INFO 3:10:54 pm] stderr | src/lib/Tab/TabGroup.test.ts > TabGroup.svelte > Renders without props

<TabGroup> was created without expected prop 'selected'

 ✓ src/lib/Tab/TabGroup.test.ts  (1 test) 11ms

 ✓ src/lib/Drawer/Drawer.test.ts  (2 tests) 14ms

 ✓ src/lib/Filters/filter.test.ts  (2 tests) 18ms

stderr | src/lib/Radio/RadioGroup.test.ts > RadioGroup.svelte > Renders without props

stderr | src/lib/Radio/RadioGroup.test.ts > RadioGroup.svelte > Renders with props

<RadioGroup> was created without expected prop 'selected'

<RadioGroup> was created without expected prop 'selected'

 ✓ src/lib/Radio/RadioGroup.test.ts  (2 tests) 11ms

[INFO 3:10:55 pm]  ✓ src/lib/Stepper/Step.test.ts  (2 tests) 19ms

stderr | src/lib/Stepper/Step.test.ts > Step.svelte > Renders without props

<Step> was created without expected prop 'index'

 ✓ src/lib/List/List.test.ts  (6 tests) 24ms

 ✓ src/lib/Breadcrumb/Crumb.test.ts  (2 tests) 14ms

 ✓ src/lib/Alert/Alert.test.ts  (2 tests) 16ms

[INFO 3:10:55 pm] WS Close
[INFO 3:10:55 pm] WS Close
[INFO 3:10:56 pm]  ✓ src/lib/Divider/Divider.test.ts  (2 tests) 14ms

 ✓ src/lib/GradientHeading/GradientHeading.test.ts  (6 tests) 19ms

stderr | src/lib/Radio/RadioItem.test.ts > RadioItem.svelte > Renders without props

 ✓ src/lib/Radio/RadioItem.test.ts  (2 tests) 27ms

<RadioItem> was created without expected prop 'value'

 ✓ src/lib/SlideToggle/SlideToggle.test.ts  (2 tests) 16ms

[INFO 3:10:56 pm]  ✓ src/lib/List/NavItem.test.ts  (1 test) 11ms

[INFO 3:10:56 pm]  ✓ src/lib/Accordion/AccordionGroup.test.ts  (2 tests) 11ms

stderr | src/lib/Accordion/AccordionGroup.test.ts > Accordion.svelte > Renders without props

<AccordionGroup> was created without expected prop 'selected'

stderr | src/lib/Accordion/AccordionGroup.test.ts > Accordion.svelte > Renders with props

<AccordionGroup> was created without expected prop 'selected'

 ✓ src/lib/Badge/Badge.test.ts  (2 tests) 12ms

 ✓ src/lib/Progress/ProgressBar.test.ts  (2 tests) 12ms

[INFO 3:10:57 pm]  ✓ src/lib/List/ListItem.test.ts  (1 test) 13ms

 ✓ src/lib/LogoCloud/Logo.test.ts  (1 test) 10ms

 ✓ src/lib/Tooltip/Tooltip.test.ts  (2 tests) 11ms

 ✓ src/lib/Stepper/Stepper.test.ts  (2 tests) 11ms

[INFO 3:10:57 pm]  ✓ src/lib/Tab/Tab.test.ts  (1 test) 10ms

 ✓ src/lib/Breadcrumb/Breadcrumb.test.ts  (1 test) 9ms

 ✓ src/lib/Card/Card.test.ts  (2 tests) 11ms

 ✓ src/lib/LogoCloud/LogoCloud.test.ts  (1 test) 9ms

[INFO 3:10:57 pm] WS Close
[INFO 3:10:57 pm] WS Close
[INFO 3:10:58 pm]  ↓ src/lib/LightSwitch/LightSwitch.test.ts  (2 tests | 2 skipped)

 ↓ src/lib/Menu/Menu.test.ts  (3 tests | 3 skipped)

Test Files  32 passed | 2 skipped (34)

     Tests  72 passed | 5 skipped (77)

      Time  5.94s (in thread 579ms, 1026.52%)

 PASS  Waiting for file changes...

       press h to show help, press q to quit

[INFO 3:10:59 pm] WS Close
[INFO 3:10:59 pm] WS Close
[INFO 3:11:01 pm] WS Close
[INFO 3:11:01 pm] WS Close
[INFO 3:11:03 pm] WS Close
[INFO 3:11:03 pm] WS Close
[INFO 3:11:05 pm] WS Close
[INFO 3:11:05 pm] WS Close
[INFO 3:11:07 pm] WS Close
[INFO 3:11:07 pm] WS Close
[INFO 3:11:09 pm] WS Close
[INFO 3:11:09 pm] WS Close
zachequi commented 2 years ago

Same issue for me on linux, it looks like the websocket never connects (no WS Open message). I can confirm downgrading vitest works. Using latest vitest 0.22.1 and extension 0.2.28

ahoyahoy commented 1 year ago

version 0.2.15 works for me as the last one win 10, node 16

zxch3n commented 1 year ago

This issue should be fixed now. If it's still wrong, let me know