diff --git a/lib/classes/validation.js b/lib/classes/validation.js index de24fbe..bc52819 100644 --- a/lib/classes/validation.js +++ b/lib/classes/validation.js @@ -131,7 +131,7 @@ class validation { errors.push(new Error(scope.messages.port)); if (opts.ports) { - result = scope.patterns.ports.match(opts.ports).join(","); + result = opts.ports.match(scope.patterns.ports).join(","); if (result == "") return cb(scope.messages.port); } diff --git a/test/discover.js b/test/discover.js index e4543c9..3e5b023 100644 --- a/test/discover.js +++ b/test/discover.js @@ -7,20 +7,20 @@ 'use strict' const nmap = require('../'); -const timeout = 1024 * 1024; +const timeout = 1024 * 1024 * 3; const chai = require('chai'); const should = chai.should(); const expect = chai.expect; const ifaces = require('os').networkInterfaces(); -describe('nmap', function() { - context('discovery method', function() { +describe('nmap', function () { + context('discovery method', function () { this.timeout(timeout); - it('validate report', function(done) { + it('validate report', function (done) { - nmap.discover(function(err, report) { + nmap.discover(function (err, report) { /* If 'subnet' doesn't exist in os.networkInterfaces() expect errors */ for (let adapter in ifaces) { @@ -28,14 +28,17 @@ describe('nmap', function() { if (!ifaces[adapter][0].hasOwnProperty('subnet')) { try { done(); - } catch(error) { + } + catch (error) { done(error); } - } else { + } + else { try { should.not.exist(err); should.exist(report); - } catch(error) { + } + catch (error) { done(error); } } diff --git a/test/scan.js b/test/scan.js index 51003a5..baae466 100644 --- a/test/scan.js +++ b/test/scan.js @@ -7,7 +7,7 @@ 'use strict' const nmap = require('../'); -const timeout = 1024 * 1024; +const timeout = 1024 * 1024 * 3; const chai = require('chai'); const should = chai.should(); const expect = chai.expect; @@ -21,13 +21,13 @@ const opts = { }; -describe('scan method', function() { +describe('scan method', function () { - context('reporting', function() { - it('json', function(done) { + context('reporting', function () { + it('json', function (done) { this.timeout(timeout); - nmap.scan(opts, function(err, report) { + nmap.scan(opts, function (err, report) { should.not.exist(err); report.should.be.a('object'); @@ -35,11 +35,11 @@ describe('scan method', function() { }); }); - it('xml', function(done) { + it('xml', function (done) { this.timeout(timeout); opts.json = false; - nmap.scan(opts, function(err, report) { + nmap.scan(opts, function (err, report) { should.not.exist(err); report.should.be.a('object');