Skip to content
Permalink
Browse files

build: eslint@4.19.1

  • Loading branch information...
dougwilson committed May 8, 2019
1 parent 683fcbe commit 421f96c60e069ab32efe4745844f54e2918fdb13
Showing with 113 additions and 97 deletions.
  1. +18 −2 .travis.yml
  2. +1 −1 package.json
  3. +5 −5 test/app.listen.js
  4. +12 −12 test/fqdn.js
  5. +43 −43 test/mounting.js
  6. +34 −34 test/server.js
@@ -24,6 +24,17 @@ before_install:
function node_version_lt () {
[[ "$(v "$TRAVIS_NODE_VERSION")" -lt "$(v "${1}")" ]]
}
function npm_remove_module_re () {
node -e '
fs = require("fs");
p = JSON.parse(fs.readFileSync("package.json", "utf8"));
r = RegExp(process.argv[1]);
for (k in p.devDependencies) {
if (r.test(k)) delete p.devDependencies[k];
}
fs.writeFileSync("package.json", JSON.stringify(p, null, 2) + "\n");
' "$@"
}
function npm_use_module () {
node -e '
fs = require("fs");
@@ -42,6 +53,10 @@ before_install:
# Skip updating shrinkwrap / lock
npm config set shrinkwrap false
# Setup Node.js version-specific dependencies
- |
# Configure eslint for linting
if node_version_lt '4.0'; then npm_remove_module_re '^eslint(-|$)'
fi
- |
# Configure mocha for testing
if node_version_lt '4.0'; then npm_use_module 'mocha' '3.5.3'
@@ -73,8 +88,9 @@ script:
# Run test script
npm run-script test-travis
- |
# Run linting
npm run-script lint
# Run linting, depending on eslint install
if npm_module_installed 'eslint'; then npm run-script lint
fi
after_script:
- |
# Upload coverage to coveralls
@@ -23,7 +23,7 @@
"utils-merge": "1.0.1"
},
"devDependencies": {
"eslint": "2.13.1",
"eslint": "4.19.1",
"mocha": "6.1.4",
"nyc": "14.1.0",
"supertest": "4.0.2"
@@ -14,12 +14,12 @@ describe('app.listen()', function(){
var server = app.listen(0, function () {
assert.ok(server)
request(server)
.get('/')
.expect(200, function (err) {
server.close(function () {
done(err)
.get('/')
.expect(200, function (err) {
server.close(function () {
done(err)
})
})
})
});
});
});
@@ -17,8 +17,8 @@ describe('app.use()', function(){
});

rawrequest(app)
.get('http://example.com/foo')
.expect(200, 'http://example.com/foo', done);
.get('http://example.com/foo')
.expect(200, 'http://example.com/foo', done)
});

describe('with a connect app', function(){
@@ -28,8 +28,8 @@ describe('app.use()', function(){
});

rawrequest(app)
.get('/proxy?url=http://example.com/blog/post/1')
.expect(200, '/?url=http://example.com/blog/post/1', done);
.get('/proxy?url=http://example.com/blog/post/1')
.expect(200, '/?url=http://example.com/blog/post/1', done)
});

it('should ignore FQDN in path', function (done) {
@@ -38,8 +38,8 @@ describe('app.use()', function(){
});

rawrequest(app)
.get('/proxy/http://example.com/blog/post/1')
.expect(200, '/http://example.com/blog/post/1', done);
.get('/proxy/http://example.com/blog/post/1')
.expect(200, '/http://example.com/blog/post/1', done)
});

it('should adjust FQDN req.url', function(done){
@@ -48,8 +48,8 @@ describe('app.use()', function(){
});

rawrequest(app)
.get('http://example.com/blog/post/1')
.expect(200, 'http://example.com/post/1', done);
.get('http://example.com/blog/post/1')
.expect(200, 'http://example.com/post/1', done)
});

it('should adjust FQDN req.url with multiple handlers', function(done){
@@ -62,8 +62,8 @@ describe('app.use()', function(){
});

rawrequest(app)
.get('http://example.com/blog/post/1')
.expect(200, 'http://example.com/post/1', done);
.get('http://example.com/blog/post/1')
.expect(200, 'http://example.com/post/1', done)
});

it('should adjust FQDN req.url with multiple routed handlers', function(done) {
@@ -75,8 +75,8 @@ describe('app.use()', function(){
});

rawrequest(app)
.get('http://example.com/blog/post/1')
.expect(200, 'http://example.com/post/1', done);
.get('http://example.com/blog/post/1')
.expect(200, 'http://example.com/post/1', done)
});
});
});
@@ -17,8 +17,8 @@ describe('app.use()', function(){
});

request(app)
.get('/blog')
.expect(200, '/blog', done);
.get('/blog')
.expect(200, '/blog', done)
});

it('should match full path', function (done) {
@@ -27,8 +27,8 @@ describe('app.use()', function(){
});

request(app)
.get('/blog')
.expect(200, '/', done);
.get('/blog')
.expect(200, '/', done)
});

