diff --git a/npm/vite-dev-server/src/index.ts b/npm/vite-dev-server/src/index.ts index f5197353b5f7..0e063347bdb2 100644 --- a/npm/vite-dev-server/src/index.ts +++ b/npm/vite-dev-server/src/index.ts @@ -15,9 +15,9 @@ export async function startDevServer (startDevServerArgs: StartDevServerOptions) const viteDevServer = await createDevServer(startDevServerArgs) const app = await viteDevServer.listen() - const port = app.config.server.port + const port = app.config.server.port! debug('Component testing vite server started on port', port) - return { port, close: app.httpServer.close } + return { port, close: app.httpServer!.close } } diff --git a/npm/vite-dev-server/src/makeCypressPlugin.ts b/npm/vite-dev-server/src/makeCypressPlugin.ts index fc177ccbc912..5b908253cabd 100644 --- a/npm/vite-dev-server/src/makeCypressPlugin.ts +++ b/npm/vite-dev-server/src/makeCypressPlugin.ts @@ -106,7 +106,7 @@ export const makeCypressPlugin = ( // as soon as we find one of the specs, we trigger the re-run of tests for (const mod of moduleImporters.values()) { debug('handleHotUpdate - mod.file', mod.file) - if (specsPathsSet.has(mod.file)) { + if (mod.file && specsPathsSet.has(mod.file)) { debug('handleHotUpdate - compile success') devServerEvents.emit('dev-server:compile:success', { specFile: mod.file }) diff --git a/npm/vite-dev-server/src/startServer.ts b/npm/vite-dev-server/src/startServer.ts index ab2468b8e854..c2b1758de31e 100644 --- a/npm/vite-dev-server/src/startServer.ts +++ b/npm/vite-dev-server/src/startServer.ts @@ -37,7 +37,7 @@ const resolveServerConfig = async ({ viteConfig, options }: StartDevServerOption const finalConfig: InlineConfig = { ...viteConfig, ...requiredOptions } - finalConfig.plugins = [...(viteConfig.plugins || []), makeCypressPlugin(projectRoot, supportFile, options.devServerEvents, options.specs)] + finalConfig.plugins = [...(finalConfig.plugins || []), makeCypressPlugin(projectRoot, supportFile, options.devServerEvents, options.specs)] // This alias is necessary to avoid a "prefixIdentifiers" issue from slots mounting // only cjs compiler-core accepts using prefixIdentifiers in slots which vue test utils use. diff --git a/npm/vite-dev-server/tsconfig.json b/npm/vite-dev-server/tsconfig.json index f63cf8e16f78..e194d3002e04 100644 --- a/npm/vite-dev-server/tsconfig.json +++ b/npm/vite-dev-server/tsconfig.json @@ -24,7 +24,7 @@ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ /* Strict Type-Checking Options */ - "strict": false /* Enable all strict type-checking options. */, + "strict": true, /* Enable all strict type-checking options. */ "noImplicitAny": false, /* Module Resolution Options */