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

test: swap var->const/let and equal->strictEqual #9888

Closed
wants to merge 1 commit into from
Closed
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
30 changes: 15 additions & 15 deletions test/parallel/test-tls-no-sslv3.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
'use strict';
var common = require('../common');
var assert = require('assert');
const common = require('../common');
const assert = require('assert');
Copy link
Member

@lpinca lpinca Dec 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: can you please remove this require after the hasCrypto check?

Edit: we can actually move all the requires with the exception of common after the opensslCli check.


if (!common.hasCrypto) {
common.skip('missing crypto');
return;
}
var tls = require('tls');
const tls = require('tls');

var fs = require('fs');
var spawn = require('child_process').spawn;
const fs = require('fs');
const spawn = require('child_process').spawn;

if (common.opensslCli === false) {
common.skip('node compiled without OpenSSL CLI.');
return;
}

var cert = fs.readFileSync(common.fixturesDir + '/test_cert.pem');
var key = fs.readFileSync(common.fixturesDir + '/test_key.pem');
var server = tls.createServer({ cert: cert, key: key }, common.fail);
var errors = [];
var stderr = '';
const cert = fs.readFileSync(common.fixturesDir + '/test_cert.pem');
const key = fs.readFileSync(common.fixturesDir + '/test_key.pem');
const server = tls.createServer({ cert: cert, key: key }, common.fail);
const errors = [];
let stderr = '';

server.listen(0, '127.0.0.1', function() {
var address = this.address().address + ':' + this.address().port;
var args = ['s_client',
const address = this.address().address + ':' + this.address().port;
const args = ['s_client',
'-ssl3',
'-connect', address];

// for the performance and stability issue in s_client on Windows
if (common.isWindows)
args.push('-no_rand_screen');

var client = spawn(common.opensslCli, args, { stdio: 'pipe' });
const client = spawn(common.opensslCli, args, { stdio: 'pipe' });
client.stdout.pipe(process.stdout);
client.stderr.pipe(process.stderr);
client.stderr.setEncoding('utf8');
client.stderr.on('data', (data) => stderr += data);

client.once('exit', common.mustCall(function(exitCode) {
assert.equal(exitCode, 1);
assert.strictEqual(exitCode, 1);
server.close();
}));
});
Expand All @@ -50,7 +50,7 @@ process.on('exit', function() {
if (/unknown option -ssl3/.test(stderr)) {
common.skip('`openssl s_client -ssl3` not supported.');
} else {
assert.equal(errors.length, 1);
assert.strictEqual(errors.length, 1);
assert(/:wrong version number/.test(errors[0].message));
}
});