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 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({ 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