it('should match left-side of path', function (done) {
@@ -37,8 +37,8 @@ describe('app.use()', function(){
});

request(app)
.get('/blog/article/1')
.expect(200, '/article/1', done);
.get('/blog/article/1')
.expect(200, '/article/1', done)
});

it('should match up to dot', function (done) {
@@ -47,8 +47,8 @@ describe('app.use()', function(){
})

request(app)
.get('/blog.json')
.expect(200, done)
.get('/blog.json')
.expect(200, done)
})

it('should not match shorter path', function (done) {
@@ -57,8 +57,8 @@ describe('app.use()', function(){
});

request(app)
.get('/blog')
.expect(404, done);
.get('/blog')
.expect(404, done)
});

it('should not end match in middle of component', function (done) {
@@ -67,8 +67,8 @@ describe('app.use()', function(){
});

request(app)
.get('/blog-o-rama/article/1')
.expect(404, done);
.get('/blog-o-rama/article/1')
.expect(404, done)
});

it('should be case insensitive (lower-case route, mixed-case request)', function(done){
@@ -80,8 +80,8 @@ describe('app.use()', function(){
app.use('/blog', blog);

request(app)
.get('/BLog')
.expect('blog', done);
.get('/BLog')
.expect('blog', done)
});

it('should be case insensitive (mixed-case route, lower-case request)', function(done){
@@ -93,8 +93,8 @@ describe('app.use()', function(){
app.use('/BLog', blog);

request(app)
.get('/blog')
.expect('blog', done);
.get('/blog')
.expect('blog', done)
});

it('should be case insensitive (mixed-case route, mixed-case request)', function(done){
@@ -106,8 +106,8 @@ describe('app.use()', function(){
app.use('/BLog', blog);

request(app)
.get('/blOG')
.expect('blog', done);
.get('/blOG')
.expect('blog', done)
});

it('should ignore fn.arity > 4', function(done){
@@ -127,8 +127,8 @@ describe('app.use()', function(){
});

request(app)
.get('/')
.expect(200, '1,2', done);
.get('/')
.expect(200, '1,2', done)
});

describe('with a connect app', function(){
@@ -143,8 +143,8 @@ describe('app.use()', function(){
app.use('/blog', blog);

request(app)
.get('/blog')
.expect(200, 'blog', done);
.get('/blog')
.expect(200, 'blog', done)
});

it('should retain req.originalUrl', function(done){
@@ -155,8 +155,8 @@ describe('app.use()', function(){
});

request(app)
.get('/blog/post/1')
.expect(200, '/blog/post/1', done);
.get('/blog/post/1')
.expect(200, '/blog/post/1', done)
});

it('should adjust req.url', function(done){
@@ -165,8 +165,8 @@ describe('app.use()', function(){
});

request(app)
.get('/blog/post/1')
.expect(200, '/post/1', done);
.get('/blog/post/1')
.expect(200, '/post/1', done)
});

it('should strip trailing slash', function(done){
@@ -180,8 +180,8 @@ describe('app.use()', function(){
app.use('/blog/', blog);

request(app)
.get('/blog')
.expect('blog', done);
.get('/blog')
.expect('blog', done)
});

it('should set .route', function(){
@@ -204,8 +204,8 @@ describe('app.use()', function(){
});

request(app)
.get('/admin')
.expect('/admin', done);
.get('/admin')
.expect('/admin', done)
})
})

@@ -219,8 +219,8 @@ describe('app.use()', function(){
app.use('/blog', blog);

request(app)
.get('/blog')
.expect('blog', done);
.get('/blog')
.expect('blog', done)
});
});

@@ -234,8 +234,8 @@ describe('app.use()', function(){
});

request(app)
.get('/')
.expect('got error msg', done);
.get('/')
.expect('got error msg', done)
})

it('should skip to non-error middleware', function(done){
@@ -253,8 +253,8 @@ describe('app.use()', function(){
});

request(app)
.get('/')
.expect(200, 'msg', done);
.get('/')
.expect(200, 'msg', done)
})

it('should start at error middleware declared after error', function(done){
@@ -271,8 +271,8 @@ describe('app.use()', function(){
});

request(app)
.get('/')
.expect(200, 'pass: boom!', done);
.get('/')
.expect(200, 'pass: boom!', done)
})

it('should stack error fns', function(done){
@@ -288,9 +288,9 @@ describe('app.use()', function(){
});

request(app)
.get('/')
.expect('X-Error', 'msg')
.expect(200, 'got error msg', done);
.get('/')
.expect('X-Error', 'msg')
.expect(200, 'got error msg', done)
})

it('should invoke error stack even when headers sent', function(done){
@@ -303,8 +303,8 @@ describe('app.use()', function(){
});

request(app)
.get('/')
.end(function(){});
.get('/')
.end(function () {})
})
})
});

0 comments on commit 421f96c

Please sign in to comment.
You can’t perform that action at this time.