From a767367123f8f9d385bf5dedd976f8f352b08ae3 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 22 Jun 2017 21:59:11 -0700 Subject: [PATCH] test: refactor test-tls-env-extra-ca * Use `common.mustCall()` to guarantee callback invocations * Order modules according to test writing guide PR-URL: https://github.com/nodejs/node/pull/13886 Reviewed-By: Yuta Hiroto Reviewed-By: Benjamin Gruenbaum Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Richard Lau --- test/parallel/test-tls-env-extra-ca.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-tls-env-extra-ca.js b/test/parallel/test-tls-env-extra-ca.js index 4580f1579f6213..e2de272184e5f4 100644 --- a/test/parallel/test-tls-env-extra-ca.js +++ b/test/parallel/test-tls-env-extra-ca.js @@ -9,18 +9,19 @@ if (!common.hasCrypto) { } const assert = require('assert'); +const fs = require('fs'); const tls = require('tls'); + const fork = require('child_process').fork; -const fs = require('fs'); if (process.env.CHILD) { const copts = { port: process.env.PORT, - checkServerIdentity: common.noop, + checkServerIdentity: common.mustCall(), }; - const client = tls.connect(copts, function() { + const client = tls.connect(copts, common.mustCall(function() { client.end('hi'); - }); + })); return; } @@ -29,10 +30,10 @@ const options = { cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`), }; -const server = tls.createServer(options, function(s) { +const server = tls.createServer(options, common.mustCall(function(s) { s.end('bye'); server.close(); -}).listen(0, common.mustCall(function() { +})).listen(0, common.mustCall(function() { const env = { CHILD: 'yes', PORT: this.address().port,