-
-
Notifications
You must be signed in to change notification settings - Fork 156
chore: use template strings #611
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is pretty ugly... I can clean it up manually if you reject #612. If that is accepted, prettier deals with it
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what does it look like when prettier is applied?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Diff in this file after applying prettier on top of it: Detailsdiff --git c/bin/citgm-all.js w/bin/citgm-all.js
index 0582670..f68433b 100755
--- c/bin/citgm-all.js
+++ w/bin/citgm-all.js
@@ -39,11 +39,13 @@ const yargs = commonArgs(require('yargs'))
type: 'array',
description: 'Define which tags from the lookup to skip'
})
- .example('citgm-all -t /path/to/output.tap',
- 'Write test results as tap to file.')
+ .example(
+ 'citgm-all -t /path/to/output.tap',
+ 'Write test results as tap to file.'
+ )
.example('citgm-all -l /path/to/lookup.json', 'Test a custom set of modules.')
.example('citgm-all --includeTags express', 'Only test express.')
- .example('citgm-all --excludeTags native', 'Don\'t test native modules.');
+ .example('citgm-all --excludeTags native', "Don't test native modules.");
const app = yargs.argv;
@@ -56,7 +58,7 @@ update(log);
if (!app.su) {
require('root-check')(); // Silently downgrade if running as root...
- // Unless --su is passed
+ // Unless --su is passed
} else {
log.warn('root', 'Running as root! Use caution!');
}
@@ -75,13 +77,17 @@ const options = {
excludeTags: app.excludeTags || []
};
-if (options.includeTags.length){
- log.info('includeTags', `Only running tests matching these tags: ${
- app.includeTags}`);
+if (options.includeTags.length) {
+ 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}`);
+if (options.excludeTags.length) {
+ log.info(
+ 'excludeTags',
+ `Not running tests matching these tags: ${app.excludeTags}`
+ );
}
const lookup = getLookup(options);
@@ -95,7 +101,7 @@ if (app.autoParallel || (app.parallel && app.parallel > cpus)) {
app.parallel = cpus;
log.info('cores', `running tests using ${app.parallel} cores`);
}
-if (app.parallel && ((app.parallel + 1) > process.getMaxListeners())) {
+if (app.parallel && app.parallel + 1 > process.getMaxListeners()) {
process.setMaxListeners(app.parallel + 1);
}
@@ -114,7 +120,7 @@ if (!citgm.windows) {
const modules = [];
-function runCitgm (mod, name, next) {
+function runCitgm(mod, name, next) {
if (isMatch(mod.skip)) {
modules.push({
name,
@@ -144,30 +150,43 @@ function runCitgm (mod, name, next) {
process.on('SIGHUP', cleanup);
process.on('SIGBREAK', cleanup);
- runner.on('start', function(name) {
- log.info('starting', name);
- }).on('fail', function(err) {
- log.error('failure', err.message);
- }).on('data', function(type, key, message) {
- log[type](key, message);
- }).on('end', function(result) {
- result.duration = new Date() - start;
- 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`);
- } else {
- log.info(`${result.name} done`, `done - the test suite for ${result.name
- } version ${result.version} passed.`);
- }
- modules.push(result);
- if (!bailed) {
- process.removeListener('SIGINT', cleanup);
- process.removeListener('SIGHUP', cleanup);
- process.removeListener('SIGBREAK', cleanup);
- }
- return next(bailed);
- }).run();
+ runner
+ .on('start', function(name) {
+ log.info('starting', name);
+ })
+ .on('fail', function(err) {
+ log.error('failure', err.message);
+ })
+ .on('data', function(type, key, message) {
+ log[type](key, message);
+ })
+ .on('end', function(result) {
+ result.duration = new Date() - start;
+ 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`
+ );
+ } else {
+ log.info(
+ `${result.name} done`,
+ `done - the test suite for ${result.name} version ${
+ result.version
+ } passed.`
+ );
+ }
+ modules.push(result);
+ if (!bailed) {
+ process.removeListener('SIGINT', cleanup);
+ process.removeListener('SIGHUP', cleanup);
+ process.removeListener('SIGBREAK', cleanup);
+ }
+ return next(bailed);
+ })
+ .run();
}
function runTask(task, next) {
@@ -187,7 +206,7 @@ function launch() {
const q = async.queue(runTask, app.parallel || 1);
q.push(collection);
- function done () {
+ function done() {
q.drain = null;
reporter.logger(log, modules);
@@ -200,12 +219,12 @@ function launch() {
// If not use `log.bypass` which is currently process.stdout.write
// TODO check that we can write to that path, perhaps require a flag to
// Overwrite
- const tap = (typeof app.tap === 'string') ? app.tap : log.bypass;
+ const tap = typeof app.tap === 'string' ? app.tap : log.bypass;
reporter.tap(tap, modules, app.append);
}
if (app.junit) {
- const junit = (typeof app.junit === 'string') ? app.junit : log.bypass;
+ const junit = typeof app.junit === 'string' ? app.junit : log.bypass;
reporter.junit(junit, modules, app.append);
}
A bit hard to read the part I commented about due to the whitespace changes, so here's a screenshot with word highlighting: |
||
| } version ${result.version} passed.`); | ||
| } | ||
| modules.push(result); | ||
| if (!bailed) { | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.