From 8ba8279eb1e987a820281d3aa805f5829bad2ec8 Mon Sep 17 00:00:00 2001 From: Nico Castro Date: Wed, 23 Jan 2019 17:29:58 -0500 Subject: [PATCH 1/3] Add options to enable resilient mode --- src/fastboot-app-server.js | 2 ++ src/worker.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/fastboot-app-server.js b/src/fastboot-app-server.js index fa1340ed..34c3dd6b 100644 --- a/src/fastboot-app-server.js +++ b/src/fastboot-app-server.js @@ -25,6 +25,7 @@ class FastBootAppServer { this.afterMiddleware = options.afterMiddleware; this.sandboxGlobals = options.sandboxGlobals; this.chunkedResponse = options.chunkedResponse; + this.resilient = options.resilient; if (!this.ui) { let UI = require('./ui'); @@ -48,6 +49,7 @@ class FastBootAppServer { afterMiddleware: this.afterMiddleware, sandboxGlobals: this.sandboxGlobals, chunkedResponse: this.chunkedResponse, + resilient: this.resilient, }); this.worker.start(); diff --git a/src/worker.js b/src/worker.js index 72f83151..e500a79f 100644 --- a/src/worker.js +++ b/src/worker.js @@ -19,6 +19,7 @@ class Worker { this.afterMiddleware = options.afterMiddleware; this.sandboxGlobals = options.sandboxGlobals; this.chunkedResponse = options.chunkedResponse; + this.resilient = options.resilient; if (!this.httpServer) { this.httpServer = new ExpressHTTPServer({ @@ -74,6 +75,7 @@ class Worker { this.fastboot = new FastBoot({ distPath: this.distPath, sandboxGlobals: this.sandboxGlobals, + resilient: this.resilient, }); return fastbootMiddleware({ From a703cb9e96a6b4fef9ba7f8ea52bc1df1fb97a37 Mon Sep 17 00:00:00 2001 From: Nico Castro Date: Thu, 24 Jan 2019 16:17:23 -0500 Subject: [PATCH 2/3] This should fix the failing travis tests by removing Node v4 as a supported version --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c836233f..c88dfb20 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,9 @@ language: node_js node_js: - - "4" + - "stable" - "6" + - "8" + - "10" env: - CXX=g++-4.8 WORKER_COUNT=2 From 88bd47fa7a487c84b72a8c2a7e8cccbde316ed2c Mon Sep 17 00:00:00 2001 From: Steve Hull <50039+sdhull@users.noreply.github.com> Date: Tue, 9 Jul 2019 18:22:37 -0700 Subject: [PATCH 3/3] Fixing the test around resilient mode to *actually test* resilient mode --- test/app-server-test.js | 5 ++++- test/fixtures/broken-app/index.html | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/app-server-test.js b/test/app-server-test.js index 2e3edc9d..9379aab2 100644 --- a/test/app-server-test.js +++ b/test/app-server-test.js @@ -79,11 +79,13 @@ describe("FastBootAppServer", function() { }); }); - it("executes afterMiddleware when there is an error", function() { + it("works with resilient mode, as long as there is an afterMiddleware that calls next()", function() { return runServer('after-middleware-server') .then(() => request('http://localhost:3000')) .then(response => { expect(response.body).to.not.match(/error/); + expect(response.body).to.contain('FastbootTest'); + expect(response.body).to.contain('Original body'); expect(response.headers['x-test-header']).to.equal('testing'); }); }); @@ -107,6 +109,7 @@ describe("FastBootAppServer", function() { .then(() => request('http://127.0.0.1:4100/')) .then((response) => { expect(response.statusCode).to.equal(200); + expect(response.body).to.contain('FastbootTest'); expect(response.body).to.contain('Welcome to Ember'); }); }); diff --git a/test/fixtures/broken-app/index.html b/test/fixtures/broken-app/index.html index c9a0d7ec..7f28598d 100644 --- a/test/fixtures/broken-app/index.html +++ b/test/fixtures/broken-app/index.html @@ -16,6 +16,7 @@ + Original body