1
0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-11-08 23:25:51 +01:00

set up some linting (obvious errors only)

This commit is contained in:
Alex Kocharin 2015-03-28 21:25:53 +03:00
parent 2ee12c7293
commit 9047e28074
31 changed files with 111 additions and 361 deletions

@ -1,275 +0,0 @@
env:
node: true
#
# 0 - disable
# Rules that more harmful than useful, or just buggy.
#
# 1 - warning
# Rules that we didn't encounter yet. You can safely ignore them,
# but I'd like to know any interesting use-cases they forbid.
#
# 2 - error
# Rules that have proven to be useful, please follow them.
#
rules:
# didn't understand what it does, but it fails a good code
block-scoped-var: 0
# fails where newlines are used to format pretty big "if":
# if (
# name.charAt(0) === "." ||
# name.match(/[\/@\s\+%:]/) ||
# name !== encodeURIComponent(name) ||
# name.toLowerCase() === "node_modules"
# ) {
brace-style: 1
# snake_case is more readable, what's up with you guys?
camelcase: 0
# if some functions are complex, they are for a good reason,
# ain't worth it
complexity: [0, 10]
# never saw it, but self is preferred
consistent-this: [1, self]
# fails good code
curly: [0, multi]
# fails good code, where this notation is used for consistency:
# something['foo-bar'] = 123
# something['blahblah'] = 234
dot-notation: 0
# pointless in many cases (like indexOf() == -1), harmful in a few
# cases (when you do want to ignore types), fails good code
eqeqeq: 0
# if someone is changing prototype and makes properties enumerable,
# it's their own fault
guard-for-in: 0
# if some functions are complex, they are for a good reason,
# ain't worth it
max-depth: [0, 4]
max-nested-callbacks: [0, 2]
# should it really throw for every long URL?
max-len: [0, 80, 4]
# that's obvious by just looking at the code, you don't need lint for that
max-params: [0, 3]
# if some functions are complex, they are for a good reason,
# ain't worth it
max-statements: [0, 10]
# that one makes sense
new-cap: 2
# I'm writing javascript, not some weird reduced version of it
no-bitwise: 0
# not working around IE bugs, sorry
no-catch-shadow: 0
# see above, IE is useful for downloading other browsers only
no-comma-dangle: 0
# good for removing debugging code
no-console: 2
# good for removing debugging code
no-debugger: 2
# why would anyone need to check against that?
no-else-return: 0
# sometimes empty statement contains useful comment
no-empty: 0
# stupid rule
# "x == null" is "x === null || x === undefined"
no-eq-null: 0
# fails good code, when parens are used for grouping:
# (req && req.headers['via']) ? req.headers['via'] + ', ' : ''
# not everyone remembers priority tables, you know
no-extra-parens: 0
# fails defensive semicolons:
# ;['foo', 'bar'].forEach(function(x) {})
no-extra-semi: 0
# fails good code:
# var fs = require('fs'),
# , open = fs.open
no-mixed-requires: [0, false]
# new Array(12) is used to pre-allocate arrays
no-new-array: 0
# fails good code:
# fs.open('/file', 0666, function(){})
no-octal: 0
# fails good code:
# console.log('\033[31m' + str + '\033[39m')
# also fails \0 which is not octal escape
no-octal-escape: 0
# I'm writing javascript, not some weird reduced version of it
no-plusplus: 0
# fails good code:
# if (a) {
# var x = 'foo'
# } else {
# var x = bar
# }
no-redeclare: 0
# sometimes useful, often isn't
# probably worth enforcing
no-shadow: 2
no-sync: 2
# I'm writing javascript, not some weird reduced version of it
no-ternary: 0
# the single most important rule in the entire ruleset
no-undef: 2
# it is failing our own underscores
no-underscore-dangle: 0
# fails function hoisting
no-unreachable: 0
# fails npm-style code, it's good once you get used to it:
# if (typeof(options) === 'function') callback = options, options = {}
no-unused-expressions: 0
# fails (function(_err) {}) where named argument is used to show what
# nth function argument means
no-unused-vars: [0, local]
# fails function hoisting
no-use-before-define: 0
# fails foobar( (function(){}).bind(this) )
# parens are added for readability
no-wrap-func: 0
# fails good code:
# var x
# if (something) {
# var y
one-var: 0
quote-props: 0
# fails situation when different quotes are used to avoid escaping
quotes: [2, single, avoid-escape]
# http:#blog.izs.me/post/2353458699/an-open-letter-to-javascript-leaders-regarding
semi: [2, never]
# fails good code where spaces are used for grouping:
# (x+y * y+z)
space-infix-ops: 0
# typeof(something) should have braces to look like a function
# a matter of taste I suppose
space-unary-word-ops: 0
# strict mode is just harmful,
# can I have a check to enforce not using it?
strict: 0
sort-vars: 0
no-path-concat: 0
func-names: 0
# how can you set a return code without process.exit?
no-process-exit: 0
# both styles are useful
func-style: [0, declaration]
# fails while(1) {...}
no-constant-condition: 0
# fails good code:
# https://github.com/rlidwka/jju/blob/eb52ee72e5f21d48963798f9bda8ac8d68082148/lib/parse.js#L732
no-ex-assign: 0
wrap-iife: [2, inside]
# doesn't always make sense
consistent-return: 0
no-sequences: 0
# fails defensive semicolons
no-space-before-semi: 0
new-parens: 1
no-alert: 1
no-array-constructor: 1
no-caller: 1
no-cond-assign: 1
no-control-regex: 1
no-delete-var: 1
no-div-regex: 1
no-dupe-keys: 1
no-empty-class: 1
no-empty-label: 1
no-eval: 1
no-extend-native: 1
no-extra-boolean-cast: 1
no-extra-strict: 1
no-fallthrough: 1
no-floating-decimal: 1
no-func-assign: 1
no-global-strict: 1
no-implied-eval: 1
no-invalid-regexp: 1
no-iterator: 1
no-labels: 1
no-label-var: 1
no-lone-blocks: 1
no-loop-func: 1
no-multi-str: 1
no-native-reassign: 1
no-negated-in-lhs: 1
no-nested-ternary: 1
no-new: 1
no-new-func: 1
no-new-object: 1
no-new-wrappers: 1
no-obj-calls: 1
no-octal: 1
no-proto: 1
no-regex-spaces: 1
no-return-assign: 1
no-script-url: 1
no-self-compare: 1
no-shadow: 1
no-shadow-restricted-names: 1
no-spaced-func: 1
no-sparse-arrays: 1
no-sync: 1
no-undef: 1
no-undef-init: 1
no-unreachable: 1
no-with: 1
no-yoda: 1
radix: 1
space-return-throw-case: 1
use-isnan: 1
valid-jsdoc: 1
wrap-regex: 1

2
.eslintignore Normal file

@ -0,0 +1,2 @@
node_modules
lib/static

44
.eslintrc Normal file

@ -0,0 +1,44 @@
# vim: syntax=yaml
#
# List of very light restrictions designed to prevent obvious errors,
# not impose our own code style upon other contributors.
#
# This is supposed to be used with `eslint --reset`
#
# Created to work with eslint@0.18.0
#
env:
node: true
rules:
# useful to have in node.js,
# if you're sure you don't need to handle error, rename it to "_err"
handle-callback-err: 2
# just to make sure we don't forget to remove them when releasing
no-debugger: 2
# add "falls through" for those
no-fallthrough: 2
# just warnings about whitespace weirdness here
eol-last: 1
no-irregular-whitespace: 1
no-mixed-spaces-and-tabs: [1, smart-tabs]
no-trailing-spaces: 1
# probably always an error, tell me if it's not
no-new-require: 2
# single most important rule here, without it linting won't even
# make any sense
no-undef: 2
# in practice, those are always errors
no-unreachable: 2
# useful for code clean-up
no-unused-vars: [1, {"vars": "all", "args": "none"}]

8
lib/GUI/.eslintrc Normal file

@ -0,0 +1,8 @@
env:
node: true
browser: true
globals:
jQuery: true

@ -1,13 +1,10 @@
var $ = require('unopinionate').selector
var template = require('../entry.hbs')
var onScroll = require('onscroll')
$(function() {
;(function(window, document) {
var $form = $('#search-form')
var $input = $form.find('input')
var $body = $('body')
var $clear = $form.find('.clear')
var $searchResults = $('#search-results')
var $pkgListing = $('#all-packages')
var $searchBtn = $('.js-search-btn')

@ -1,8 +1,6 @@
var assert = require('assert')
var Crypto = require('crypto')
var jju = require('jju')
var Error = require('http-errors')
var Path = require('path')
var Logger = require('./logger')
module.exports = Auth
@ -183,7 +181,7 @@ Auth.prototype.bearer_middleware = function() {
var self = this
return function(req, res, _next) {
req.pause()
function next(err) {
function next(_err) {
req.resume()
return _next.apply(null, arguments)
}
@ -222,7 +220,7 @@ Auth.prototype.cookie_middleware = function() {
var self = this
return function(req, res, _next) {
req.pause()
function next(err) {
function next(_err) {
req.resume()
return _next()
}
@ -321,7 +319,7 @@ Auth.prototype.aes_decrypt = function(buf) {
function AnonymousUser() {
return {
name: undefined,
// groups without '$' are going to be deprecated eventually
// groups without '$' are going to be deprecated eventually
groups: [ '$all', '$anonymous', '@all', '@anonymous', 'all', 'undefined', 'anonymous' ],
real_groups: [],
}

@ -46,7 +46,7 @@ if (commander.args.length != 0) {
commander.help()
}
var config, config_path, have_question
var config, config_path
try {
if (commander.config) {
config_path = Path.resolve(commander.config)

@ -3,7 +3,6 @@ var Cookies = require('cookies')
var express = require('express')
var fs = require('fs')
var Handlebars = require('handlebars')
var Error = require('http-errors')
var renderReadme = require('render-readme')
var Search = require('./search')
var Middleware = require('./middleware')

@ -1,5 +1,4 @@
var express = require('express')
var fs = require('fs')
var Error = require('http-errors')
var compression = require('compression')
var Auth = require('./auth')
@ -16,7 +15,6 @@ module.exports = function(config_hash) {
var storage = Storage(config)
var auth = Auth(config)
var app = express()
var can = Middleware.allow(config)
// run in production mode by default, just in case
// it shouldn't make any difference anyway

@ -26,7 +26,7 @@ LocalData.prototype.remove = function(name) {
if (i !== -1) {
this.data.list.splice(i, 1)
}
this.sync()
}

@ -44,7 +44,6 @@ Storage.prototype._internal_error = function(err, file, message) {
}
Storage.prototype.add_package = function(name, info, callback) {
var self = this
var storage = this.storage(name)
if (!storage) return callback( Error[404]('this package cannot be added') )
@ -101,7 +100,7 @@ Storage.prototype.remove_package = function(name, callback) {
})
})
})
Search.remove(name)
this.config.localList.remove(name)
}
@ -267,11 +266,6 @@ Storage.prototype.add_tags = function(name, tags, callback) {
}, callback)
}
// change package info to tag a specific version
function _add_tag(data, version, tag) {
data['dist-tags'][tag] = version
}
// currently supports unpublishing only
Storage.prototype.change_package = function(name, metadata, revision, callback) {
var self = this

@ -148,7 +148,6 @@ module.exports.log = function(req, res, next) {
var _cookie = req.headers.cookie
if (_cookie != null) req.headers.cookie = '<Classified>'
var _url = req.url
req.url = req.originalUrl
req.log.info( { req: req, ip: req.ip }
, '@{ip} requested \'@{req.method} @{req.url}\'' )
@ -177,7 +176,6 @@ module.exports.log = function(req, res, next) {
message += ', bytes: @{bytes.in}/@{bytes.out}'
}
var _url = req.url
req.url = req.originalUrl
req.log.warn({
request : { method: req.method, url: req.url },

@ -373,7 +373,7 @@ $(function() {
})
})
},{"onclick":13,"transition-complete":15,"unopinionate":16}],4:[function(require,module,exports){
},{"onclick":13,"transition-complete":14,"unopinionate":15}],4:[function(require,module,exports){
// twitter bootstrap stuff;
// not in static 'cause I want it to be bundled with the rest of javascripts
require('./bootstrap-modal')
@ -388,17 +388,14 @@ $(document).on('click', '.js-userLogoutBtn', function() {
return false
})
},{"./bootstrap-modal":2,"./entry":3,"./search":5,"unopinionate":16}],5:[function(require,module,exports){
},{"./bootstrap-modal":2,"./entry":3,"./search":5,"unopinionate":15}],5:[function(require,module,exports){
var $ = require('unopinionate').selector
var template = require('../entry.hbs')
var onScroll = require('onscroll')
$(function() {
;(function(window, document) {
var $form = $('#search-form')
var $input = $form.find('input')
var $body = $('body')
var $clear = $form.find('.clear')
var $searchResults = $('#search-results')
var $pkgListing = $('#all-packages')
var $searchBtn = $('.js-search-btn')
@ -469,7 +466,7 @@ $(function() {
})(window, window.document)
})
},{"../entry.hbs":1,"onscroll":14,"unopinionate":16}],6:[function(require,module,exports){
},{"../entry.hbs":1,"unopinionate":15}],6:[function(require,module,exports){
"use strict";
/*globals Handlebars: true */
var base = require("./handlebars/base");
@ -1231,30 +1228,7 @@ $(document).bind('mousedown', click._doAnywheres);
module.exports = click;
},{"unopinionate":16}],14:[function(require,module,exports){
var $ = require('unopinionate').selector;
var bodyScrollers = [];
$(function() {
var $html = $('html'),
$body = $('body');
$(window, document, 'body').bind('scroll touchmove', function() {
var top = $html[0].scrollTop || $body[0].scrollTop;
for(var i=0; i<bodyScrollers.length; i++) {
bodyScrollers[i](top);
}
});
});
var onScroll = function(callback) {
bodyScrollers.push(callback);
};
module.exports = onScroll;
},{"unopinionate":16}],15:[function(require,module,exports){
},{"unopinionate":15}],14:[function(require,module,exports){
(function(root) {
var callbacks = [];
@ -1318,7 +1292,7 @@ module.exports = onScroll;
}
})(this);
},{}],16:[function(require,module,exports){
},{}],15:[function(require,module,exports){
(function (global){
(function(root) {
var unopinionate = {

@ -190,7 +190,6 @@ Storage.prototype.get_tarball = function(name, filename) {
// local reported 404
var err404 = err
var uplink = null
rstream.abort()
rstream = null // gc

@ -60,7 +60,7 @@ devDependencies:
#
# Linting tools
#
eslint: '~0.6.0'
eslint: '>= 0.18'
# for debugging memory leaks, it'll be require()'d if
# installed, but I don't want it to be installed everytime
@ -81,7 +81,6 @@ devDependencies:
# not required in runtime
unopinionate: '>=0.0.4 <1.0.0-0'
onclick: '>=0.1.0 <1.0.0-0'
onscroll: '>=0.0.3 <1.0.0-0'
transition-complete: '>=0.0.2 <1.0.0-0'
keywords:
@ -94,9 +93,10 @@ keywords:
- server
scripts:
test: mocha -R dot ./test/functional ./test/unit
test-travis: mocha -R spec ./test/functional ./test/unit
lint: eslint -c ./.eslint.yaml ./lib
test: eslint --reset . && mocha -R dot ./test/functional ./test/unit
test-travis: eslint --reset . && mocha -R spec ./test/functional ./test/unit
test-only: mocha -R dot ./test/functional ./test/unit
lint: eslint --reset .
prepublish: js-yaml package.yaml > package.json
clean-shrinkwrap: |
node -e '

5
test/.eslintrc Normal file

@ -0,0 +1,5 @@
env:
node: true
mocha: true

@ -1,7 +1,6 @@
require('./lib/startup')
var assert = require('assert')
var async = require('async')
var crypto = require('crypto')
function readfile(x) {
@ -132,6 +131,7 @@ module.exports = function() {
it('who am I?', function(cb) {
server.request({uri:'/-/whoami'}, function(err, res, body) {
assert.equal(err, null)
assert.equal(res.statusCode, 200)
assert.equal(body.username, 'test')
cb()

@ -1,8 +1,6 @@
require('./lib/startup')
var assert = require('assert')
var async = require('async')
var crypto = require('crypto')
function readfile(x) {
return require('fs').readFileSync(__dirname + '/' + x)
@ -34,7 +32,7 @@ module.exports = function() {
x.versions['0.0.9'] = x.versions['0.0.1']
require('zlib').gzip(JSON.stringify(x), function(err, buf) {
assert(!err)
assert.equal(err, null)
assert.equal(req.headers['accept-encoding'], 'gzip')
res.header('content-encoding', 'gzip')
res.send(buf)
@ -74,13 +72,14 @@ module.exports = function() {
},
json: false,
}, function(err, res, body) {
assert.equal(err, null)
assert.equal(res.statusCode, 200)
assert.equal(res.headers['content-encoding'], 'gzip')
assert.throws(function() {
JSON.parse(body.toString('utf8'))
})
require('zlib').gunzip(body, function(err, buf) {
assert(!err)
assert.equal(err, null)
body = JSON.parse(buf)
assert.equal(body.name, 'testexp_gzip')
assert.equal(Object.keys(body.versions).length, 9)

@ -5,8 +5,6 @@ module.exports = function() {
var express = process.express
describe('Incomplete', function() {
var on_tarball
before(function() {
express.get('/testexp-incomplete', function(_, res) {
res.send({
@ -49,12 +47,14 @@ module.exports = function() {
})
server.request({uri:'/testexp-incomplete/-/'+type+'.tar.gz'}, function(err, res, body) {
assert.equal(err, null)
if (type !== 'chunked') assert.equal(res.headers['content-length'], 1e6)
assert(body.match(/test test test/))
})
function cb() {
server.request({uri:'/testexp-incomplete/-/'+type+'.tar.gz'}, function(err, res, body) {
assert.equal(err, null)
assert.equal(body.error, 'internal server error')
_cb()
})

@ -4,11 +4,6 @@ require('./lib/startup')
var assert = require('assert')
var async = require('async')
var exec = require('child_process').exec
var crypto = require('crypto')
function readfile(x) {
return require('fs').readFileSync(__dirname + '/' + x)
}
describe('Func', function() {
var server = process.server
@ -30,6 +25,7 @@ describe('Func', function() {
server.debug(function(res, body) {
server.pid = body.pid
exec('lsof -p ' + Number(server.pid), function(err, result) {
assert.equal(err, null)
server.fdlist = result
cb()
})
@ -67,6 +63,7 @@ describe('Func', function() {
after(function(cb) {
async.map([server, server2], function(server, cb) {
exec('lsof -p ' + Number(server.pid), function(err, result) {
assert.equal(err, null)
assert.equal(server.fdlist, result.split('\n').filter(function(q) {
if (q.match(/TCP .*->.* \(ESTABLISHED\)/)) return false
if (q.match(/\/libcrypt-[^\/]+\.so/)) return false

@ -5,7 +5,7 @@ module.exports = function(name, version) {
"version": version || "0.0.0",
"dist": {
"shasum": "fake",
"tarball": "http://localhost:55551/"+escape(name)+"/-/blahblah"
"tarball": "http://localhost:55551/"+encodeURIComponent(name)+"/-/blahblah"
}
}
}

@ -1,7 +1,5 @@
var assert = require('assert')
var fork = require('child_process').fork
var express = require('express')
var readfile = require('fs').readFileSync
var rimraf = require('rimraf')
var Server = require('./server')

@ -23,6 +23,7 @@ module.exports = function() {
method: 'PUT',
json: JSON.parse(readfile('fixtures/newnpmreg.json')),
}, function(err, res, body) {
assert.equal(err, null)
assert.equal(res.statusCode, 201)
cb()
})
@ -72,6 +73,7 @@ module.exports = function() {
it('server1 - readme', function(cb) {
server.request({uri:'/-/readme/testpkg-newnpmreg'}, function(err, res, body) {
assert.equal(err, null)
assert.equal(res.statusCode, 200)
assert.equal(body, '<p>blah blah blah</p>\n')
cb()
@ -80,6 +82,7 @@ module.exports = function() {
it('server2 - readme', function(cb) {
server2.request({uri:'/-/readme/testpkg-newnpmreg'}, function(err, res, body) {
assert.equal(err, null)
assert.equal(res.statusCode, 200)
assert.equal(body, '<p>blah blah blah</p>\n')
cb()
@ -114,6 +117,7 @@ module.exports = function() {
it('server1 - search', function(cb) {
server.request({uri:'/-/all'}, function(err, res, body) {
assert.equal(err, null)
assert.equal(res.statusCode, 200)
check(body)
cb()
@ -122,6 +126,7 @@ module.exports = function() {
it('server2 - search', function(cb) {
server2.request({uri:'/-/all'}, function(err, res, body) {
assert.equal(err, null)
assert.equal(res.statusCode, 200)
check(body)
cb()

@ -1,7 +1,6 @@
require('./lib/startup')
var assert = require('assert')
var async = require('async')
var crypto = require('crypto')
function readfile(x) {

@ -1,12 +1,9 @@
var assert = require('assert')
var async = require('async')
var readfile = require('fs').readFileSync
var ex = module.exports
var _oksum = 0
module.exports = function() {
var server = process.server
var server2 = process.server2
describe('race', function() {
before(function(cb) {
@ -33,11 +30,13 @@ module.exports = function() {
async.parallel(fns, function(err, res) {
var okcount = 0
, failcount = 0
var failcount = 0
assert.equal(err, null)
res.forEach(function(arr) {
var resp = arr[0]
, body = arr[1]
var body = arr[1]
if (resp.statusCode === 201 && ~body.ok.indexOf('published')) okcount++
if (resp.statusCode === 409 && ~body.error.indexOf('already present')) failcount++
@ -65,11 +64,12 @@ module.exports = function() {
async.parallel(fns, function(err, res) {
var okcount = 0
, failcount = 0
var failcount = 0
assert.equal(err, null)
res.forEach(function(arr) {
var resp = arr[0]
, body = arr[1]
var body = arr[1]
if (resp.statusCode === 201 && ~body.ok.indexOf('published')) okcount++
if (resp.statusCode === 409 && ~body.error.indexOf('already present')) failcount++
if (resp.statusCode === 503 && ~body.error.indexOf('unavailable')) failcount++

@ -41,12 +41,14 @@ module.exports = function() {
}
server.request({uri:'/testexp-racycrash/-/test.tar.gz'}, function(err, res, body) {
assert.equal(err, null)
assert.equal(body, 'test test test\n')
})
function cb() {
// test for NOT crashing
server.request({uri:'/testexp-racycrash'}, function(err, res, body) {
assert.equal(err, null)
assert.equal(res.statusCode, 200)
_cb()
})
@ -59,6 +61,7 @@ module.exports = function() {
}
server.request({uri:'/testexp-racycrash/-/test.tar.gz'}, function(err, res, body) {
assert.equal(err, null)
assert.equal(body.error, 'internal server error')
cb()
})

@ -11,7 +11,6 @@ function sha(x) {
module.exports = function() {
var server = process.server
var server2 = process.server2
var express = process.express
describe('test-scoped', function() {
before(function(cb) {
@ -23,6 +22,7 @@ module.exports = function() {
method: 'PUT',
json: JSON.parse(readfile('fixtures/scoped.json')),
}, function(err, res, body) {
assert.equal(err, null)
assert.equal(res.statusCode, 201)
cb()
})

@ -2,7 +2,6 @@ var assert = require('assert')
module.exports = function() {
var server = process.server
var server2 = process.server2
describe('Security', function() {
before(server.add_package.bind(server, 'testpkg-sec'))
@ -25,11 +24,14 @@ module.exports = function() {
it('__proto__, connect stuff', function(cb) {
server.request({uri:'/testpkg-sec?__proto__=1'}, function(err, res, body) {
assert.equal(err, null)
// test for NOT outputting stack trace
assert(!body || typeof(body) === 'object' || body.indexOf('node_modules') === -1)
// test for NOT crashing
server.request({uri:'/testpkg-sec'}, function(err, res, body) {
assert.equal(err, null)
assert.equal(res.statusCode, 200)
cb()
})
@ -38,6 +40,7 @@ module.exports = function() {
it('do not return package.json as an attachment', function(cb) {
server.request({uri:'/testpkg-sec/-/package.json'}, function(err, res, body) {
assert.equal(err, null)
assert.equal(res.statusCode, 403)
assert(body.error.match(/invalid filename/))
cb()
@ -46,6 +49,7 @@ module.exports = function() {
it('silly things - reading #1', function(cb) {
server.request({uri:'/testpkg-sec/-/../../../../../../../../etc/passwd'}, function(err, res, body) {
assert.equal(err, null)
assert.equal(res.statusCode, 404)
cb()
})
@ -53,6 +57,7 @@ module.exports = function() {
it('silly things - reading #2', function(cb) {
server.request({uri:'/testpkg-sec/-/%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2f%2e%2e%2fetc%2fpasswd'}, function(err, res, body) {
assert.equal(err, null)
assert.equal(res.statusCode, 403)
assert(body.error.match(/invalid filename/))
cb()

@ -40,6 +40,7 @@ module.exports = function() {
;['0.1.1alpha', '0.1.1-alpha', '0000.00001.001-alpha'].forEach(function(ver) {
it('fetching '+ver, function(cb) {
server.request({uri:'/testexp_tags/'+ver}, function(err, res, body) {
assert.equal(err, null)
assert.equal(res.statusCode, 200)
assert.equal(body.version, '0.1.1alpha')
cb()

@ -38,6 +38,7 @@ describe('toplevel', function() {
request({
url: 'http://localhost:' + port + '/',
}, function(err, res, body) {
assert.equal(err, null)
assert(body.match(/<title>Sinopia<\/title>/))
done()
})
@ -47,6 +48,7 @@ describe('toplevel', function() {
request({
url: 'http://localhost:' + port + '/whatever',
}, function(err, res, body) {
assert.equal(err, null)
assert(body.match(/no such package available/))
done()
})

@ -21,11 +21,11 @@ describe('Validate', function() {
assert( !validate('some/thing') )
assert( !validate('some\\thing') )
})
it('no hidden', function() {
assert( !validate('.bin') )
})
it('no reserved', function() {
assert( !validate('favicon.ico') )
assert( !validate('node_modules') )