mirror of
https://github.com/nodejs/node.git
synced 2024-11-30 23:43:09 +01:00
f29762f4dd
Enable linting for the test directory. A number of changes was made so all tests conform the current rules used by lib and src directories. The only exception for tests is that unreachable (dead) code is allowed. test-fs-non-number-arguments-throw had to be excluded from the changes because of a weird issue on Windows CI. PR-URL: https://github.com/nodejs/io.js/pull/1721 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
27 lines
808 B
JavaScript
27 lines
808 B
JavaScript
'use strict';
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
|
|
if (!common.hasCrypto) {
|
|
console.log('1..0 # Skipped: missing crypto');
|
|
process.exit();
|
|
}
|
|
var tls = require('tls');
|
|
|
|
var fs = require('fs');
|
|
|
|
var key = fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem');
|
|
var cert = fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem');
|
|
|
|
tls.createServer({ key: key, cert: cert }, function(conn) {
|
|
conn.end();
|
|
this.close();
|
|
}).listen(common.PORT, function() {
|
|
var options = { port: this.address().port, rejectUnauthorized: true };
|
|
tls.connect(options).on('error', common.mustCall(function(err) {
|
|
assert.equal(err.code, 'UNABLE_TO_VERIFY_LEAF_SIGNATURE');
|
|
assert.equal(err.message, 'unable to verify the first certificate');
|
|
this.destroy();
|
|
}));
|
|
});
|