Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
language: node_js
node_js:
- "4"
- "stable"
- "6"
- "8"
- "10"

env:
- CXX=g++-4.8 WORKER_COUNT=2
Expand Down
2 changes: 2 additions & 0 deletions src/fastboot-app-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -48,6 +49,7 @@ class FastBootAppServer {
afterMiddleware: this.afterMiddleware,
sandboxGlobals: this.sandboxGlobals,
chunkedResponse: this.chunkedResponse,
resilient: this.resilient,
});

this.worker.start();
Expand Down
2 changes: 2 additions & 0 deletions src/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -74,6 +75,7 @@ class Worker {
this.fastboot = new FastBoot({
distPath: this.distPath,
sandboxGlobals: this.sandboxGlobals,
resilient: this.resilient,
});

return fastbootMiddleware({
Expand Down
5 changes: 4 additions & 1 deletion test/app-server-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
Expand All @@ -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');
});
});
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/broken-app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

</head>
<body>
Original body
<!-- EMBER_CLI_FASTBOOT_BODY -->

<script src="assets/vendor.js"></script>
Expand Down