Skip to content

Commit

Permalink
Finish ES2015ifying the codebase \o/
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Feb 2, 2017
1 parent c9e6e6f commit aa1b8bb
Show file tree
Hide file tree
Showing 13 changed files with 800 additions and 830 deletions.
12 changes: 6 additions & 6 deletions bench/run.js
Expand Up @@ -62,24 +62,24 @@ if (process.argv.length === 2) {
let currentArgs = [];
let shouldFail = false;

process.argv.slice(2).forEach(arg => {
for (const arg of process.argv.slice(2)) {
if (arg === '--') {
list.push({
args: currentArgs,
shouldFail
});
currentArgs = [];
shouldFail = false;
return;
continue;
}

if (arg === '--should-fail') {
shouldFail = true;
return;
continue;
}

currentArgs.push(arg);
});
}

if (currentArgs.length > 0) {
list.push({
Expand All @@ -89,9 +89,9 @@ if (process.argv.length === 2) {
}
}

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

let combined = [];
for (let i = 0; i < 11; i++) {
Expand Down
4 changes: 2 additions & 2 deletions lib/assert.js
Expand Up @@ -165,8 +165,8 @@ x._snapshot = function (tree, optionalMessage, match, snapshotStateGetter) {
snapshotState: state
};

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

Expand Down
12 changes: 6 additions & 6 deletions lib/cli.js
Expand Up @@ -10,9 +10,9 @@ const isCi = require('is-ci');
const hasFlag = require('has-flag');
const Api = require('../api');
const colors = require('./colors');
const verboseReporter = require('./reporters/verbose');
const miniReporter = require('./reporters/mini');
const tapReporter = require('./reporters/tap');
const VerboseReporter = require('./reporters/verbose');
const MiniReporter = require('./reporters/mini');
const TapReporter = require('./reporters/tap');
const Logger = require('./logger');
const Watcher = require('./watcher');
const babelConfig = require('./babel-config');
Expand Down Expand Up @@ -127,11 +127,11 @@ exports.run = () => {
let reporter;

if (cli.flags.tap && !cli.flags.watch) {
reporter = tapReporter();
reporter = new TapReporter();
} else if (cli.flags.verbose || isCi) {
reporter = verboseReporter({basePath: pkgDir});
reporter = new VerboseReporter({basePath: pkgDir});
} else {
reporter = miniReporter({watching: cli.flags.watch, basePath: pkgDir});
reporter = new MiniReporter({watching: cli.flags.watch, basePath: pkgDir});
}

reporter.api = api;
Expand Down
5 changes: 2 additions & 3 deletions lib/code-excerpt.js
Expand Up @@ -5,9 +5,8 @@ const codeExcerpt = require('code-excerpt');
const truncate = require('cli-truncate');
const chalk = require('chalk');

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

module.exports = (file, line, options) => {
options = options || {};
Expand Down
1 change: 0 additions & 1 deletion lib/enhance-assert.js
Expand Up @@ -66,7 +66,6 @@ const formatter = () => {
return args
.map(arg => {
const range = getNode(ast, arg.espath).range;

return [computeStatement(tokens, range), arg.value];
})
.reverse();
Expand Down

0 comments on commit aa1b8bb

Please sign in to comment.