Skip to content
Merged
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
File renamed without changes.
22 changes: 22 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';
module.exports = {
parserOptions: {
ecmaVersion: 2017,
},
extends: ['eslint:recommended', 'plugin:node/recommended'],
plugins: ['node'],
env: {
node: true,
es6: true,
},
overrides: [
{
files: ['test/**/*-test.js'],
env: {
mocha: true,
},
extends: ['plugin:mocha/recommended'],
plugins: ['mocha'],
},
]
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
dist/
tmp/
.eslintcache
6 changes: 0 additions & 6 deletions .jshintrc

This file was deleted.

5 changes: 3 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
test
.gitignore
.jshintignore
.jshintrc
.eslintcache
.eslintignore
.eslintrc.js
.travis.yml
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "An Express middleware for rendering Ember apps with FastBoot",
"main": "src/index.js",
"scripts": {
"test": "mocha"
"lint:js": "eslint --cache .",
"test": "yarn lint:js && mocha"
},
"repository": {
"type": "git",
Expand All @@ -29,9 +30,11 @@
"chai": "^4.1.0",
"chai-as-promised": "^7.1.1",
"ember-cli": "^2.7.0",
"eslint": "^6.8.0",
"eslint-plugin-mocha": "^6.2.2",
"eslint-plugin-node": "^11.0.0",
"express": "^4.13.4",
"mocha": "^5.0.0",
"mocha-jshint": "^2.3.1",
"request-promise": "^4.2.1"
},
"dependencies": {
Expand Down
5 changes: 0 additions & 5 deletions test/.jshintrc

This file was deleted.

6 changes: 2 additions & 4 deletions test/helpers/test-http-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

const express = require('express');
const request = require('request-promise');
const fastbootMiddleware = require('./../../src/index');

let serverID = 0;

Expand All @@ -28,21 +27,20 @@ class TestHTTPServer {
}

if (options.recoverErrors) {
app.use((err, req, res, next) => {
app.use((err, req, res, next) => { // eslint-disable-line no-unused-vars
res.set('x-test-recovery', 'recovered response');
res.status(200);
res.send('hello world');
});
}

return new Promise((resolve, reject) => {
return new Promise((resolve) => {
let port = options.port || 3000;
let host = options.host || 'localhost';

let listener = app.listen(port, host, () => {
let host = listener.address().address;
let port = listener.address().port;
let family = listener.address().family;

this.listener = listener;
this.info = {
Expand Down
1 change: 0 additions & 1 deletion test/jshint-test.js

This file was deleted.

9 changes: 5 additions & 4 deletions test/middleware-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

const expect = require('chai').expect;
const path = require('path');
const FastBoot = require('fastboot');
const fastbootMiddleware = require('./../src/index');
const fixture = require('./helpers/fixture-path');
Expand Down Expand Up @@ -85,7 +84,7 @@ describe("FastBoot", function() {
.then(hotReloadApp)
.then(requestSecondApp);

function requestFirstApp(info) {
function requestFirstApp() {
return server.request('/')
.then(function(html) {
expect(html).to.match(/Welcome to Ember/);
Expand All @@ -98,14 +97,15 @@ describe("FastBoot", function() {
});
}

function requestSecondApp(info) {
function requestSecondApp() {
return server.request('/')
.then(function(html) {
expect(html).to.match(/Goodbye from Ember/);
});
}
});

/* eslint-disable mocha/no-setup-in-describe */
[true, false].forEach((chunkedResponse) => {
describe(`when chunked response is ${chunkedResponse ? 'enabled' : 'disabled'}`, function() {
if (chunkedResponse) {
Expand All @@ -118,7 +118,7 @@ describe("FastBoot", function() {

return server.start()
.then(() => server.request('/', { resolveWithFullResponse: true }))
.then(({ body, _, headers }) => {
.then(({ body, headers }) => {
expect(headers['transfer-encoding']).to.eq('chunked');
expect(body).to.match(/Welcome to Ember/);
});
Expand Down Expand Up @@ -258,4 +258,5 @@ describe("FastBoot", function() {
});
});
});
/* eslint-enable mocha/no-setup-in-describe */
});
Loading