@cypress/vite-dev-server
Advanced tools
Comparing version 2.0.6 to 2.0.7
@@ -0,1 +1,8 @@ | ||
# [@cypress/vite-dev-server-v2.0.7](https://github.com/cypress-io/cypress/compare/@cypress/vite-dev-server-v2.0.6...@cypress/vite-dev-server-v2.0.7) (2021-08-12) | ||
### Bug Fixes | ||
* **vite-dev-server:** chain update all specs when changing child ([#17693](https://github.com/cypress-io/cypress/issues/17693)) ([66e8896](https://github.com/cypress-io/cypress/commit/66e8896b66207e9ce2d1a5dd9f66f73fe58a1e7e)), closes [#17691](https://github.com/cypress-io/cypress/issues/17691) | ||
# [@cypress/vite-dev-server-v2.0.6](https://github.com/cypress-io/cypress/compare/@cypress/vite-dev-server-v2.0.5...@cypress/vite-dev-server-v2.0.6) (2021-08-10) | ||
@@ -2,0 +9,0 @@ |
@@ -0,1 +1,2 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="cypress" /> | ||
@@ -7,3 +8,3 @@ import { Plugin } from 'vite'; | ||
} | ||
export declare const makeCypressPlugin: (projectRoot: string, supportFilePath: string, devServerEvents: EventEmitter, specs: Spec[]) => Plugin; | ||
export declare const makeCypressPlugin: (projectRoot: string, supportFilePath: string | false, devServerEvents: NodeJS.EventEmitter, specs: Spec[]) => Plugin; | ||
export {}; |
@@ -72,4 +72,5 @@ "use strict"; | ||
let iterationNumber = 0; | ||
const exploredFiles = new Set(); | ||
// until we reached a point where the current module is imported by no other | ||
while (moduleImporters && moduleImporters.size) { | ||
while (moduleImporters?.size) { | ||
if (iterationNumber > HMR_DEPENDENCY_LOOKUP_MAX_ITERATION) { | ||
@@ -85,2 +86,4 @@ debug(`max hmr iteration reached: ${HMR_DEPENDENCY_LOOKUP_MAX_ITERATION}; Rerun will not happen on this file change.`); | ||
devServerEvents.emit('dev-server:compile:success'); | ||
// if we update support we know we have to re-run it all | ||
// no need to ckeck further | ||
return []; | ||
@@ -91,7 +94,13 @@ } | ||
devServerEvents.emit('dev-server:compile:success', { specFile: mod.file }); | ||
return []; | ||
// if we find one spec, does not mean we are done yet, | ||
// there could be other spec files to re-run | ||
// see https://github.com/cypress-io/cypress/issues/17691 | ||
} | ||
// to avoid circular updates, keep track of what we updated | ||
if (mod.file) { | ||
exploredFiles.add(mod.file); | ||
} | ||
} | ||
// get all the modules that import the current one | ||
moduleImporters = getImporters(moduleImporters); | ||
moduleImporters = getImporters(moduleImporters, exploredFiles); | ||
iterationNumber += 1; | ||
@@ -104,8 +113,10 @@ } | ||
exports.makeCypressPlugin = makeCypressPlugin; | ||
function getImporters(modules) { | ||
function getImporters(modules, alreadyExploredFiles) { | ||
const allImporters = new Set(); | ||
modules.forEach((m) => { | ||
m.importers.forEach((imp) => allImporters.add(imp)); | ||
if (m.file && !alreadyExploredFiles.has(m.file)) { | ||
m.importers.forEach((imp) => allImporters.add(imp)); | ||
} | ||
}); | ||
return allImporters; | ||
} |
/// <reference types="cypress" /> | ||
import { ViteDevServer, UserConfig } from 'vite'; | ||
interface Options { | ||
specs: Cypress.Cypress['spec'][]; | ||
config: Record<string, string>; | ||
devServerEvents: EventEmitter; | ||
[key: string]: unknown; | ||
} | ||
export interface StartDevServerOptions { | ||
@@ -13,3 +7,3 @@ /** | ||
*/ | ||
options: Options; | ||
options: Cypress.DevServerOptions; | ||
/** | ||
@@ -24,2 +18,1 @@ * By default, vite will use your vite.config file to | ||
export declare function start(devServerOptions: StartDevServerOptions): Promise<ViteDevServer>; | ||
export {}; |
{ | ||
"name": "@cypress/vite-dev-server", | ||
"version": "2.0.6", | ||
"version": "2.0.7", | ||
"description": "Launches Vite Dev Server for Component Testing", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27677
260