Permalink
Browse files

Use consistent comment capitalization

  • Loading branch information...
1 parent 2c6082f commit 415cd2fa0ec4bd2db585cffd8d9ba372e6f05a05 @sindresorhus sindresorhus committed Dec 12, 2016
View
@@ -287,15 +287,15 @@ Api.prototype._runWithoutPool = function (files, runStatus) {
return err.results;
})
.tap(function (results) {
- // if no tests ran, make sure to tear down the child processes
+ // If no tests ran, make sure to tear down the child processes
if (results.length === 0) {
tests.forEach(function (test) {
test.send('teardown');
});
}
})
.then(function (results) {
- // cancel debounced _onTimeout() from firing
+ // Cancel debounced _onTimeout() from firing
if (self.options.timeout) {
self._cancelTimeout(runStatus);
}
@@ -346,7 +346,7 @@ Api.prototype._runWithPool = function (files, runStatus, concurrency) {
// Filter out undefined results (usually result of caught exceptions)
results = results.filter(Boolean);
- // cancel debounced _onTimeout() from firing
+ // Cancel debounced _onTimeout() from firing
if (self.options.timeout) {
self._cancelTimeout(runStatus);
}
View
@@ -10,7 +10,7 @@ let files = fs.readdirSync(path.join(__dirname, '.results'))
result['.file'] = path.basename(file, '.json');
return result;
})
- // find the most recent benchmark runs
+ // Find the most recent benchmark runs
.sort((fileA, fileB) => fileB['.time'] - fileA['.time']);
function average(data) {
@@ -31,15 +31,15 @@ function standardDeviation(values) {
return stdDev;
}
-// only the 3 most recent runs
+// Only the 3 most recent runs
files = files.slice(0, 3);
function prepStats(times) {
times = times
.map(time => time.time)
.sort((timeA, timeB) => timeA - timeB);
- // remove fastest and slowest
+ // Remove fastest and slowest
times = times.slice(1, times.length - 1);
const sum = times.reduce((a, b) => a + b, 0);
View
@@ -152,7 +152,7 @@ x.ifError = (err, msg) => {
};
x._snapshot = function (tree, optionalMessage, match, snapshotStateGetter) {
- // set defaults - this allows tests to mock deps easily
+ // Set defaults - this allows tests to mock deps easily
const toMatchSnapshot = match || jestSnapshot.toMatchSnapshot;
const getState = snapshotStateGetter || snapshotState.get;
@@ -186,7 +186,7 @@ x.snapshot = function (tree, optionalMessage) {
};
/*
- * deprecated APIs
+ * Deprecated APIs
*/
x.ok = util.deprecate(x.truthy, getDeprecationNotice('ok()', 'truthy()'));
x.notOk = util.deprecate(x.falsy, getDeprecationNotice('notOk()', 'falsy()'));
View
@@ -11,7 +11,7 @@ function validate(conf) {
conf = 'default';
}
- // check for valid babel config shortcuts (can be either `default` or `inherit`)
+ // Check for valid babel config shortcuts (can be either `default` or `inherit`)
const isValidShortcut = conf === 'default' || conf === 'inherit';
if (!conf || (typeof conf === 'string' && !isValidShortcut)) {
@@ -72,7 +72,7 @@ const espowerPlugin = lazy(() => {
const babel = require('babel-core');
const createEspowerPlugin = require('babel-plugin-espower/create');
- // initialize power-assert
+ // Initialize power-assert
return createEspowerPlugin(babel, {
embedAst: true,
patterns: require('./enhance-assert').PATTERNS
@@ -3,7 +3,7 @@ const StackUtils = require('stack-utils');
const cleanStack = require('clean-stack');
const debug = require('debug')('ava');
-// ignore unimportant stack trace lines
+// Ignore unimportant stack trace lines
let ignoreStackLines = [];
const avaInternals = /\/ava\/(?:lib\/)?[\w-]+\.js:\d+:\d+\)?$/;
@@ -22,7 +22,7 @@ module.exports = function (stack) {
return '';
}
- // workaround for https://github.com/tapjs/stack-utils/issues/14
+ // Workaround for https://github.com/tapjs/stack-utils/issues/14
// TODO: fix it in `stack-utils`
stack = cleanStack(stack);
@@ -37,7 +37,7 @@ CachingPrecompiler.prototype.precompileFile = function (filePath) {
return this.fileHashes[filePath];
};
-// conditionally called by caching-transform when precompiling is required
+// Conditionally called by caching-transform when precompiling is required
CachingPrecompiler.prototype._init = function () {
this.babel = require('babel-core');
@@ -50,12 +50,12 @@ CachingPrecompiler.prototype._transform = function (code, filePath, hash) {
var options = babelConfigHelper.build(this.babelConfig, this.powerAssert, filePath, code);
var result = this.babel.transform(code, options);
- // save source map
+ // Save source map
var mapPath = path.join(this.cacheDirPath, hash + '.js.map');
fs.writeFileSync(mapPath, JSON.stringify(result.map));
- // append source map comment to transformed code
- // so that other libraries (like nyc) can find the source map
+ // Append source map comment to transformed code
+ // So that other libraries (like nyc) can find the source map
var dirPath = path.dirname(filePath);
var relativeMapPath = path.relative(dirPath, mapPath);
var comment = convertSourceMap.generateMapFileComment(relativeMapPath);
View
@@ -51,15 +51,15 @@ class Concurrent {
return this._addResult(result, index);
}
_addResult(result, index) {
- // always save result when not in bail mode or all previous tests pass
+ // Always save result when not in bail mode or all previous tests pass
if ((this.bail && this.passed) || !this.bail) {
this.results[index] = result;
}
if (result.passed === false) {
this.passed = false;
- // only set reason once
+ // Only set reason once
if (!this.reason) {
this.reason = result.reason;
}
@@ -14,7 +14,7 @@ module.exports.PATTERNS = [
't.notDeepEqual(value, expected, [message])',
't.regex(contents, regex, [message])',
't.notRegex(contents, regex, [message])',
- // deprecated apis
+ // Deprecated apis
't.ok(value, [message])',
't.notOk(value, [message])',
't.same(value, expected, [message])',
View
@@ -12,7 +12,7 @@ if (fs.realpathSync(__filename) !== __filename) {
let env = process.env;
-// ensure NODE_PATH paths are absolute
+// Ensure NODE_PATH paths are absolute
if (env.NODE_PATH) {
env = Object.assign({}, env);
@@ -65,7 +65,7 @@ module.exports = (file, opts, execArgv) => {
const promise = new Promise((resolve, reject) => {
ps.on('error', reject);
- // emit `test` and `stats` events
+ // Emit `test` and `stats` events
ps.on('message', event => {
if (!event.ava) {
return;
@@ -118,13 +118,13 @@ module.exports = (file, opts, execArgv) => {
});
});
- // teardown finished, now exit
+ // Teardown finished, now exit
ps.on('teardown', () => {
send('exit');
exiting = true;
});
- // uncaught exception in fork, need to exit
+ // Uncaught exception in fork, need to exit
ps.on('uncaughtException', () => {
send('teardown');
});
@@ -152,7 +152,7 @@ module.exports = (file, opts, execArgv) => {
return promise;
};
- // send 'run' event only when fork is listening for it
+ // Send 'run' event only when fork is listening for it
let isReady = false;
ps.on('stats', () => {
View
@@ -12,10 +12,10 @@ const runner = new Runner({
match: opts.match
});
-// note that test files have require('ava')
+// Note that test files have require('ava')
require('./test-worker').avaRequired = true;
-// if fail-fast is enabled, use this variable to detect
+// If fail-fast is enabled, use this variable to detect
// that no more tests should be logged
let isFailed = false;
@@ -28,7 +28,7 @@ function test(props) {
const hasError = typeof props.error !== 'undefined';
- // don't display anything if it's a passed hook
+ // Don't display anything if it's a passed hook
if (!hasError && props.type !== 'test') {
return;
}
View
@@ -3,7 +3,7 @@ const path = require('path');
module.exports = (file, base, separator) => {
let prefix = file
- // only replace this.base if it is found at the start of the path
+ // Only replace this.base if it is found at the start of the path
.replace(base, (match, offset) => offset === 0 ? '' : match)
.replace(/\.spec/, '')
.replace(/\.test/, '')
@@ -7,7 +7,7 @@ const installPrecompiler = require('require-precompiled');
const debug = require('debug')('ava');
-// check if the test is being run without AVA cli
+// Check if the test is being run without AVA cli
const isForked = typeof process.send === 'function';
if (!isForked) {
@@ -267,7 +267,7 @@ MiniReporter.prototype._update = function (data) {
}
if (data) {
- // send new log data to the terminal, and update the last line status.
+ // Send new log data to the terminal, and update the last line status.
this.lastLineTracker.update(this.stringDecoder.write(data));
this.stream.write(data);
}
@@ -282,7 +282,7 @@ MiniReporter.prototype._update = function (data) {
if (lastLine.length % columns) {
currentStatus = '\n' + currentStatus;
}
- // rewrite the status message.
+ // Rewrite the status message.
this.stream.write(currentStatus);
}
};
@@ -41,7 +41,7 @@ VerboseReporter.prototype.test = function (test, runStatus) {
return undefined;
}
- // display duration only over a threshold
+ // Display duration only over a threshold
var threshold = 100;
var duration = test.duration > threshold ? colors.duration(' (' + prettyMs(test.duration) + ')') : '';
View
@@ -129,7 +129,7 @@ class RunStatus extends EventEmitter {
this.emit(channel, data, this);
}
processResults(results) {
- // assemble stats from all tests
+ // Assemble stats from all tests
this.stats = results.map(result => result.stats);
this.tests = results.map(result => result.tests);
this.tests = flatten(this.tests);
View
@@ -21,14 +21,14 @@ class Sequence {
const length = this.tests.length;
for (let i = 0; i < length; i++) {
- // if last item failed and we should bail, return results and stop
+ // If last item failed and we should bail, return results and stop
if (this.bail && !this.passed) {
return this._results();
}
const result = this.tests[i].run();
- // if a Promise returned, we don't need to check for Promises after this test
+ // If a Promise returned, we don't need to check for Promises after this test
// so we can just use Promise.each() on the rest of the tests
if (isPromise(result)) {
return result
@@ -42,7 +42,7 @@ class Sequence {
try {
this._addResult(result);
} catch (err) {
- // in bail mode, don't execute the next tests
+ // In bail mode, don't execute the next tests
if (err instanceof AvaError) {
return this._results();
}
@@ -63,7 +63,7 @@ class Sequence {
if (result.passed === false) {
this.passed = false;
- // only set reason once
+ // Only set reason once
if (!this.reason) {
this.reason = result.reason;
}
@@ -7,7 +7,7 @@ const x = module.exports;
x.get = (initializeState, globalsOptions) => {
if (!x.state) {
- // set defaults - this allows tests to mock deps easily
+ // Set defaults - this allows tests to mock deps easily
const options = globalsOptions || globals.options;
const initializeSnapshotState = initializeState || jestSnapshot.initializeSnapshotState;
@@ -47,7 +47,7 @@ TestCollection.prototype.add = function (test) {
test.title = fnName(test.fn);
}
- // workaround for Babel giving anonymous functions a name
+ // Workaround for Babel giving anonymous functions a name
if (test.title === 'callee$0$0') {
test.title = null;
}
@@ -64,7 +64,7 @@ TestCollection.prototype.add = function (test) {
throw new Error('"always" can only be used with after and afterEach hooks');
}
- // add a hook
+ // Add a hook
if (type !== 'test') {
if (metadata.exclusive) {
throw new Error('"only" cannot be used with a ' + type + ' hook');
@@ -74,7 +74,7 @@ TestCollection.prototype.add = function (test) {
return;
}
- // add .only() tests if .only() was used previously
+ // Add .only() tests if .only() was used previously
if (this.hasExclusive && !metadata.exclusive) {
return;
}
Oops, something went wrong.

0 comments on commit 415cd2f

Please sign in to comment.