@cypress/webpack-dev-server 6.1.0 → 6.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,17 +39,24 @@ class CypressCTWebpackPlugin {
39
39
  callback();
40
40
  return;
41
41
  }
42
- // Ensure we don't try to load files that have been removed from the file system
43
- // but have not yet been detected by the onSpecsChange handler
44
- const foundFiles = (await Promise.all(this.files.map(async (file) => {
45
- try {
46
- const exists = await fs_extra_1.default.pathExists(file.absolute);
47
- return exists ? file : null;
48
- }
49
- catch (e) {
50
- return null;
51
- }
52
- })));
42
+ let files;
43
+ let foundFiles;
44
+ // onSpecsChange can replace the list while the checks are pending. Checking again until
45
+ // the list holds still means this compile builds the newest list, filtered.
46
+ do {
47
+ files = this.files;
48
+ // Ensure we don't try to load files that have been removed from the file system
49
+ // but have not yet been detected by the onSpecsChange handler
50
+ foundFiles = await Promise.all(files.map(async (file) => {
51
+ try {
52
+ const exists = await fs_extra_1.default.pathExists(file.absolute);
53
+ return exists ? file : null;
54
+ }
55
+ catch (e) {
56
+ return null;
57
+ }
58
+ }));
59
+ } while (this.files !== files);
53
60
  this.files = foundFiles.filter((file) => file !== null);
54
61
  callback();
55
62
  };
package/dist/devServer.js CHANGED
@@ -17,26 +17,23 @@ const debug = (0, debug_1.default)('cypress:webpack-dev-server:devServer');
17
17
  *
18
18
  * @param config
19
19
  */
20
- function devServer(devServerConfig) {
21
- return new Promise(async (resolve, reject) => {
22
- const result = await devServer.create(devServerConfig);
23
- result.server.start().then(() => {
24
- if (!result.server.options.port) {
25
- return reject(new Error(`Expected port ${result.server.options.port} to be a number`));
26
- }
27
- debug(`Component testing webpack server ${result.version} started on port %s`, result.server.options.port);
28
- resolve({
29
- port: result.server.options.port,
30
- // Close is for unit testing only. We kill this child process which will handle the closing of the server
31
- close: async (done) => {
32
- debug('closing dev server');
33
- result.server.stop().then(() => done?.()).catch(done).finally(() => {
34
- debug('closed dev server');
35
- });
36
- },
20
+ async function devServer(devServerConfig) {
21
+ const result = await devServer.create(devServerConfig);
22
+ await result.server.start();
23
+ if (!result.server.options.port) {
24
+ throw new Error(`Expected port ${result.server.options.port} to be a number`);
25
+ }
26
+ debug(`Component testing webpack server ${result.version} started on port %s`, result.server.options.port);
27
+ return {
28
+ port: result.server.options.port,
29
+ // Close is for unit testing only. We kill this child process which will handle the closing of the server
30
+ close: async (done) => {
31
+ debug('closing dev server');
32
+ result.server.stop().then(() => done?.()).catch(done).finally(() => {
33
+ debug('closed dev server');
37
34
  });
38
- }).catch(reject);
39
- });
35
+ },
36
+ };
40
37
  }
41
38
  exports.devServer = devServer;
42
39
  const thirdPartyDefinitionPrefixes = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cypress/webpack-dev-server",
3
- "version": "6.1.0",
3
+ "version": "6.1.2",
4
4
  "description": "Launches Webpack Dev Server for Component Testing",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -45,7 +45,7 @@
45
45
  "license": "MIT",
46
46
  "repository": {
47
47
  "type": "git",
48
- "url": "https://github.com/cypress-io/cypress.git"
48
+ "url": "git+https://github.com/cypress-io/cypress.git"
49
49
  },
50
50
  "homepage": "https://github.com/cypress-io/cypress/tree/develop/npm/webpack-dev-server#readme",
51
51
  "bugs": "https://github.com/cypress-io/cypress/issues/new?template=1-bug-report.md",