From fcf85c270ec83a72597ab43ffc8d74a72ee267b6 Mon Sep 17 00:00:00 2001 From: Yuta Hiroto Date: Wed, 5 Jun 2019 16:30:59 +0200 Subject: [PATCH] fix(server): change clientLogLevel order to be called first --- lib/Server.js | 9 +++++---- test/e2e/ClientOptions.test.js | 6 ++++++ test/e2e/__snapshots__/ClientOptions.test.js.snap | 6 ++++++ .../contentbase-config/public/node_modules/index.html | 2 +- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/lib/Server.js b/lib/Server.js index e086fa7956..1c58eaea43 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -694,10 +694,15 @@ class Server { } }); + if (this.clientLogLevel) { + this.sockWrite([connection], 'log-level', this.clientLogLevel); + } + if (this.hot) { this.sockWrite([connection], 'hot'); } + // TODO: change condition at major version if (this.options.liveReload !== false) { this.sockWrite([connection], 'liveReload', this.options.liveReload); } @@ -710,10 +715,6 @@ class Server { this.sockWrite([connection], 'overlay', this.clientOverlay); } - if (this.clientLogLevel) { - this.sockWrite([connection], 'log-level', this.clientLogLevel); - } - if (!this._stats) { return; } diff --git a/test/e2e/ClientOptions.test.js b/test/e2e/ClientOptions.test.js index 11fb7f1ff8..2e643c516f 100644 --- a/test/e2e/ClientOptions.test.js +++ b/test/e2e/ClientOptions.test.js @@ -250,6 +250,12 @@ describe('Client console.log', () => { liveReload: true, }, }, + { + title: 'clientLogLevel is silent', + options: { + clientLogLevel: 'silent', + }, + }, ]; for (const { title, options } of cases) { diff --git a/test/e2e/__snapshots__/ClientOptions.test.js.snap b/test/e2e/__snapshots__/ClientOptions.test.js.snap index 92ec069c30..e8778380ae 100644 --- a/test/e2e/__snapshots__/ClientOptions.test.js.snap +++ b/test/e2e/__snapshots__/ClientOptions.test.js.snap @@ -1,5 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`Client console.log clientLogLevel is silent 1`] = ` +Array [ + "Hey.", +] +`; + exports[`Client console.log hot disabled 1`] = ` Array [ "Hey.", diff --git a/test/fixtures/contentbase-config/public/node_modules/index.html b/test/fixtures/contentbase-config/public/node_modules/index.html index d4a679602e..46492fe367 100644 --- a/test/fixtures/contentbase-config/public/node_modules/index.html +++ b/test/fixtures/contentbase-config/public/node_modules/index.html @@ -1 +1 @@ -0.240478319203405 \ No newline at end of file +0.6318915499614974 \ No newline at end of file