From e756aadbc23c2a14244d4f9b85c1a8e1273deb29 Mon Sep 17 00:00:00 2001 From: Joe Grace Date: Fri, 6 Oct 2017 10:15:52 -0700 Subject: [PATCH 1/2] test: change usage from common.fixturesDir to fixturesDir Now use the common.fixtures module directly to reference fixturesDir, bypassing common module. --- test/parallel/test-https-simple.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-https-simple.js b/test/parallel/test-https-simple.js index b79d1b943f355b..6233fa02f108e2 100644 --- a/test/parallel/test-https-simple.js +++ b/test/parallel/test-https-simple.js @@ -21,6 +21,7 @@ 'use strict'; const common = require('../common'); +const fixturesDir = require('../common/fixtures').fixturesDir; if (!common.hasCrypto) common.skip('missing crypto'); @@ -30,8 +31,8 @@ const https = require('https'); const fs = require('fs'); const options = { - key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`), - cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`) + key: fs.readFileSync(`${fixturesDir}/keys/agent1-key.pem`), + cert: fs.readFileSync(`${fixturesDir}/keys/agent1-cert.pem`) }; const tests = 2; From 5e3164da11014c504f3d5ca4b2b3f5add4d11de6 Mon Sep 17 00:00:00 2001 From: Joe Grace Date: Fri, 6 Oct 2017 12:21:42 -0700 Subject: [PATCH 2/2] test: simplify usage with fixtures.readKey() instead of fs.readFileSync(). Use fixtures.readKey() to read keys. Bypass usage of commons module for keys, and avoid hard-coding directories into keys access. Remove usage of fs module. [Courtesy "NodeJS Interactive 2017" Code & Learn 'first-time pull request' task.] --- test/parallel/test-https-simple.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-https-simple.js b/test/parallel/test-https-simple.js index 6233fa02f108e2..b6a7c692ebb5ae 100644 --- a/test/parallel/test-https-simple.js +++ b/test/parallel/test-https-simple.js @@ -21,18 +21,17 @@ 'use strict'; const common = require('../common'); -const fixturesDir = require('../common/fixtures').fixturesDir; +const fixtures = require('../common/fixtures'); if (!common.hasCrypto) common.skip('missing crypto'); const assert = require('assert'); const https = require('https'); -const fs = require('fs'); const options = { - key: fs.readFileSync(`${fixturesDir}/keys/agent1-key.pem`), - cert: fs.readFileSync(`${fixturesDir}/keys/agent1-cert.pem`) + key: fixtures.readKey('agent1-key.pem'), + cert: fixtures.readKey('agent1-cert.pem') }; const tests = 2;