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

server.https setting breaks functionality #157

Closed
skiadas opened this issue May 8, 2023 · 3 comments
Closed

server.https setting breaks functionality #157

skiadas opened this issue May 8, 2023 · 3 comments
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@skiadas
Copy link

skiadas commented May 8, 2023

Describe the bug
If a setting of server: { https: true } is present in vite.config.js the extension loops infinitely and doesn't execute the tests.

To Reproduce
Steps to reproduce the behavior on the example project:

  1. Add server: { https: true } to the vite.config.js settings
  2. Click on the 'Vitest' button in the bottom toolbar to run the test

Expected behavior
Ideally the tests should have been run. But instead I am getting the following output until I interrupt:

[INFO 5:48:35 PM] WS Close
[INFO 5:48:36 PM] RECONNECT
.... repeating

In my actual live project, am using vite-plugi-mkcert to generate some certificates. But the same behavior is present in that project.

I suppose the question is:

  1. Can the extension/testing somehow be run in https?
  2. Alternatively, how can I tell vite to only apply the server setting when it runs on dev mode, and not in the tests?

Environment

{
  "System": {
    "OS": "macOS 12.5.1"
  },
  "Binaries": {
    "Node": {
      "version": "18.3.0",
      "path": "/usr/local/bin/node"
    },
    "Yarn": {
      "version": "1.22.15",
      "path": "/usr/local/bin/yarn"
    },
    "npm": {
      "version": "8.11.0",
      "path": "/usr/local/bin/npm"
    }
  },
  "IDEs": {
    "VSCode": {
      "version": "1.78.0",
      "path": "/usr/local/bin/code"
    }
  },
  "npmPackages": {
    "vite": {
      "installed": "2.9.15",
      "wanted": "^2.9.9"
    },
    "vitest": {
      "installed": "0.12.10",
      "wanted": "^0.12.6"
    }
  }
}
@skiadas skiadas added the p3-minor-bug An edge case that only affects very specific usage (priority) label May 8, 2023
@skiadas
Copy link
Author

skiadas commented May 9, 2023

Answering my second question and as a workaround, following the vitest docs we can conditionally check if we are in vitest mode by checking for process.env.VITEST == 'test' || process.env.VITEST == 'benchmark'.

But I feel there is room for improvement here. Since npx vitest runs fine with the https: true setting, it falls on the VSCode extension to either account for/allow the setting, or provide a better error message, rather than simply infinitely looping.

@RodrigoRoaRodriguez
Copy link

RodrigoRoaRodriguez commented Jun 20, 2023

I have now verified that adding server: { https: true } does break reporting of test results to the extension. Furthermore, I have discovered that other server settings also break this extension, like for example server: { port: 3000 }. So it appears this extension does not currently support any projects with server settings.

@MilanKovacic
Copy link
Collaborator

We are tracking this issue in #226.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 10, 2024
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

3 participants