@cypress/webpack-dev-server 1.3.1 → 1.4.0

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [@cypress/webpack-dev-server-v1.4.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.3.1...@cypress/webpack-dev-server-v1.4.0) (2021-06-17)
2
+
3
+
4
+ ### Features
5
+
6
+ * **npm/webpack-dev-server,runner-ct:** Normalize webpack errors + general React/TS improvements ([#16613](https://github.com/cypress-io/cypress/issues/16613)) ([c0fc23a](https://github.com/cypress-io/cypress/commit/c0fc23a052e53354a8300dd3f783cb161ae161e1))
7
+
1
8
  # [@cypress/webpack-dev-server-v1.3.1](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.3.0...@cypress/webpack-dev-server-v1.3.1) (2021-05-26)
2
9
 
3
10
 
package/dist/plugin.d.ts CHANGED
@@ -24,6 +24,7 @@ export declare type Webpack45Compilation = Compilation & {
24
24
  };
25
25
  };
26
26
  };
27
+ export declare const normalizeError: (error: Error | string) => string;
27
28
  export default class CypressCTOptionsPlugin {
28
29
  private files;
29
30
  private supportFile;
package/dist/plugin.js CHANGED
@@ -3,11 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.normalizeError = void 0;
6
7
  const webpack_1 = __importDefault(require("webpack"));
7
8
  const lodash_1 = __importDefault(require("lodash"));
8
9
  const semver_1 = __importDefault(require("semver"));
9
10
  const fs_1 = __importDefault(require("fs"));
10
11
  const path_1 = __importDefault(require("path"));
12
+ const normalizeError = (error) => {
13
+ return typeof error === 'string' ? error : error.message;
14
+ };
15
+ exports.normalizeError = normalizeError;
11
16
  class CypressCTOptionsPlugin {
12
17
  constructor(options) {
13
18
  this.files = [];
@@ -21,11 +26,16 @@ class CypressCTOptionsPlugin {
21
26
  };
22
27
  this.setupCustomHMR = (compiler) => {
23
28
  compiler.hooks.afterCompile.tap('CypressCTOptionsPlugin', (compilation) => {
24
- var _a;
25
29
  const stats = compilation.getStats();
26
30
  if (stats.hasErrors()) {
27
31
  this.errorEmitted = true;
28
- this.devServerEvents.emit('dev-server:compile:error', (_a = stats.toJson().errors) === null || _a === void 0 ? void 0 : _a[0]);
32
+ // webpack 4: string[]
33
+ // webpack 5: Error[]
34
+ const errors = stats.toJson().errors;
35
+ if (!errors || !errors.length) {
36
+ return;
37
+ }
38
+ this.devServerEvents.emit('dev-server:compile:error', exports.normalizeError(errors[0]));
29
39
  }
30
40
  else if (this.errorEmitted) {
31
41
  // compilation succeed but assets haven't emitted to the output yet
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cypress/webpack-dev-server",
3
- "version": "1.3.1",
3
+ "version": "1.4.0",
4
4
  "description": "Launches Webpack Dev Server for Component Testing",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {