mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
set up some linting (obvious errors only)
This commit is contained in:
parent
2ee12c7293
commit
9047e28074
31 changed files with 111 additions and 361 deletions
275
.eslint.yaml
275
.eslint.yaml
|
@ -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
2
.eslintignore
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
node_modules
|
||||||
|
lib/static
|
44
.eslintrc
Normal file
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
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 $ = require('unopinionate').selector
|
||||||
var template = require('../entry.hbs')
|
var template = require('../entry.hbs')
|
||||||
var onScroll = require('onscroll')
|
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
;(function(window, document) {
|
;(function(window, document) {
|
||||||
var $form = $('#search-form')
|
var $form = $('#search-form')
|
||||||
var $input = $form.find('input')
|
var $input = $form.find('input')
|
||||||
var $body = $('body')
|
|
||||||
var $clear = $form.find('.clear')
|
|
||||||
var $searchResults = $('#search-results')
|
var $searchResults = $('#search-results')
|
||||||
var $pkgListing = $('#all-packages')
|
var $pkgListing = $('#all-packages')
|
||||||
var $searchBtn = $('.js-search-btn')
|
var $searchBtn = $('.js-search-btn')
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
var assert = require('assert')
|
|
||||||
var Crypto = require('crypto')
|
var Crypto = require('crypto')
|
||||||
var jju = require('jju')
|
var jju = require('jju')
|
||||||
var Error = require('http-errors')
|
var Error = require('http-errors')
|
||||||
var Path = require('path')
|
|
||||||
var Logger = require('./logger')
|
var Logger = require('./logger')
|
||||||
|
|
||||||
module.exports = Auth
|
module.exports = Auth
|
||||||
|
@ -183,7 +181,7 @@ Auth.prototype.bearer_middleware = function() {
|
||||||
var self = this
|
var self = this
|
||||||
return function(req, res, _next) {
|
return function(req, res, _next) {
|
||||||
req.pause()
|
req.pause()
|
||||||
function next(err) {
|
function next(_err) {
|
||||||
req.resume()
|
req.resume()
|
||||||
return _next.apply(null, arguments)
|
return _next.apply(null, arguments)
|
||||||
}
|
}
|
||||||
|
@ -222,7 +220,7 @@ Auth.prototype.cookie_middleware = function() {
|
||||||
var self = this
|
var self = this
|
||||||
return function(req, res, _next) {
|
return function(req, res, _next) {
|
||||||
req.pause()
|
req.pause()
|
||||||
function next(err) {
|
function next(_err) {
|
||||||
req.resume()
|
req.resume()
|
||||||
return _next()
|
return _next()
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ if (commander.args.length != 0) {
|
||||||
commander.help()
|
commander.help()
|
||||||
}
|
}
|
||||||
|
|
||||||
var config, config_path, have_question
|
var config, config_path
|
||||||
try {
|
try {
|
||||||
if (commander.config) {
|
if (commander.config) {
|
||||||
config_path = Path.resolve(commander.config)
|
config_path = Path.resolve(commander.config)
|
||||||
|
|
|
@ -3,7 +3,6 @@ var Cookies = require('cookies')
|
||||||
var express = require('express')
|
var express = require('express')
|
||||||
var fs = require('fs')
|
var fs = require('fs')
|
||||||
var Handlebars = require('handlebars')
|
var Handlebars = require('handlebars')
|
||||||
var Error = require('http-errors')
|
|
||||||
var renderReadme = require('render-readme')
|
var renderReadme = require('render-readme')
|
||||||
var Search = require('./search')
|
var Search = require('./search')
|
||||||
var Middleware = require('./middleware')
|
var Middleware = require('./middleware')
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
var express = require('express')
|
var express = require('express')
|
||||||
var fs = require('fs')
|
|
||||||
var Error = require('http-errors')
|
var Error = require('http-errors')
|
||||||
var compression = require('compression')
|
var compression = require('compression')
|
||||||
var Auth = require('./auth')
|
var Auth = require('./auth')
|
||||||
|
@ -16,7 +15,6 @@ module.exports = function(config_hash) {
|
||||||
var storage = Storage(config)
|
var storage = Storage(config)
|
||||||
var auth = Auth(config)
|
var auth = Auth(config)
|
||||||
var app = express()
|
var app = express()
|
||||||
var can = Middleware.allow(config)
|
|
||||||
|
|
||||||
// run in production mode by default, just in case
|
// run in production mode by default, just in case
|
||||||
// it shouldn't make any difference anyway
|
// it shouldn't make any difference anyway
|
||||||
|
|
|
@ -44,7 +44,6 @@ Storage.prototype._internal_error = function(err, file, message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Storage.prototype.add_package = function(name, info, callback) {
|
Storage.prototype.add_package = function(name, info, callback) {
|
||||||
var self = this
|
|
||||||
var storage = this.storage(name)
|
var storage = this.storage(name)
|
||||||
if (!storage) return callback( Error[404]('this package cannot be added') )
|
if (!storage) return callback( Error[404]('this package cannot be added') )
|
||||||
|
|
||||||
|
@ -267,11 +266,6 @@ Storage.prototype.add_tags = function(name, tags, callback) {
|
||||||
}, 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
|
// currently supports unpublishing only
|
||||||
Storage.prototype.change_package = function(name, metadata, revision, callback) {
|
Storage.prototype.change_package = function(name, metadata, revision, callback) {
|
||||||
var self = this
|
var self = this
|
||||||
|
|
|
@ -148,7 +148,6 @@ module.exports.log = function(req, res, next) {
|
||||||
var _cookie = req.headers.cookie
|
var _cookie = req.headers.cookie
|
||||||
if (_cookie != null) req.headers.cookie = '<Classified>'
|
if (_cookie != null) req.headers.cookie = '<Classified>'
|
||||||
|
|
||||||
var _url = req.url
|
|
||||||
req.url = req.originalUrl
|
req.url = req.originalUrl
|
||||||
req.log.info( { req: req, ip: req.ip }
|
req.log.info( { req: req, ip: req.ip }
|
||||||
, '@{ip} requested \'@{req.method} @{req.url}\'' )
|
, '@{ip} requested \'@{req.method} @{req.url}\'' )
|
||||||
|
@ -177,7 +176,6 @@ module.exports.log = function(req, res, next) {
|
||||||
message += ', bytes: @{bytes.in}/@{bytes.out}'
|
message += ', bytes: @{bytes.in}/@{bytes.out}'
|
||||||
}
|
}
|
||||||
|
|
||||||
var _url = req.url
|
|
||||||
req.url = req.originalUrl
|
req.url = req.originalUrl
|
||||||
req.log.warn({
|
req.log.warn({
|
||||||
request : { method: req.method, url: req.url },
|
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;
|
// twitter bootstrap stuff;
|
||||||
// not in static 'cause I want it to be bundled with the rest of javascripts
|
// not in static 'cause I want it to be bundled with the rest of javascripts
|
||||||
require('./bootstrap-modal')
|
require('./bootstrap-modal')
|
||||||
|
@ -388,17 +388,14 @@ $(document).on('click', '.js-userLogoutBtn', function() {
|
||||||
return false
|
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 $ = require('unopinionate').selector
|
||||||
var template = require('../entry.hbs')
|
var template = require('../entry.hbs')
|
||||||
var onScroll = require('onscroll')
|
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
;(function(window, document) {
|
;(function(window, document) {
|
||||||
var $form = $('#search-form')
|
var $form = $('#search-form')
|
||||||
var $input = $form.find('input')
|
var $input = $form.find('input')
|
||||||
var $body = $('body')
|
|
||||||
var $clear = $form.find('.clear')
|
|
||||||
var $searchResults = $('#search-results')
|
var $searchResults = $('#search-results')
|
||||||
var $pkgListing = $('#all-packages')
|
var $pkgListing = $('#all-packages')
|
||||||
var $searchBtn = $('.js-search-btn')
|
var $searchBtn = $('.js-search-btn')
|
||||||
|
@ -469,7 +466,7 @@ $(function() {
|
||||||
})(window, window.document)
|
})(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";
|
"use strict";
|
||||||
/*globals Handlebars: true */
|
/*globals Handlebars: true */
|
||||||
var base = require("./handlebars/base");
|
var base = require("./handlebars/base");
|
||||||
|
@ -1231,30 +1228,7 @@ $(document).bind('mousedown', click._doAnywheres);
|
||||||
module.exports = click;
|
module.exports = click;
|
||||||
|
|
||||||
|
|
||||||
},{"unopinionate":16}],14:[function(require,module,exports){
|
},{"unopinionate":15}],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){
|
|
||||||
(function(root) {
|
(function(root) {
|
||||||
var callbacks = [];
|
var callbacks = [];
|
||||||
|
|
||||||
|
@ -1318,7 +1292,7 @@ module.exports = onScroll;
|
||||||
}
|
}
|
||||||
})(this);
|
})(this);
|
||||||
|
|
||||||
},{}],16:[function(require,module,exports){
|
},{}],15:[function(require,module,exports){
|
||||||
(function (global){
|
(function (global){
|
||||||
(function(root) {
|
(function(root) {
|
||||||
var unopinionate = {
|
var unopinionate = {
|
||||||
|
|
|
@ -190,7 +190,6 @@ Storage.prototype.get_tarball = function(name, filename) {
|
||||||
|
|
||||||
// local reported 404
|
// local reported 404
|
||||||
var err404 = err
|
var err404 = err
|
||||||
var uplink = null
|
|
||||||
rstream.abort()
|
rstream.abort()
|
||||||
rstream = null // gc
|
rstream = null // gc
|
||||||
|
|
||||||
|
|
10
package.yaml
10
package.yaml
|
@ -60,7 +60,7 @@ devDependencies:
|
||||||
#
|
#
|
||||||
# Linting tools
|
# Linting tools
|
||||||
#
|
#
|
||||||
eslint: '~0.6.0'
|
eslint: '>= 0.18'
|
||||||
|
|
||||||
# for debugging memory leaks, it'll be require()'d if
|
# for debugging memory leaks, it'll be require()'d if
|
||||||
# installed, but I don't want it to be installed everytime
|
# installed, but I don't want it to be installed everytime
|
||||||
|
@ -81,7 +81,6 @@ devDependencies:
|
||||||
# not required in runtime
|
# not required in runtime
|
||||||
unopinionate: '>=0.0.4 <1.0.0-0'
|
unopinionate: '>=0.0.4 <1.0.0-0'
|
||||||
onclick: '>=0.1.0 <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'
|
transition-complete: '>=0.0.2 <1.0.0-0'
|
||||||
|
|
||||||
keywords:
|
keywords:
|
||||||
|
@ -94,9 +93,10 @@ keywords:
|
||||||
- server
|
- server
|
||||||
|
|
||||||
scripts:
|
scripts:
|
||||||
test: mocha -R dot ./test/functional ./test/unit
|
test: eslint --reset . && mocha -R dot ./test/functional ./test/unit
|
||||||
test-travis: mocha -R spec ./test/functional ./test/unit
|
test-travis: eslint --reset . && mocha -R spec ./test/functional ./test/unit
|
||||||
lint: eslint -c ./.eslint.yaml ./lib
|
test-only: mocha -R dot ./test/functional ./test/unit
|
||||||
|
lint: eslint --reset .
|
||||||
prepublish: js-yaml package.yaml > package.json
|
prepublish: js-yaml package.yaml > package.json
|
||||||
clean-shrinkwrap: |
|
clean-shrinkwrap: |
|
||||||
node -e '
|
node -e '
|
||||||
|
|
5
test/.eslintrc
Normal file
5
test/.eslintrc
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
env:
|
||||||
|
node: true
|
||||||
|
mocha: true
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
require('./lib/startup')
|
require('./lib/startup')
|
||||||
|
|
||||||
var assert = require('assert')
|
var assert = require('assert')
|
||||||
var async = require('async')
|
|
||||||
var crypto = require('crypto')
|
var crypto = require('crypto')
|
||||||
|
|
||||||
function readfile(x) {
|
function readfile(x) {
|
||||||
|
@ -132,6 +131,7 @@ module.exports = function() {
|
||||||
|
|
||||||
it('who am I?', function(cb) {
|
it('who am I?', function(cb) {
|
||||||
server.request({uri:'/-/whoami'}, function(err, res, body) {
|
server.request({uri:'/-/whoami'}, function(err, res, body) {
|
||||||
|
assert.equal(err, null)
|
||||||
assert.equal(res.statusCode, 200)
|
assert.equal(res.statusCode, 200)
|
||||||
assert.equal(body.username, 'test')
|
assert.equal(body.username, 'test')
|
||||||
cb()
|
cb()
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
require('./lib/startup')
|
require('./lib/startup')
|
||||||
|
|
||||||
var assert = require('assert')
|
var assert = require('assert')
|
||||||
var async = require('async')
|
|
||||||
var crypto = require('crypto')
|
|
||||||
|
|
||||||
function readfile(x) {
|
function readfile(x) {
|
||||||
return require('fs').readFileSync(__dirname + '/' + x)
|
return require('fs').readFileSync(__dirname + '/' + x)
|
||||||
|
@ -34,7 +32,7 @@ module.exports = function() {
|
||||||
x.versions['0.0.9'] = x.versions['0.0.1']
|
x.versions['0.0.9'] = x.versions['0.0.1']
|
||||||
|
|
||||||
require('zlib').gzip(JSON.stringify(x), function(err, buf) {
|
require('zlib').gzip(JSON.stringify(x), function(err, buf) {
|
||||||
assert(!err)
|
assert.equal(err, null)
|
||||||
assert.equal(req.headers['accept-encoding'], 'gzip')
|
assert.equal(req.headers['accept-encoding'], 'gzip')
|
||||||
res.header('content-encoding', 'gzip')
|
res.header('content-encoding', 'gzip')
|
||||||
res.send(buf)
|
res.send(buf)
|
||||||
|
@ -74,13 +72,14 @@ module.exports = function() {
|
||||||
},
|
},
|
||||||
json: false,
|
json: false,
|
||||||
}, function(err, res, body) {
|
}, function(err, res, body) {
|
||||||
|
assert.equal(err, null)
|
||||||
assert.equal(res.statusCode, 200)
|
assert.equal(res.statusCode, 200)
|
||||||
assert.equal(res.headers['content-encoding'], 'gzip')
|
assert.equal(res.headers['content-encoding'], 'gzip')
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
JSON.parse(body.toString('utf8'))
|
JSON.parse(body.toString('utf8'))
|
||||||
})
|
})
|
||||||
require('zlib').gunzip(body, function(err, buf) {
|
require('zlib').gunzip(body, function(err, buf) {
|
||||||
assert(!err)
|
assert.equal(err, null)
|
||||||
body = JSON.parse(buf)
|
body = JSON.parse(buf)
|
||||||
assert.equal(body.name, 'testexp_gzip')
|
assert.equal(body.name, 'testexp_gzip')
|
||||||
assert.equal(Object.keys(body.versions).length, 9)
|
assert.equal(Object.keys(body.versions).length, 9)
|
||||||
|
|
|
@ -5,8 +5,6 @@ module.exports = function() {
|
||||||
var express = process.express
|
var express = process.express
|
||||||
|
|
||||||
describe('Incomplete', function() {
|
describe('Incomplete', function() {
|
||||||
var on_tarball
|
|
||||||
|
|
||||||
before(function() {
|
before(function() {
|
||||||
express.get('/testexp-incomplete', function(_, res) {
|
express.get('/testexp-incomplete', function(_, res) {
|
||||||
res.send({
|
res.send({
|
||||||
|
@ -49,12 +47,14 @@ module.exports = function() {
|
||||||
})
|
})
|
||||||
|
|
||||||
server.request({uri:'/testexp-incomplete/-/'+type+'.tar.gz'}, function(err, res, body) {
|
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)
|
if (type !== 'chunked') assert.equal(res.headers['content-length'], 1e6)
|
||||||
assert(body.match(/test test test/))
|
assert(body.match(/test test test/))
|
||||||
})
|
})
|
||||||
|
|
||||||
function cb() {
|
function cb() {
|
||||||
server.request({uri:'/testexp-incomplete/-/'+type+'.tar.gz'}, function(err, res, body) {
|
server.request({uri:'/testexp-incomplete/-/'+type+'.tar.gz'}, function(err, res, body) {
|
||||||
|
assert.equal(err, null)
|
||||||
assert.equal(body.error, 'internal server error')
|
assert.equal(body.error, 'internal server error')
|
||||||
_cb()
|
_cb()
|
||||||
})
|
})
|
||||||
|
|
|
@ -4,11 +4,6 @@ require('./lib/startup')
|
||||||
var assert = require('assert')
|
var assert = require('assert')
|
||||||
var async = require('async')
|
var async = require('async')
|
||||||
var exec = require('child_process').exec
|
var exec = require('child_process').exec
|
||||||
var crypto = require('crypto')
|
|
||||||
|
|
||||||
function readfile(x) {
|
|
||||||
return require('fs').readFileSync(__dirname + '/' + x)
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('Func', function() {
|
describe('Func', function() {
|
||||||
var server = process.server
|
var server = process.server
|
||||||
|
@ -30,6 +25,7 @@ describe('Func', function() {
|
||||||
server.debug(function(res, body) {
|
server.debug(function(res, body) {
|
||||||
server.pid = body.pid
|
server.pid = body.pid
|
||||||
exec('lsof -p ' + Number(server.pid), function(err, result) {
|
exec('lsof -p ' + Number(server.pid), function(err, result) {
|
||||||
|
assert.equal(err, null)
|
||||||
server.fdlist = result
|
server.fdlist = result
|
||||||
cb()
|
cb()
|
||||||
})
|
})
|
||||||
|
@ -67,6 +63,7 @@ describe('Func', function() {
|
||||||
after(function(cb) {
|
after(function(cb) {
|
||||||
async.map([server, server2], function(server, cb) {
|
async.map([server, server2], function(server, cb) {
|
||||||
exec('lsof -p ' + Number(server.pid), function(err, result) {
|
exec('lsof -p ' + Number(server.pid), function(err, result) {
|
||||||
|
assert.equal(err, null)
|
||||||
assert.equal(server.fdlist, result.split('\n').filter(function(q) {
|
assert.equal(server.fdlist, result.split('\n').filter(function(q) {
|
||||||
if (q.match(/TCP .*->.* \(ESTABLISHED\)/)) return false
|
if (q.match(/TCP .*->.* \(ESTABLISHED\)/)) return false
|
||||||
if (q.match(/\/libcrypt-[^\/]+\.so/)) return false
|
if (q.match(/\/libcrypt-[^\/]+\.so/)) return false
|
||||||
|
|
|
@ -5,7 +5,7 @@ module.exports = function(name, version) {
|
||||||
"version": version || "0.0.0",
|
"version": version || "0.0.0",
|
||||||
"dist": {
|
"dist": {
|
||||||
"shasum": "fake",
|
"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 fork = require('child_process').fork
|
||||||
var express = require('express')
|
var express = require('express')
|
||||||
var readfile = require('fs').readFileSync
|
|
||||||
var rimraf = require('rimraf')
|
var rimraf = require('rimraf')
|
||||||
var Server = require('./server')
|
var Server = require('./server')
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ module.exports = function() {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
json: JSON.parse(readfile('fixtures/newnpmreg.json')),
|
json: JSON.parse(readfile('fixtures/newnpmreg.json')),
|
||||||
}, function(err, res, body) {
|
}, function(err, res, body) {
|
||||||
|
assert.equal(err, null)
|
||||||
assert.equal(res.statusCode, 201)
|
assert.equal(res.statusCode, 201)
|
||||||
cb()
|
cb()
|
||||||
})
|
})
|
||||||
|
@ -72,6 +73,7 @@ module.exports = function() {
|
||||||
|
|
||||||
it('server1 - readme', function(cb) {
|
it('server1 - readme', function(cb) {
|
||||||
server.request({uri:'/-/readme/testpkg-newnpmreg'}, function(err, res, body) {
|
server.request({uri:'/-/readme/testpkg-newnpmreg'}, function(err, res, body) {
|
||||||
|
assert.equal(err, null)
|
||||||
assert.equal(res.statusCode, 200)
|
assert.equal(res.statusCode, 200)
|
||||||
assert.equal(body, '<p>blah blah blah</p>\n')
|
assert.equal(body, '<p>blah blah blah</p>\n')
|
||||||
cb()
|
cb()
|
||||||
|
@ -80,6 +82,7 @@ module.exports = function() {
|
||||||
|
|
||||||
it('server2 - readme', function(cb) {
|
it('server2 - readme', function(cb) {
|
||||||
server2.request({uri:'/-/readme/testpkg-newnpmreg'}, function(err, res, body) {
|
server2.request({uri:'/-/readme/testpkg-newnpmreg'}, function(err, res, body) {
|
||||||
|
assert.equal(err, null)
|
||||||
assert.equal(res.statusCode, 200)
|
assert.equal(res.statusCode, 200)
|
||||||
assert.equal(body, '<p>blah blah blah</p>\n')
|
assert.equal(body, '<p>blah blah blah</p>\n')
|
||||||
cb()
|
cb()
|
||||||
|
@ -114,6 +117,7 @@ module.exports = function() {
|
||||||
|
|
||||||
it('server1 - search', function(cb) {
|
it('server1 - search', function(cb) {
|
||||||
server.request({uri:'/-/all'}, function(err, res, body) {
|
server.request({uri:'/-/all'}, function(err, res, body) {
|
||||||
|
assert.equal(err, null)
|
||||||
assert.equal(res.statusCode, 200)
|
assert.equal(res.statusCode, 200)
|
||||||
check(body)
|
check(body)
|
||||||
cb()
|
cb()
|
||||||
|
@ -122,6 +126,7 @@ module.exports = function() {
|
||||||
|
|
||||||
it('server2 - search', function(cb) {
|
it('server2 - search', function(cb) {
|
||||||
server2.request({uri:'/-/all'}, function(err, res, body) {
|
server2.request({uri:'/-/all'}, function(err, res, body) {
|
||||||
|
assert.equal(err, null)
|
||||||
assert.equal(res.statusCode, 200)
|
assert.equal(res.statusCode, 200)
|
||||||
check(body)
|
check(body)
|
||||||
cb()
|
cb()
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
require('./lib/startup')
|
require('./lib/startup')
|
||||||
|
|
||||||
var assert = require('assert')
|
var assert = require('assert')
|
||||||
var async = require('async')
|
|
||||||
var crypto = require('crypto')
|
var crypto = require('crypto')
|
||||||
|
|
||||||
function readfile(x) {
|
function readfile(x) {
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
var assert = require('assert')
|
var assert = require('assert')
|
||||||
var async = require('async')
|
var async = require('async')
|
||||||
var readfile = require('fs').readFileSync
|
|
||||||
var ex = module.exports
|
|
||||||
var _oksum = 0
|
var _oksum = 0
|
||||||
|
|
||||||
module.exports = function() {
|
module.exports = function() {
|
||||||
var server = process.server
|
var server = process.server
|
||||||
var server2 = process.server2
|
|
||||||
|
|
||||||
describe('race', function() {
|
describe('race', function() {
|
||||||
before(function(cb) {
|
before(function(cb) {
|
||||||
|
@ -33,11 +30,13 @@ module.exports = function() {
|
||||||
|
|
||||||
async.parallel(fns, function(err, res) {
|
async.parallel(fns, function(err, res) {
|
||||||
var okcount = 0
|
var okcount = 0
|
||||||
, failcount = 0
|
var failcount = 0
|
||||||
|
|
||||||
|
assert.equal(err, null)
|
||||||
|
|
||||||
res.forEach(function(arr) {
|
res.forEach(function(arr) {
|
||||||
var resp = arr[0]
|
var resp = arr[0]
|
||||||
, body = arr[1]
|
var body = arr[1]
|
||||||
|
|
||||||
if (resp.statusCode === 201 && ~body.ok.indexOf('published')) okcount++
|
if (resp.statusCode === 201 && ~body.ok.indexOf('published')) okcount++
|
||||||
if (resp.statusCode === 409 && ~body.error.indexOf('already present')) failcount++
|
if (resp.statusCode === 409 && ~body.error.indexOf('already present')) failcount++
|
||||||
|
@ -65,11 +64,12 @@ module.exports = function() {
|
||||||
|
|
||||||
async.parallel(fns, function(err, res) {
|
async.parallel(fns, function(err, res) {
|
||||||
var okcount = 0
|
var okcount = 0
|
||||||
, failcount = 0
|
var failcount = 0
|
||||||
|
|
||||||
|
assert.equal(err, null)
|
||||||
res.forEach(function(arr) {
|
res.forEach(function(arr) {
|
||||||
var resp = arr[0]
|
var resp = arr[0]
|
||||||
, body = arr[1]
|
var body = arr[1]
|
||||||
if (resp.statusCode === 201 && ~body.ok.indexOf('published')) okcount++
|
if (resp.statusCode === 201 && ~body.ok.indexOf('published')) okcount++
|
||||||
if (resp.statusCode === 409 && ~body.error.indexOf('already present')) failcount++
|
if (resp.statusCode === 409 && ~body.error.indexOf('already present')) failcount++
|
||||||
if (resp.statusCode === 503 && ~body.error.indexOf('unavailable')) 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) {
|
server.request({uri:'/testexp-racycrash/-/test.tar.gz'}, function(err, res, body) {
|
||||||
|
assert.equal(err, null)
|
||||||
assert.equal(body, 'test test test\n')
|
assert.equal(body, 'test test test\n')
|
||||||
})
|
})
|
||||||
|
|
||||||
function cb() {
|
function cb() {
|
||||||
// test for NOT crashing
|
// test for NOT crashing
|
||||||
server.request({uri:'/testexp-racycrash'}, function(err, res, body) {
|
server.request({uri:'/testexp-racycrash'}, function(err, res, body) {
|
||||||
|
assert.equal(err, null)
|
||||||
assert.equal(res.statusCode, 200)
|
assert.equal(res.statusCode, 200)
|
||||||
_cb()
|
_cb()
|
||||||
})
|
})
|
||||||
|
@ -59,6 +61,7 @@ module.exports = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
server.request({uri:'/testexp-racycrash/-/test.tar.gz'}, function(err, res, body) {
|
server.request({uri:'/testexp-racycrash/-/test.tar.gz'}, function(err, res, body) {
|
||||||
|
assert.equal(err, null)
|
||||||
assert.equal(body.error, 'internal server error')
|
assert.equal(body.error, 'internal server error')
|
||||||
cb()
|
cb()
|
||||||
})
|
})
|
||||||
|
|
|
@ -11,7 +11,6 @@ function sha(x) {
|
||||||
module.exports = function() {
|
module.exports = function() {
|
||||||
var server = process.server
|
var server = process.server
|
||||||
var server2 = process.server2
|
var server2 = process.server2
|
||||||
var express = process.express
|
|
||||||
|
|
||||||
describe('test-scoped', function() {
|
describe('test-scoped', function() {
|
||||||
before(function(cb) {
|
before(function(cb) {
|
||||||
|
@ -23,6 +22,7 @@ module.exports = function() {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
json: JSON.parse(readfile('fixtures/scoped.json')),
|
json: JSON.parse(readfile('fixtures/scoped.json')),
|
||||||
}, function(err, res, body) {
|
}, function(err, res, body) {
|
||||||
|
assert.equal(err, null)
|
||||||
assert.equal(res.statusCode, 201)
|
assert.equal(res.statusCode, 201)
|
||||||
cb()
|
cb()
|
||||||
})
|
})
|
||||||
|
|
|
@ -2,7 +2,6 @@ var assert = require('assert')
|
||||||
|
|
||||||
module.exports = function() {
|
module.exports = function() {
|
||||||
var server = process.server
|
var server = process.server
|
||||||
var server2 = process.server2
|
|
||||||
|
|
||||||
describe('Security', function() {
|
describe('Security', function() {
|
||||||
before(server.add_package.bind(server, 'testpkg-sec'))
|
before(server.add_package.bind(server, 'testpkg-sec'))
|
||||||
|
@ -25,11 +24,14 @@ module.exports = function() {
|
||||||
|
|
||||||
it('__proto__, connect stuff', function(cb) {
|
it('__proto__, connect stuff', function(cb) {
|
||||||
server.request({uri:'/testpkg-sec?__proto__=1'}, function(err, res, body) {
|
server.request({uri:'/testpkg-sec?__proto__=1'}, function(err, res, body) {
|
||||||
|
assert.equal(err, null)
|
||||||
|
|
||||||
// test for NOT outputting stack trace
|
// test for NOT outputting stack trace
|
||||||
assert(!body || typeof(body) === 'object' || body.indexOf('node_modules') === -1)
|
assert(!body || typeof(body) === 'object' || body.indexOf('node_modules') === -1)
|
||||||
|
|
||||||
// test for NOT crashing
|
// test for NOT crashing
|
||||||
server.request({uri:'/testpkg-sec'}, function(err, res, body) {
|
server.request({uri:'/testpkg-sec'}, function(err, res, body) {
|
||||||
|
assert.equal(err, null)
|
||||||
assert.equal(res.statusCode, 200)
|
assert.equal(res.statusCode, 200)
|
||||||
cb()
|
cb()
|
||||||
})
|
})
|
||||||
|
@ -38,6 +40,7 @@ module.exports = function() {
|
||||||
|
|
||||||
it('do not return package.json as an attachment', function(cb) {
|
it('do not return package.json as an attachment', function(cb) {
|
||||||
server.request({uri:'/testpkg-sec/-/package.json'}, function(err, res, body) {
|
server.request({uri:'/testpkg-sec/-/package.json'}, function(err, res, body) {
|
||||||
|
assert.equal(err, null)
|
||||||
assert.equal(res.statusCode, 403)
|
assert.equal(res.statusCode, 403)
|
||||||
assert(body.error.match(/invalid filename/))
|
assert(body.error.match(/invalid filename/))
|
||||||
cb()
|
cb()
|
||||||
|
@ -46,6 +49,7 @@ module.exports = function() {
|
||||||
|
|
||||||
it('silly things - reading #1', function(cb) {
|
it('silly things - reading #1', function(cb) {
|
||||||
server.request({uri:'/testpkg-sec/-/../../../../../../../../etc/passwd'}, function(err, res, body) {
|
server.request({uri:'/testpkg-sec/-/../../../../../../../../etc/passwd'}, function(err, res, body) {
|
||||||
|
assert.equal(err, null)
|
||||||
assert.equal(res.statusCode, 404)
|
assert.equal(res.statusCode, 404)
|
||||||
cb()
|
cb()
|
||||||
})
|
})
|
||||||
|
@ -53,6 +57,7 @@ module.exports = function() {
|
||||||
|
|
||||||
it('silly things - reading #2', function(cb) {
|
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) {
|
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.equal(res.statusCode, 403)
|
||||||
assert(body.error.match(/invalid filename/))
|
assert(body.error.match(/invalid filename/))
|
||||||
cb()
|
cb()
|
||||||
|
|
|
@ -40,6 +40,7 @@ module.exports = function() {
|
||||||
;['0.1.1alpha', '0.1.1-alpha', '0000.00001.001-alpha'].forEach(function(ver) {
|
;['0.1.1alpha', '0.1.1-alpha', '0000.00001.001-alpha'].forEach(function(ver) {
|
||||||
it('fetching '+ver, function(cb) {
|
it('fetching '+ver, function(cb) {
|
||||||
server.request({uri:'/testexp_tags/'+ver}, function(err, res, body) {
|
server.request({uri:'/testexp_tags/'+ver}, function(err, res, body) {
|
||||||
|
assert.equal(err, null)
|
||||||
assert.equal(res.statusCode, 200)
|
assert.equal(res.statusCode, 200)
|
||||||
assert.equal(body.version, '0.1.1alpha')
|
assert.equal(body.version, '0.1.1alpha')
|
||||||
cb()
|
cb()
|
||||||
|
|
|
@ -38,6 +38,7 @@ describe('toplevel', function() {
|
||||||
request({
|
request({
|
||||||
url: 'http://localhost:' + port + '/',
|
url: 'http://localhost:' + port + '/',
|
||||||
}, function(err, res, body) {
|
}, function(err, res, body) {
|
||||||
|
assert.equal(err, null)
|
||||||
assert(body.match(/<title>Sinopia<\/title>/))
|
assert(body.match(/<title>Sinopia<\/title>/))
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
@ -47,6 +48,7 @@ describe('toplevel', function() {
|
||||||
request({
|
request({
|
||||||
url: 'http://localhost:' + port + '/whatever',
|
url: 'http://localhost:' + port + '/whatever',
|
||||||
}, function(err, res, body) {
|
}, function(err, res, body) {
|
||||||
|
assert.equal(err, null)
|
||||||
assert(body.match(/no such package available/))
|
assert(body.match(/no such package available/))
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue