Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ftp port #2

Merged
merged 3 commits into from
Oct 30, 2015
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
17 changes: 4 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
sudo: false
language: node_js
node_js:
- "4"
- "iojs"
- "0.12"
- "0.11"
- "0.10"
- "0.9"
- "0.8"
- "iojs-v1.1"
- "iojs-v1.0"
before_install:
- "npm install -g npm@1.4.x"
script:
- "npm run test-travis"
after_script:
- "npm install coveralls@2.11.x && cat coverage/lcov.info | coveralls"
- "npm install coveralls@2 && cat coverage/lcov.info | coveralls"
matrix:
fast_finish: true
allow_failures:
- node_js: "0.11"
- node_js: "0.9"
- node_js: "iojs-v1.1"
- node_js: "iojs-v1.0"
notifications:
irc:
channels:
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = function required(port, protocol) {
return port !== 443;

case 'ftp':
return port !== 22;
return port !== 21;

case 'gopher':
return port !== 70;
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"main": "index.js",
"scripts": {
"100%": "istanbul check-coverage --statements 100 --functions 100 --lines 100 --branches 100",
"test": "mocha test.js",
"test-travis": "istanbul cover _mocha --report lcovonly -- test.js",
"coverage": "istanbul cover _mocha -- test.js",
"watch": "mocha --watch test.js",
"coverage": "istanbul cover ./node_modules/.bin/_mocha -- test.js",
"test-travis": "istanbul cover node_modules/.bin/_mocha --report lcovonly -- test.js"
"test": "mocha test.js"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -39,9 +39,9 @@
},
"homepage": "https://github.com/unshiftio/requires-port",
"devDependencies": {
"assume": "1.1.x",
"istanbul": "0.3.x",
"mocha": "2.1.x",
"pre-commit": "1.0.x"
"assume": "1.3.x",
"istanbul": "0.4.x",
"mocha": "2.3.x",
"pre-commit": "1.1.x"
}
}
10 changes: 5 additions & 5 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ describe('requires-port', function () {
assume(required(8080, 'wss://www.google.com')).true();
});

it('does not require port 22 for ftp', function () {
assume(required('22', 'ftp')).false();
assume(required(22, 'ftp')).false();
assume(required(22, 'ftp://')).false();
assume(required(22, 'ftp://www.google.com')).false();
it('does not require port 21 for ftp', function () {
assume(required('21', 'ftp')).false();
assume(required(21, 'ftp')).false();
assume(required(21, 'ftp://')).false();
assume(required(21, 'ftp://www.google.com')).false();

assume(required('8080', 'ftp')).true();
assume(required(8080, 'ftp')).true();
Expand Down