diff --git a/.eslintrc.yml b/.eslintrc.yml index 5205ef8ab..f813cf5a0 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -21,5 +21,8 @@ semi-spacing: 2 strict: 2 no-var: 2 + prefer-template: 2 + template-curly-spacing: 2 + no-template-curly-in-string: 2 extends: eslint:recommended diff --git a/bin/citgm-all.js b/bin/citgm-all.js index ffe138664..57c2935ec 100755 --- a/bin/citgm-all.js +++ b/bin/citgm-all.js @@ -77,12 +77,12 @@ const options = { }; if (options.includeTags.length){ - log.info('includeTags', 'Only running tests matching these tags: ' - + app.includeTags); + log.info('includeTags', `Only running tests matching these tags: ${ + app.includeTags}`); } if (options.excludeTags.length){ - log.info('excludeTags', 'Not running tests matching these tags: ' - + app.excludeTags); + log.info('excludeTags', `Not running tests matching these tags: ${ + app.excludeTags}`); } const lookup = getLookup(options); @@ -94,7 +94,7 @@ if (!lookup) { const cpus = os.cpus().length; if (app.autoParallel || (app.parallel && app.parallel > cpus)) { app.parallel = cpus; - log.info('cores', 'running tests using ' + app.parallel + ' cores'); + log.info('cores', `running tests using ${app.parallel} cores`); } if (app.parallel && ((app.parallel + 1) > process.getMaxListeners())) { process.setMaxListeners(app.parallel + 1); @@ -153,13 +153,13 @@ function runCitgm (mod, name, next) { log[type](key, message); }).on('end', function(result) { result.duration = new Date() - start; - log.info('duration', 'test duration: ' + result.duration + 'ms'); + log.info('duration', `test duration: ${result.duration}ms`); if (result.error) { - log.error(result.name + ' done', 'done - the test suite for ' + - result.name + ' version ' + result.version + ' failed'); + log.error(`${result.name} done`, `done - the test suite for ${ + result.name} version ${result.version} failed`); } else { - log.info(result.name + ' done', 'done - the test suite for ' + result.name - + ' version ' + result.version + ' passed.'); + log.info(`${result.name} done`, `done - the test suite for ${result.name + } version ${result.version} passed.`); } modules.push(result); if (!bailed) { diff --git a/bin/citgm.js b/bin/citgm.js index c74bc268a..ba4e96458 100755 --- a/bin/citgm.js +++ b/bin/citgm.js @@ -87,7 +87,7 @@ function launch(mod, options) { module.duration = new Date() - start; reporter.logger(log, module); - log.info('duration', 'test duration: ' + module.duration + 'ms'); + log.info('duration', `test duration: ${module.duration}ms`); if (app.markdown) { reporter.markdown(log.bypass, module); } diff --git a/lib/citgm.js b/lib/citgm.js index 352a90c51..ca6958a09 100644 --- a/lib/citgm.js +++ b/lib/citgm.js @@ -35,7 +35,7 @@ function findNode(context, next) { next(err); return; } - context.emit('data', 'verbose', context.module.name + ' using-node', + context.emit('data', 'verbose', `${context.module.name} using-node`, resolved); next(null, context); }); @@ -59,13 +59,13 @@ function init(context, next) { // Single module that citgm is testing. if (!windows) { if (context.options.uid) - context.emit('data', 'verbose', context.module.name + ' using-uid', + context.emit('data', 'verbose', `${context.module.name} using-uid`, context.options.uid); if (context.options.gid) - context.emit('data', 'verbose', context.module.name + ' using-gid', + context.emit('data', 'verbose', `${context.module.name} using-gid`, context.options.gid); } - context.emit('data', 'silly', context.module.name + ' init-detail', + context.emit('data', 'silly', `${context.module.name} init-detail`, context.module); next(null, context); // Inject the context } @@ -137,10 +137,10 @@ Tester.prototype.run = function() { payload.error = 'this module should have failed'; } if (this.testOutput !== '') { - payload.testOutput += this.testOutput.toString() + '\n'; + payload.testOutput += `${this.testOutput.toString()}\n`; } if (this.testError !== '') { - payload.testOutput += this.testError.toString() + '\n'; + payload.testOutput += `${this.testError.toString()}\n`; } tempDirectory.remove(this, () => { this.emit('end', payload); diff --git a/lib/grab-module-data.js b/lib/grab-module-data.js index 1e52bfe75..7a96b6132 100644 --- a/lib/grab-module-data.js +++ b/lib/grab-module-data.js @@ -21,7 +21,7 @@ function grabModuleData(context, next) { }); proc.on('close', function(code) { if (code > 0) { - context.emit('data', 'silly', context.module.name + ' npm-view', + context.emit('data', 'silly', `${context.module.name} npm-view`, 'No npm package information available'); if (context.module.type === 'git' && context.module.hosted.type === 'github') { @@ -35,7 +35,7 @@ function grabModuleData(context, next) { next(null, context); return; } - context.emit('data', 'silly', context.module.name + ' npm-view', + context.emit('data', 'silly', `${context.module.name} npm-view`, 'Data retrieved'); try { context.meta = JSON.parse(data); diff --git a/lib/grab-project.js b/lib/grab-project.js index a768e791f..9781f2d56 100644 --- a/lib/grab-project.js +++ b/lib/grab-project.js @@ -6,7 +6,7 @@ const spawn = require('./spawn'); function grabProject(context, next) { if (context.meta) - context.emit('data', 'silly', context.module.name + ' package-meta', + context.emit('data', 'silly', `${context.module.name} package-meta`, context.meta); let packageName = context.module.raw; if (context.module.type === 'directory') { @@ -14,8 +14,8 @@ function grabProject(context, next) { packageName = path.resolve(process.cwd(), packageName); } let bailed = false; - context.emit('data', 'info', context.module.name + ' npm:', - 'Downloading project: ' + packageName); + context.emit('data', 'info', `${context.module.name} npm:`, + `Downloading project: ${packageName}`); let options = createOptions(context.path, context); options.stdio = ['ignore', 'pipe', 'ignore']; const proc = spawn('npm', ['pack', packageName], options); @@ -29,7 +29,7 @@ function grabProject(context, next) { function cleanup() { clearTimeout(timeout); bailed = true; - context.emit('data', 'error', context.module.name + ' npm:', + context.emit('data', 'error', `${context.module.name} npm:`, 'Download Timed Out'); proc.kill(); return next(Error('Download Timed Out')); @@ -59,8 +59,8 @@ function grabProject(context, next) { if (filename === '') { return next(Error('No project downloaded')); } - context.emit('data', 'info', context.module.name + ' npm:', - 'Project downloaded ' + filename); + context.emit('data', 'info', `${context.module.name} npm:`, + `Project downloaded ${filename}`); context.unpack = path.join(context.path, filename); return next(null, context); }); diff --git a/lib/lookup.js b/lib/lookup.js index 35a2ea431..924e30888 100644 --- a/lib/lookup.js +++ b/lib/lookup.js @@ -102,13 +102,13 @@ function resolve(context, next) { meta['dist-tags'], rep.master ? null : rep.prefix, context.options.sha || rep.sha || gitHead); - context.emit('data', 'info', context.module.name + - ' lookup-replace', url); + context.emit('data', 'info', `${context.module.name + } lookup-replace`, url); context.module.raw = url; } if (rep.install) { - context.emit('data', 'verbose', context.module.name + - ' lookup-install', rep.install); + context.emit('data', 'verbose', `${context.module.name + } lookup-install`, rep.install); context.module.install = rep.install; } if (rep.tags) { diff --git a/lib/match-conditions.js b/lib/match-conditions.js index 4a50a74c2..09f3ac235 100644 --- a/lib/match-conditions.js +++ b/lib/match-conditions.js @@ -6,9 +6,9 @@ const semver = require('semver'); // Mocked in tests let version = process.version; -let semVersion = semver.major(process.version) + '.' + - semver.minor(process.version) + '.' + - semver.patch(process.version); +let semVersion = `${semver.major(process.version)}.${ + semver.minor(process.version)}.${ + semver.patch(process.version)}`; let platform = process.platform; let arch = process.arch; let distro = ''; diff --git a/lib/out.js b/lib/out.js index 9b92fcf6e..4a1e9ed16 100644 --- a/lib/out.js +++ b/lib/out.js @@ -67,7 +67,7 @@ module.exports = function(options) { output(tag, message, logger.error); }, bypass: function(messgage) { - process.stdout.write(messgage + '\n'); + process.stdout.write(`${messgage}\n`); } }; }; diff --git a/lib/package-manager/install.js b/lib/package-manager/install.js index 010a1c3bd..e32403aca 100644 --- a/lib/package-manager/install.js +++ b/lib/package-manager/install.js @@ -12,13 +12,13 @@ function install(packageManager, context, next) { createOptions( path.join(context.path, context.module.name), context); let args = ['install']; - context.emit('data', 'info', context.module.name + ' ' + packageManager + - ':', - packageManager + ' install started'); + context.emit('data', 'info', `${context.module.name} ${packageManager + }:`, + `${packageManager} install started`); - context.emit('data', 'verbose', context.module.name + ' ' + packageManager + - ':', - 'Using temp directory: "' + options.env['npm_config_tmp'] + '"'); + context.emit('data', 'verbose', `${context.module.name} ${packageManager + }:`, + `Using temp directory: "${options.env['npm_config_tmp']}"`); if (context.module.install) { args = args.concat(context.module.install); @@ -29,7 +29,7 @@ function install(packageManager, context, next) { : context.yarnPath; const binDirectory = path.dirname(packageManagerBin); - options.env.PATH = binDirectory + ':' + process.env.PATH; + options.env.PATH = `${binDirectory}:${process.env.PATH}`; const proc = spawn(packageManagerBin, args, options); const finish = timeout(context, proc, next, 'Install'); @@ -40,8 +40,8 @@ function install(packageManager, context, next) { chunk = stripAnsi(chunk.toString()); chunk = chunk.replace(/\r/g, '\n'); } - context.emit('data', 'warn', context.module.name + - ' ' + packageManager + '-install:', + context.emit('data', 'warn', `${context.module.name + } ${packageManager}-install:`, chunk.toString()); }); @@ -51,8 +51,8 @@ function install(packageManager, context, next) { chunk = stripAnsi(chunk.toString()); chunk = chunk.replace(/\r/g, '\n'); } - context.emit('data', 'verbose', context.module.name + - ' ' + packageManager + '-install:', + context.emit('data', 'verbose', `${context.module.name + } ${packageManager}-install:`, chunk.toString()); }); @@ -64,9 +64,9 @@ function install(packageManager, context, next) { if (code > 0) { return finish(Error('Install Failed')); } - context.emit('data', 'info', context.module.name + ' ' + - packageManager + ':', - packageManager + ' install successfully completed'); + context.emit('data', 'info', `${context.module.name} ${ + packageManager}:`, + `${packageManager} install successfully completed`); return finish(null, context); }); } diff --git a/lib/package-manager/test.js b/lib/package-manager/test.js index 719707465..142077f86 100644 --- a/lib/package-manager/test.js +++ b/lib/package-manager/test.js @@ -15,14 +15,14 @@ function authorName(author) { if (typeof author === 'string') return author; let parts = []; if (author.name) parts.push(author.name); - if (author.email) parts.push('<' + author.email + '>'); - if (author.url) parts.push('(' + author.url + ')'); + if (author.email) parts.push(`<${author.email}>`); + if (author.url) parts.push(`(${author.url})`); return parts.join(' '); } function test(packageManager, context, next) { const wd = path.join(context.path, context.module.name); - context.emit('data', 'info', context.module.name + ' ' + packageManager + ':', + context.emit('data', 'info', `${context.module.name} ${packageManager}:`, 'test suite started'); readPackage(path.join(wd, 'package.json'), false, function(err, data) { if (err) { @@ -32,18 +32,18 @@ function test(packageManager, context, next) { if (data.scripts === undefined || data.scripts.test === undefined) { if (data.author) { - context.emit('data', 'warn', context.module.name + ' notice', - 'Please contact the module developer to request adding ' + - packageManager + '' + ' test support: ' + authorName(data.author)); + context.emit('data', 'warn', `${context.module.name} notice`, + `Please contact the module developer to request adding ${ + packageManager}` + ` test support: ${authorName(data.author)}`); } - next(new Error('Module does not support ' + packageManager + '-test!')); + next(new Error(`Module does not support ${packageManager}-test!`)); return; } const options = createOptions(wd, context); let nodeBin = 'node'; if (context.options.testPath) { - options.env.PATH = context.options.testPath + ':' + process.env.PATH; + options.env.PATH = `${context.options.testPath}:${process.env.PATH}`; nodeBin = which(nodeBinName, {path: options.env.PATH || process.env.PATH}); } @@ -53,7 +53,7 @@ function test(packageManager, context, next) { : context.yarnPath; const binDirectory = path.dirname(packageManagerBin); - options.env.PATH = binDirectory + ':' + process.env.PATH; + options.env.PATH = `${binDirectory}:${process.env.PATH}`; /* Run `npm/yarn test`, or `/path/to/customTest.js` if the customTest option was passed */ @@ -69,12 +69,12 @@ function test(packageManager, context, next) { data = stripAnsi(data.toString()); data = data.replace(/\r/g, '\n'); } - context.emit('data', 'verbose', context.module.name + ' npm-test:', + context.emit('data', 'verbose', `${context.module.name} npm-test:`, data.toString()); }); proc.stderr.on('data', function (data) { context.testError.append(data); - context.emit('data', 'verbose', context.module.name + ' npm-test:', + context.emit('data', 'verbose', `${context.module.name} npm-test:`, data.toString()); }); proc.on('error', function() { diff --git a/lib/reporter/junit.js b/lib/reporter/junit.js index 3b08d811f..eea520f8b 100644 --- a/lib/reporter/junit.js +++ b/lib/reporter/junit.js @@ -9,7 +9,7 @@ const util = require('./util'); function generateTest(xml, mod) { const output =util.sanitizeOutput(mod.testOutput, '', true); const item = xml.ele('testcase'); - item.att('name', [mod.name, 'v' + mod.version].join('-')); + item.att('name', [mod.name, `v${mod.version}`].join('-')); item.att('time', mod.duration / 1000); item.ele('system-out').dat(output); if (mod.skip || (mod.flaky && mod.error)) { @@ -37,9 +37,9 @@ function junit(logger, modules, append) { const payload = generateJunit(modules); if (typeof logger === 'string') { if (append){ - fs.appendFileSync(logger, payload + '\n'); + fs.appendFileSync(logger, `${payload}\n`); } else { - fs.writeFileSync(logger, payload + '\n'); + fs.writeFileSync(logger, `${payload}\n`); } } else { logger(payload); diff --git a/lib/reporter/markdown.js b/lib/reporter/markdown.js index 8774a85fe..ae4d63d35 100644 --- a/lib/reporter/markdown.js +++ b/lib/reporter/markdown.js @@ -5,12 +5,12 @@ const util = require('./util'); function printModulesMarkdown(logger, title, modules) { if (modules.length > 0) { - logger('### ' + title + ' Modules'); + logger(`### ${title} Modules`); _.each(modules, function (mod) { - logger(' * ' + mod.name + ' v' + mod.version + ' duration:' + - mod.duration + 'ms'); + logger(` * ${mod.name} v${mod.version} duration:${ + mod.duration}ms`); if (mod.error) { - logger(' - ' + mod.error.message); + logger(` - ${mod.error.message}`); } if (mod.error && mod.testOutput) { logger(util.sanitizeOutput(mod.testOutput, ' - ')); diff --git a/lib/reporter/tap.js b/lib/reporter/tap.js index b043e1336..906766d45 100644 --- a/lib/reporter/tap.js +++ b/lib/reporter/tap.js @@ -12,16 +12,16 @@ function generateTest(mod, count) { mod.error = mod.error.message; } const error = mod.error ? [directive, mod.error].join(' ') : ''; - const duration = '\n duration_ms: ' + mod.duration; - const output = mod.testOutput ? '\n' + util.sanitizeOutput(mod.testOutput, - ' #') : ''; - return [result, count + 1, '-', mod.name, 'v' + mod.version + error + - '\n ---' + output + duration + '\n ...'].join(' '); + const duration = `\n duration_ms: ${mod.duration}`; + const output = mod.testOutput ? `\n${util.sanitizeOutput(mod.testOutput, + ' #')}` : ''; + return [result, count + 1, '-', mod.name, `v${mod.version}${error + }\n ---${output}${duration}\n ...`].join(' '); } function generateTap(modules) { const modulesTap = _.map(modules, generateTest).join('\n'); - return 'TAP version 13\n' + modulesTap + '\n1..' + modules.length; + return `TAP version 13\n${modulesTap}\n1..${modules.length}`; } function tap(logger, modules, append) { @@ -31,9 +31,9 @@ function tap(logger, modules, append) { const payload = generateTap(modules); if (typeof logger === 'string') { if (append){ - fs.appendFileSync(logger, payload + '\n'); + fs.appendFileSync(logger, `${payload}\n`); } else { - fs.writeFileSync(logger, payload + '\n'); + fs.writeFileSync(logger, `${payload}\n`); } } else { logger(payload); diff --git a/lib/reporter/util.js b/lib/reporter/util.js index b59beda1f..bb90fe368 100644 --- a/lib/reporter/util.js +++ b/lib/reporter/util.js @@ -42,7 +42,7 @@ function sanitizeOutput(output, delimiter, xml) { if (!output || output === '') return ''; /* eslint-disable no-control-regex */ // ([valid-range])|. matches anything but only captures valid-range - const validUtf8 = new RegExp('(' + [ + const validUtf8 = new RegExp(`(${[ /[\x09\x0A\x0D\x20-\x7E]/, // ASCII /[\xC2-\xDF][\x80-\xBF]/, // Non-overlong 2-byte /\xE0[\xA0-\xBF][\x80-\xBF]/, // Excluding overlongs @@ -53,7 +53,7 @@ function sanitizeOutput(output, delimiter, xml) { /\xF4[\x80-\x8F][\x80-\xBF]{2}/ // Plane 16 ].map(function(r) { return r.source; - }).join('|') + ')|.', 'g'); + }).join('|')})|.`, 'g'); /* eslint-enable no-control-regex */ // $1 matches the valid-range char if captured, or '' otherwise // So this removes all invalid UTF-8 diff --git a/lib/temp-directory.js b/lib/temp-directory.js index 36c08430b..40a942a73 100644 --- a/lib/temp-directory.js +++ b/lib/temp-directory.js @@ -12,7 +12,7 @@ function create(context, next) { } else { context.path = path.join(osenv.tmpdir(), uuid.v4()); } - context.emit('data', 'verbose', context.module.name + ' mk.tempdir', + context.emit('data', 'verbose', `${context.module.name} mk.tempdir`, context.path); context.npmConfigTmp = path.join(context.path, 'npm_config_tmp'); @@ -29,7 +29,7 @@ function remove(context, next) { if (!context.path) { return next(null, context); } - context.emit('data', 'silly', context.module.name + ' rm.tempdir', + context.emit('data', 'silly', `${context.module.name} rm.tempdir`, context.path); rimraf(context.path, function(err) { return next(err, context); diff --git a/lib/timeout.js b/lib/timeout.js index aab628b18..efb431cf2 100644 --- a/lib/timeout.js +++ b/lib/timeout.js @@ -12,7 +12,7 @@ function timeout(context, proc, next, step) { function finish(err, ret, timedOut) { if (hasRun) { - context.emit('data', 'info', context.module.name + ' npm:', + context.emit('data', 'info', `${context.module.name} npm:`, `${step} timeout.finish called more then once`); return; } @@ -21,7 +21,7 @@ function timeout(context, proc, next, step) { clearTimeout(timeout); if (timedOut) { context.module.flaky = true; - context.emit('data', 'error', context.module.name + ' npm:', + context.emit('data', 'error', `${context.module.name} npm:`, `npm-${step.toLowerCase()} Timed Out`); proc.kill(); err = new Error(`${step} Timed Out`); diff --git a/lib/unpack.js b/lib/unpack.js index 3a7b8fde1..599a2fccf 100644 --- a/lib/unpack.js +++ b/lib/unpack.js @@ -15,8 +15,8 @@ function unpack(context, next) { if (err) { return next(err); } - context.emit('data', 'silly', context.module.name + - ' gzip-unpack-start', context.unpack); + context.emit('data', 'silly', `${context.module.name + } gzip-unpack-start`, context.unpack); const gzip = zlib.createGunzip(); const inp = fs.createReadStream(context.unpack); const out = tar.extract({ @@ -25,8 +25,8 @@ function unpack(context, next) { }); const res = inp.pipe(gzip).pipe(out); res.on('close', function() { - context.emit('data', 'silly', context.module.name + - ' gzip-unpack-close', context.unpack); + context.emit('data', 'silly', `${context.module.name + } gzip-unpack-close`, context.unpack); return next(null, context); }); res.on('error', function(err) { diff --git a/test/npm/test-npm-install.js b/test/npm/test-npm-install.js index d93cd46c9..fd420cce6 100644 --- a/test/npm/test-npm-install.js +++ b/test/npm/test-npm-install.js @@ -12,7 +12,7 @@ const packageManager = require('../../lib/package-manager'); const packageManagerInstall = require('../../lib/package-manager/install'); const makeContext = require('../helpers/make-context'); -const sandbox = path.join(os.tmpdir(), 'citgm-' + Date.now()); +const sandbox = path.join(os.tmpdir(), `citgm-${Date.now()}`); const fixtures = path.join(__dirname, '..', 'fixtures'); const moduleFixtures = path.join(fixtures, 'omg-i-pass'); const moduleTemp = path.join(sandbox, 'omg-i-pass'); diff --git a/test/npm/test-npm-test.js b/test/npm/test-npm-test.js index 867150ce5..77ef1a45d 100644 --- a/test/npm/test-npm-test.js +++ b/test/npm/test-npm-test.js @@ -13,7 +13,7 @@ const makeContext = require('../helpers/make-context'); const packageManager = require('../../lib/package-manager'); const packageManagerTest = rewire('../../lib/package-manager/test'); -const sandbox = path.join(os.tmpdir(), 'citgm-' + Date.now()); +const sandbox = path.join(os.tmpdir(), `citgm-${Date.now()}`); const fixtures = path.join(__dirname, '..', 'fixtures'); const passFixtures = path.join(fixtures, 'omg-i-pass'); diff --git a/test/reporter/test-reporter-junit.js b/test/reporter/test-reporter-junit.js index 50f50f23e..0553261c1 100644 --- a/test/reporter/test-reporter-junit.js +++ b/test/reporter/test-reporter-junit.js @@ -13,7 +13,7 @@ const junit = require('../../lib/reporter/junit'); const fixtures = require('../fixtures/reporter-fixtures'); const fixturesPath = path.join(__dirname, '..', 'fixtures'); -const sandbox = path.join(os.tmpdir(), 'citgm-' + Date.now()); +const sandbox = path.join(os.tmpdir(), `citgm-${Date.now()}`); const outputFile = path.join(sandbox, 'test.xml'); const outputFileAppend = path.join(sandbox, 'test-append.xml'); diff --git a/test/reporter/test-reporter-tap.js b/test/reporter/test-reporter-tap.js index 7fc76f628..2c3c9cbe9 100644 --- a/test/reporter/test-reporter-tap.js +++ b/test/reporter/test-reporter-tap.js @@ -14,7 +14,7 @@ const tap = require('../../lib/reporter/tap'); const fixtures = require('../fixtures/reporter-fixtures'); const fixturesPath = path.join(__dirname, '..', 'fixtures'); -const sandbox = path.join(os.tmpdir(), 'citgm-' + Date.now()); +const sandbox = path.join(os.tmpdir(), `citgm-${Date.now()}`); const outputFile = path.join(sandbox, 'test.tap'); const outputFileAppend = path.join(sandbox, 'test-append.tap'); const outputFileAppendBlank = path.join(sandbox, 'test-append-blank.tap'); diff --git a/test/test-grab-project.js b/test/test-grab-project.js index f6689570b..ae1abda9a 100644 --- a/test/test-grab-project.js +++ b/test/test-grab-project.js @@ -13,7 +13,7 @@ const rimraf = require('rimraf'); const grabProject = require('../lib/grab-project'); -const sandbox = path.join(os.tmpdir(), 'citgm-' + Date.now()); +const sandbox = path.join(os.tmpdir(), `citgm-${Date.now()}`); const fixtures = path.join(__dirname, 'fixtures'); test('grab-project: setup', function (t) { diff --git a/test/test-lookup.js b/test/test-lookup.js index e92613185..3a737098d 100644 --- a/test/test-lookup.js +++ b/test/test-lookup.js @@ -19,26 +19,26 @@ test('lookup: makeUrl', function (t) { const sha = 'abc123'; - let expected = repo + '/archive/master.tar.gz'; + let expected = `${repo}/archive/master.tar.gz`; let url = makeUrl(repo); t.equal(url, expected, 'by default makeUrl should give a link to master'); - expected = repo + '/archive/' + tags.latest + '.tar.gz'; + expected = `${repo}/archive/${tags.latest}.tar.gz`; url = makeUrl(repo, 'latest', tags); t.equal(url, expected, 'if given a spec and tags it should give a link to associated version'); - expected = repo + '/archive/' + '1.0.0' + '.tar.gz'; + expected = `${repo}/archive/` + '1.0.0' + '.tar.gz'; url = makeUrl(repo, '1.0.0', tags); t.equal(url, expected, 'given a spec which is not an npm tag we should assume a Github tag'); - expected = repo + '/archive/' + prefix + tags.latest + '.tar.gz'; + expected = `${repo}/archive/${prefix}${tags.latest}.tar.gz`; url = makeUrl(repo, 'latest', tags, prefix); t.equal(url, expected, 'if given a prefix it should be included in the filename'); - expected = repo + '/archive/' + sha + '.tar.gz'; + expected = `${repo}/archive/${sha}.tar.gz`; url = makeUrl(repo, 'latest', tags, prefix, sha); t.equal(url, expected, 'if given sha, it should be used to create download URL'); diff --git a/test/test-timeout.js b/test/test-timeout.js index 80114ef55..2da7b6644 100644 --- a/test/test-timeout.js +++ b/test/test-timeout.js @@ -8,7 +8,7 @@ const rewire = require('rewire'); const packageManager = require('../lib/package-manager'); const timeout = rewire('../lib/timeout'); const makeContext = require('./helpers/make-context'); -const sandbox = path.join(os.tmpdir(), 'citgm-' + Date.now()); +const sandbox = path.join(os.tmpdir(), `citgm-${Date.now()}`); let packageManagers; diff --git a/test/yarn/test-yarn-install.js b/test/yarn/test-yarn-install.js index d7d07e573..66e95bcb8 100644 --- a/test/yarn/test-yarn-install.js +++ b/test/yarn/test-yarn-install.js @@ -12,7 +12,7 @@ const packageManager = require('../../lib/package-manager'); const packageManagerInstall = require('../../lib/package-manager/install'); const makeContext = require('../helpers/make-context'); -const sandbox = path.join(os.tmpdir(), 'citgm-' + Date.now()); +const sandbox = path.join(os.tmpdir(), `citgm-${Date.now()}`); const fixtures = path.join(__dirname, '..', 'fixtures'); const moduleFixtures = path.join(fixtures, 'omg-i-pass'); const moduleTemp = path.join(sandbox, 'omg-i-pass'); diff --git a/test/yarn/test-yarn-test.js b/test/yarn/test-yarn-test.js index 154f1f387..5d2fe7198 100644 --- a/test/yarn/test-yarn-test.js +++ b/test/yarn/test-yarn-test.js @@ -13,7 +13,7 @@ const makeContext = require('../helpers/make-context'); const packageManager = require('../../lib/package-manager'); const packageManagerTest = rewire('../../lib/package-manager/test'); -const sandbox = path.join(os.tmpdir(), 'citgm-' + Date.now()); +const sandbox = path.join(os.tmpdir(), `citgm-${Date.now()}`); const fixtures = path.join(__dirname, '..', 'fixtures'); const passFixtures = path.join(fixtures, 'omg-i-pass');