solidjs / solid-start

SolidStart, the Solid app framework
https://start.solidjs.com
MIT License
5.19k stars 375 forks source link

Vitest close time-out #887

Closed aminya closed 10 months ago

aminya commented 1 year ago

When using the solid-start/vite plugin inside Vitest, I get this error:

close timed out after 10000ms

I tried many different configurations, but it didn't help. I wonder what is happening here.

vitest.config.test

import { defineConfig } from "vitest/config";
import config from "./vite.config";

export default defineConfig({
  ...config,
  test: {
    deps: {
      registerNodeLoader: true,
      inline: [/solid-js/],
    },
    environment: "happy-dom",
    globals: false,
    coverage: {
      provider: "c8",
    },
    setupFiles: ["./vitest.config.setup.ts"],
    transformMode: { web: [/\.[jt]sx?$/] },
  },
});

where vitest.config.setup.ts is

import "@testing-library/jest-dom";
jean343 commented 1 year ago

I am having the exact same vitest error. I also believe it's caused by the solid-start-file-system-router plugin.

I have written this little hack to skip the plugin in tests:

import node from "solid-start-node";
import solid from "solid-start/vite";
import { defineConfig } from "vite";

let solidPlugins = solid({ adapter: node(), inspect: false });
solidPlugins = solidPlugins.filter((plugin) => {
  switch (plugin.name) {
    case "solid-start-file-system-router":
      plugin.configureServer = () => undefined;
      return plugin;
    default:
      return plugin;
  }
});

export default defineConfig({
  plugins: [solidPlugins],
});
atk commented 1 year ago

Which node version are you using?

jean343 commented 1 year ago

I am using the latest LTS version at this time.

node -v
v18.16.0
RobertoVillegas commented 1 year ago

I have the same issue if I use any newer version of vitest. It works correctly with vitest ^0.26.3.

ryansolid commented 10 months ago

In setting up for SolidStarts next Beta Phase built on Nitro and Vinxi we are closing all PRs/Issues that will not be merged due to the system changing. If you feel your issue was closed by mistake. Feel free to re-open it after updating/testing against 0.4.x release. Thank you for your patience.

See https://github.com/solidjs/solid-start/pull/1139 for more details.