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

Not working on macOS #44

Closed
searene opened this issue May 31, 2022 · 12 comments
Closed

Not working on macOS #44

searene opened this issue May 31, 2022 · 12 comments
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@searene
Copy link

searene commented May 31, 2022

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"
    }
  }
}
@searene searene added the p3-minor-bug An edge case that only affects very specific usage (priority) label May 31, 2022
@fauxparse
Copy link

+1

1 similar comment
@emanuelarcos
Copy link

+1

@zxch3n
Copy link
Member

zxch3n commented Jun 18, 2022

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
Copy link
Author

searene commented Jun 19, 2022

@zxch3n

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

@zxch3n
Copy link
Member

zxch3n commented Jun 19, 2022

@searene You can do it in the extension homepage
image

@searene
Copy link
Author

searene commented Jun 20, 2022

@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
Copy link

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

kodiakhq bot pushed a commit to recipeyak/recipeyak that referenced this issue Aug 1, 2022
Basically:
- Replace web pack setup with vite and upgrade various dependencies and cull unnecessary ones.
- Also remove TSLint. Will replace with typescript-eslint rules eventually.
- Got rid of the hacky landing page static generation.

Various road bumps along the way:

- https://javascript.plainenglish.io/how-to-set-up-path-resolving-in-vite-ad284e0d9eae
- fix sass imports vitejs/vite#5764 (comment)
- Then needed to rewrite the alias for typescript again to match the types
- Replace `process`. With the `import.meta.env` thing
- https://stackoverflow.com/questions/64677212/how-to-configure-proxy-in-vite
- Fix imports for static files from `requires()`
- Had to fix proxying for `/avatar` and `/api` in dev
- Ran into remarkjs/react-markdown#339 (comment)
    - Upgrade markdown react to fix
- Migrate from `react-helmet` to fix some deprecation warnings
- Vite has a different jsx config, so no need to import React
    - microsoft/TypeScript#41882
- Vitest issue:
    - https://github.com/vitest-dev/vitest/blob/57c2367196b3fd978a04fa38ebdac7a5b6ef9b16/packages/vite-node/src/client.ts#L178-L179
- Couldn’t import react-dnd, upgraded
    - react-dnd/react-dnd#3368
- `import { isUndefined } from "util"` didn’t work
- Favicon via https://github.com/darkobits/vite-plugin-favicons to replace web pack equivalent 
- Issue with React router browser history in vitest, it exploded until jsdom was setup
- Question: https://stackoverflow.com/questions/71703933/what-is-the-difference-between-vite-and-vite-preview
- Vitest vscode integration broken :/
    - vitest-dev/vscode#44
- Tried happy-dom but it doesn’t work, lots of issues, supposed to be faster
- Took a while to get MSW in a good place, had to write some stuff so missing endpoint mocks fail the test
    - I think there's room for improvement here in terms of developer experience
    - Test with react testing library and API calls
        - https://www.npmjs.com/package/nock
            - Doesn’t fail test on unknown mock
            - https://stackoverflow.com/questions/69430232/jest-nock-how-to-fail-a-test-if-a-non-mocked-request-is-made
        - MSW
            - Doesn’t fail test on unknown mock
            - mswjs/msw#946
        - Relay’s mockEnvironment
          - couldn't easily find thorough examples
        - Apollo mock provider
            - Doesn’t fail test on unknown mock
- Added a visualize plugin similar to a web pack analyzer thing, but it’s slightly off with the numbers it gives for sizes:
    - btd/rollup-plugin-visualizer#96
- TODO:
    - ESLINT rules, replace what tslint provided, eslint-cake anyone?
        - https://typescript-eslint.io/rules/no-floating-promises/
        - And more!!!
    - Replace lodash with lodash-es
        - Or maybe: https://github.com/onebay/vite-plugin-imp
        - Although lodash-es seems cleaner
    - SSR  for landing page?
@benblazak
Copy link

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
Copy link

niktek commented Aug 11, 2022

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
Copy link

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
Copy link

ahoyahoy commented Nov 5, 2022

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

@zxch3n
Copy link
Member

zxch3n commented Feb 9, 2023

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

No branches or pull requests

9 participants