Skip to content

Commit aa1b8bb

Browse files
committed
Finish ES2015ifying the codebase \o/
1 parent c9e6e6f commit aa1b8bb

File tree

13 files changed

+800
-830
lines changed

13 files changed

+800
-830
lines changed

bench/run.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,24 @@ if (process.argv.length === 2) {
6262
let currentArgs = [];
6363
let shouldFail = false;
6464

65-
process.argv.slice(2).forEach(arg => {
65+
for (const arg of process.argv.slice(2)) {
6666
if (arg === '--') {
6767
list.push({
6868
args: currentArgs,
6969
shouldFail
7070
});
7171
currentArgs = [];
7272
shouldFail = false;
73-
return;
73+
continue;
7474
}
7575

7676
if (arg === '--should-fail') {
7777
shouldFail = true;
78-
return;
78+
continue;
7979
}
8080

8181
currentArgs.push(arg);
82-
});
82+
}
8383

8484
if (currentArgs.length > 0) {
8585
list.push({
@@ -89,9 +89,9 @@ if (process.argv.length === 2) {
8989
}
9090
}
9191

92-
list.forEach(definition => {
92+
for (const definition of list) {
9393
definition.args = ['--verbose'].concat(definition.args);
94-
});
94+
}
9595

9696
let combined = [];
9797
for (let i = 0; i < 11; i++) {

lib/assert.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ x._snapshot = function (tree, optionalMessage, match, snapshotStateGetter) {
165165
snapshotState: state
166166
};
167167

168-
// symbols can't be serialized and saved in a snapshot,
169-
// that's why tree is saved in `jsx` prop, so that JSX can be detected later
168+
// Symbols can't be serialized and saved in a snapshot, that's why tree
169+
// is saved in the `__ava_react_jsx` prop, so that JSX can be detected later
170170
const serializedTree = tree.$$typeof === Symbol.for('react.test.json') ? {__ava_react_jsx: tree} : tree; // eslint-disable-line camelcase
171171
const result = toMatchSnapshot.call(context, JSON.stringify(serializedTree));
172172

lib/cli.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ const isCi = require('is-ci');
1010
const hasFlag = require('has-flag');
1111
const Api = require('../api');
1212
const colors = require('./colors');
13-
const verboseReporter = require('./reporters/verbose');
14-
const miniReporter = require('./reporters/mini');
15-
const tapReporter = require('./reporters/tap');
13+
const VerboseReporter = require('./reporters/verbose');
14+
const MiniReporter = require('./reporters/mini');
15+
const TapReporter = require('./reporters/tap');
1616
const Logger = require('./logger');
1717
const Watcher = require('./watcher');
1818
const babelConfig = require('./babel-config');
@@ -127,11 +127,11 @@ exports.run = () => {
127127
let reporter;
128128

129129
if (cli.flags.tap && !cli.flags.watch) {
130-
reporter = tapReporter();
130+
reporter = new TapReporter();
131131
} else if (cli.flags.verbose || isCi) {
132-
reporter = verboseReporter({basePath: pkgDir});
132+
reporter = new VerboseReporter({basePath: pkgDir});
133133
} else {
134-
reporter = miniReporter({watching: cli.flags.watch, basePath: pkgDir});
134+
reporter = new MiniReporter({watching: cli.flags.watch, basePath: pkgDir});
135135
}
136136

137137
reporter.api = api;

lib/code-excerpt.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ const codeExcerpt = require('code-excerpt');
55
const truncate = require('cli-truncate');
66
const chalk = require('chalk');
77

8-
const formatLineNumber = (lineNumber, maxLineNumber) => {
9-
return ' '.repeat(String(maxLineNumber).length - String(lineNumber).length) + lineNumber;
10-
};
8+
const formatLineNumber = (lineNumber, maxLineNumber) =>
9+
' '.repeat(String(maxLineNumber).length - String(lineNumber).length) + lineNumber;
1110

1211
module.exports = (file, line, options) => {
1312
options = options || {};

lib/enhance-assert.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ const formatter = () => {
6666
return args
6767
.map(arg => {
6868
const range = getNode(ast, arg.espath).range;
69-
7069
return [computeStatement(tokens, range), arg.value];
7170
})
7271
.reverse();

0 commit comments

Comments
 (0)