Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"collect-stream": "^1.1.1",
"eslint": "^1.10.3",
"istanbul": "~0.2.4",
"jsftp": "git://github.com/sergi/jsftp.git#master",
"jsftp": "^2.0.0",
"mocha": "^2.3.4",
"should": "~3.1.2",
"ftp": "^0.3.10"
Expand Down
2 changes: 1 addition & 1 deletion test/cwd-cdup.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('CWD/CDUP commands', function() {
it('should not change to non-existent directory', function(done) {
client.raw('CWD', pathExisting, function(error, response) {
response.code.should.equal(250);
server.suppressExpecteErrMsgs.push(
server.suppressExpectedErrMsgs.push(
/^CWD \S+: Error: ENOENT/
);
client.raw('CWD', pathExisting, function(error) {
Expand Down
4 changes: 2 additions & 2 deletions test/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('initialization', function() {
it('should bail if getRoot fails', function(done) {
server = common.server({
getRoot: function(connection, callback) {
server.suppressExpecteErrMsgs.push(
server.suppressExpectedErrMsgs.push(
'getRoot signaled error [Error: intentional failure]');
callback(new Error('intentional failure'));
},
Expand Down Expand Up @@ -85,7 +85,7 @@ describe('initialization', function() {
it('should bail if getInitialCwd fails', function(done) {
server = common.server({
getInitialCwd: function(connection, callback) {
server.suppressExpecteErrMsgs.push(
server.suppressExpectedErrMsgs.push(
'getInitialCwd signaled error [Error: intentional failure]');
callback(new Error('intentional failure'));
},
Expand Down
8 changes: 4 additions & 4 deletions test/lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ var common = module.exports = {
});
});
var origLogIf = server._logIf;
server.suppressExpecteErrMsgs = [];
server.suppressExpectedErrMsgs = [];
server._logIf = function logIfNotExpected(verbosity, message, conn) {
var expecteErrMsgs = server.suppressExpecteErrMsgs;
var expectedErrMsgs = server.suppressExpectedErrMsgs;
message = String(message).split(fixturesPath).join('fixture:/');
if ((expecteErrMsgs.length > 0) && (verbosity < LogLevels.LOG_INFO)) {
var expected = expecteErrMsgs.shift();
if ((expectedErrMsgs.length > 0) && (verbosity < LogLevels.LOG_INFO)) {
var expected = expectedErrMsgs.shift();
if (message === expected) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions test/mkd-rmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('MKD/RMD commands', function() {
});

it('should not create a duplicate directory', function(done) {
server.suppressExpecteErrMsgs.push(
server.suppressExpectedErrMsgs.push(
/^MKD \S+: Error: EEXIST/
);
client.raw('MKD', directory, function(error) {
Expand All @@ -42,7 +42,7 @@ describe('MKD/RMD commands', function() {
});

it('should not delete a non-existent directory', function(done) {
server.suppressExpecteErrMsgs.push(
server.suppressExpectedErrMsgs.push(
/^RMD \S+: Error: ENOENT/);
client.raw('RMD', directory, function(error) {
error.code.should.equal(550);
Expand Down
24 changes: 24 additions & 0 deletions test/normalize_test_logs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
# -*- coding: utf-8, tab-width: 2 -*-


function normalize_test_logs () {
export LANG{,UAGE}=en_US.UTF-8 # make error messages search engine-friendly
local SELFPATH="$(readlink -m "$BASH_SOURCE"/..)"

[ "$#" == 0 ] && tty --silent && echo "H: gonna read stdin. consider:" \
"npm test |& ./test/normalize_test_logs.sh | tee test.log" >&2

local MOD_DIR_RX="$(<<<"${SELFPATH%/*/*}" sed -re '
s~[^A-Za-z0-9_/]~\\&~g')"

sed -rf <(echo '
s~^\r~~
s~'"$MOD_DIR_RX"'/~/…/node_modules/~g
s~(^ +[0-9]+ passing +\()[0-9]+(ms\))~\1###\2~
') -- "$@"
return $?
}


normalize_test_logs "$@"; exit $?
6 changes: 3 additions & 3 deletions test/pass.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ describe('PASS command', function() {
client = new Client(options);
client.auth(options.user, badPass, function(error) {
error.code.should.eql(530);
client.raw.user(options.user, function(error, reply) {
client.raw('user', options.user, function(error, reply) {
reply.code.should.eql(331);
client.raw.pass(badPass, function(error) {
client.raw('pass', badPass, function(error) {
error.code.should.eql(530);
done();
});
Expand All @@ -35,7 +35,7 @@ describe('PASS command', function() {

it('should reject PASS without USER', function(done) {
client = new Client(options);
client.raw.pass(options.pass, function(error) {
client.raw('pass', options.pass, function(error) {
error.code.should.eql(503);
done();
});
Expand Down
6 changes: 3 additions & 3 deletions test/pwd.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('PWD command', function() {
});

it('should be "' + directory + '"', function(done) {
client.raw.pwd(function(error, reply) {
client.raw('pwd', function(error, reply) {
common.should.not.exist(error);
reply.code.should.equal(257);
reply.text.should.startWith('257 "' + directory + '"');
Expand All @@ -39,7 +39,7 @@ describe('PWD command', function() {
});

it('should reject parameters', function(done) {
client.raw.pwd(directory, function(error, reply) {
client.raw('pwd', directory, function(error, reply) {
error.code.should.equal(501);
reply.code.should.equal(501);
done();
Expand All @@ -64,7 +64,7 @@ describe('PWD command', function() {
});

it('should be "/"', function(done) {
client.raw.pwd(function(error, reply) {
client.raw('pwd', function(error, reply) {
common.should.not.exist(error);
reply.code.should.equal(257);
reply.text.should.startWith('257 "/"');
Expand Down
2 changes: 1 addition & 1 deletion test/tricky-paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('Tricky paths', function() {
async.waterfall([
function strangePathRedundantEscape(nxt) {
var dirRfcQuoted = dirPath.replace(/"/g, '""');
server.suppressExpecteErrMsgs.push(
server.suppressExpectedErrMsgs.push(
/^CWD [\S\s]+: Error: ENOENT/
);
client.raw('CWD', dirRfcQuoted, function(error) {
Expand Down
4 changes: 2 additions & 2 deletions test/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('USER command', function() {
client = new Client(options);
client.auth(options.user, options.pass, function(error) {
error.code.should.eql(530);
client.raw.user(options.user, function(error) {
client.raw('user', options.user, function(error) {
error.code.should.eql(530);
done();
});
Expand All @@ -37,7 +37,7 @@ describe('USER command', function() {
client = new Client(options);
client.auth(badUser, options.pass, function(error) {
error.code.should.eql(530);
client.raw.user(badUser, function(error) {
client.raw('user', badUser, function(error) {
error.code.should.eql(530);
done();
});
Expand Down