Permalink
Browse files

Bump dev dependencies (#1927)

  • Loading branch information...
sindresorhus committed Sep 4, 2018
1 parent bec0364 commit bfe16300e07c12a1bad2e4f02898b1e7486daf70
View
@@ -4,7 +4,7 @@ Translations: [Français](https://github.com/avajs/ava-docs/blob/master/fr_FR/do
AVA comes bundled with a Flow definition file. This allows developers to leverage Flow for writing tests.
This guide assumes you've already set up Flow for your project. Note that AVA's definition as been tested with version 0.79.1.
This guide assumes you've already set up Flow for your project. Note that AVA's definition as been tested with version 0.80.0.
We recommend you use AVA's built-in Babel pipeline to strip Flow type annotations and declarations. AVA automatically applies your project's Babel configuration, so everything may just work without changes. Alternatively install [`@babel/plugin-transform-flow-strip-types`](https://www.npmjs.com/package/@babel/plugin-transform-flow-strip-types) and customize AVA's configuration in the `package.json` file (or the `ava.config.js` file) as follows:
View
@@ -322,8 +322,8 @@ function wrapAssertions(callbacks) {
try {
expectations = validateExpectations('throws', expectations, arguments.length);
} catch (err) {
fail(this, err);
} catch (error) {
fail(this, error);
return;
}
@@ -332,8 +332,8 @@ function wrapAssertions(callbacks) {
let threw = false;
try {
retval = fn();
} catch (err) {
actual = err;
} catch (error) {
actual = error;
threw = true;
}
@@ -356,8 +356,8 @@ function wrapAssertions(callbacks) {
});
pass(this);
return actual;
} catch (err) {
fail(this, err);
} catch (error) {
fail(this, error);
}
},
@@ -374,8 +374,8 @@ function wrapAssertions(callbacks) {
try {
expectations = validateExpectations('throwsAsync', expectations, arguments.length);
} catch (err) {
fail(this, err);
} catch (error) {
fail(this, error);
return Promise.resolve();
}
@@ -415,8 +415,8 @@ function wrapAssertions(callbacks) {
let threw = false;
try {
retval = thrower();
} catch (err) {
actual = err;
} catch (error) {
actual = error;
threw = true;
}
@@ -454,11 +454,11 @@ function wrapAssertions(callbacks) {
try {
fn();
} catch (err) {
} catch (error) {
fail(this, new AssertionError({
assertion: 'notThrows',
message,
values: [formatWithLabel('Function threw:', err)]
values: [formatWithLabel('Function threw:', error)]
}));
return;
}
@@ -500,11 +500,11 @@ function wrapAssertions(callbacks) {
let retval;
try {
retval = nonThrower();
} catch (err) {
} catch (error) {
fail(this, new AssertionError({
assertion: 'notThrowsAsync',
message,
values: [formatWithLabel('Function threw:', err)]
values: [formatWithLabel('Function threw:', error)]
}));
return Promise.resolve();
}
@@ -534,15 +534,15 @@ function wrapAssertions(callbacks) {
let result;
try {
result = this.compareWithSnapshot(options);
} catch (err) {
if (!(err instanceof snapshotManager.SnapshotError)) {
throw err;
} catch (error) {
if (!(error instanceof snapshotManager.SnapshotError)) {
throw error;
}
const improperUsage = {name: err.name, snapPath: err.snapPath};
if (err instanceof snapshotManager.VersionMismatchError) {
improperUsage.snapVersion = err.snapVersion;
improperUsage.expectedVersion = err.expectedVersion;
const improperUsage = {name: error.name, snapPath: error.snapPath};
if (error instanceof snapshotManager.VersionMismatchError) {
improperUsage.snapVersion = error.snapVersion;
improperUsage.expectedVersion = error.expectedVersion;
}
fail(this, new AssertionError({
View
@@ -22,8 +22,8 @@ exports.run = () => { // eslint-disable-line complexity
let confError = null;
try {
conf = loadConf();
} catch (err) {
confError = err;
} catch (error) {
confError = error;
}
const cli = meow(`
@@ -130,8 +130,8 @@ exports.run = () => { // eslint-disable-line complexity
}).then(() => {
console.error(`\n${chalk.green(figures.tick)} Removed AVA cache files in ${cacheDir}`);
process.exit(0); // eslint-disable-line unicorn/no-process-exit
}, err => {
exit(`Error removing AVA cache files in ${cacheDir}\n\n${chalk.gray((err && err.stack) || err)}`);
}, error => {
exit(`Error removing AVA cache files in ${cacheDir}\n\n${chalk.gray((error && error.stack) || error)}`);
});
return;
}
@@ -167,15 +167,15 @@ exports.run = () => { // eslint-disable-line complexity
let babelConfig = null;
try {
babelConfig = babelPipeline.validate(conf.babel);
} catch (err) {
exit(err.message);
} catch (error) {
exit(error.message);
}
let extensions;
try {
extensions = normalizeExtensions(conf.extensions || [], babelConfig);
} catch (err) {
exit(err.message);
} catch (error) {
exit(error.message);
}
// Copy resultant cli.flags into conf for use with Api and elsewhere
View
@@ -22,7 +22,7 @@ module.exports = (source, options) => {
let contents;
try {
contents = fs.readFileSync(file, 'utf8');
} catch (err) {
} catch (_) {
return null;
}
View
@@ -1,6 +1,6 @@
'use strict';
try {
module.exports = require('emittery');
} catch (err) {
} catch (_) {
module.exports = require('emittery/legacy');
}
View
@@ -28,7 +28,7 @@ module.exports = (enhancementsOnly, babelConfig) => {
// no configured extensions), thes the `js` extension must have come from
// the `enhancementsOnly` value. That's not allowed since it'd be a
// roundabout way of disabling Babel.
throw new Error(`Cannot specify generic 'js' extension without disabling AVA's Babel usage.`);
throw new Error('Cannot specify generic \'js\' extension without disabling AVA\'s Babel usage.');
}
if (duplicates.length > 0) {
View
@@ -19,11 +19,11 @@ function loadConfig(defaults = {}) {
force: true,
mode: 'all'
})(path.join(projectDir, 'ava.config.js')));
} catch (err) {
if (err && err.code === 'MODULE_NOT_FOUND') {
} catch (error) {
if (error && error.code === 'MODULE_NOT_FOUND') {
fileConf = NO_SUCH_FILE;
} else {
throw Object.assign(new Error('Error loading ava.config.js'), {parent: err});
throw Object.assign(new Error('Error loading ava.config.js'), {parent: error});
}
}
View
@@ -73,12 +73,12 @@ exports.LegacyError = LegacyError;
function tryRead(file) {
try {
return fs.readFileSync(file);
} catch (err) {
if (err.code === 'ENOENT') {
} catch (error) {
if (error.code === 'ENOENT') {
return null;
}
throw err;
throw error;
}
}
View
@@ -80,7 +80,7 @@ class ExecutionContext {
get end() {
const end = testMap.get(this).bindEndCallback();
const endFn = err => end(err, captureStack(endFn));
const endFn = error => end(error, captureStack(endFn));
return endFn;
}
@@ -147,27 +147,27 @@ class Test {
bindEndCallback() {
if (this.metadata.callback) {
return (err, stack) => {
this.endCallback(err, stack);
return (error, stack) => {
this.endCallback(error, stack);
};
}
throw new Error('`t.end()`` is not supported in this context. To use `t.end()` as a callback, you must use "callback mode" via `test.cb(testName, fn)`');
}
endCallback(err, stack) {
endCallback(error, stack) {
if (this.calledEnd) {
this.saveFirstError(new Error('`t.end()` called more than once'));
return;
}
this.calledEnd = true;
if (err) {
if (error) {
this.saveFirstError(new assert.AssertionError({
actual: err,
actual: error,
message: 'Callback called with an error',
stack,
values: [formatErrorValue('Callback called with an error:', err)]
values: [formatErrorValue('Callback called with an error:', error)]
}));
}
@@ -200,7 +200,7 @@ class Test {
this.assertCount++;
this.pendingAssertionCount++;
promise
.catch(err => this.saveFirstError(err))
.catch(error => this.saveFirstError(error))
.then(() => this.pendingAssertionCount--);
}
@@ -213,9 +213,9 @@ class Test {
this.saveFirstError(error);
}
saveFirstError(err) {
saveFirstError(error) {
if (!this.assertError) {
this.assertError = err;
this.assertError = error;
}
}
@@ -256,7 +256,7 @@ class Test {
this.pendingThrowsAssertion = pending;
}
detectImproperThrows(err) {
detectImproperThrows(error) {
if (!this.pendingThrowsAssertion) {
return false;
}
@@ -265,16 +265,16 @@ class Test {
this.pendingThrowsAssertion = null;
const values = [];
if (err) {
values.push(formatErrorValue(`The following error was thrown, possibly before \`t.${pending.assertion}()\` could be called:`, err));
if (error) {
values.push(formatErrorValue(`The following error was thrown, possibly before \`t.${pending.assertion}()\` could be called:`, error));
}
this.saveFirstError(new assert.AssertionError({
assertion: pending.assertion,
fixedSource: {file: pending.file, line: pending.line},
improperUsage: true,
message: `Improper usage of \`t.${pending.assertion}()\` detected`,
stack: err instanceof Error && err.stack,
stack: error instanceof Error && error.stack,
values
}));
return true;
@@ -297,8 +297,8 @@ class Test {
});
}
attributeLeakedError(err) {
if (!this.detectImproperThrows(err)) {
attributeLeakedError(error) {
if (!this.detectImproperThrows(error)) {
return false;
}
@@ -312,10 +312,10 @@ class Test {
ok: true,
retval: this.fn.call(null, this.createExecutionContext())
};
} catch (err) {
} catch (error) {
return {
ok: false,
error: err
error
};
}
}
@@ -380,20 +380,20 @@ class Test {
};
this.finishDueToInactivity = () => {
const err = returnedObservable ?
const error = returnedObservable ?
new Error('Observable returned by test never completed') :
new Error('Promise returned by test never resolved');
this.saveFirstError(err);
this.saveFirstError(error);
resolve(this.finishPromised());
};
promise
.catch(err => {
if (!this.detectImproperThrows(err)) {
.catch(error => {
if (!this.detectImproperThrows(error)) {
this.saveFirstError(new assert.AssertionError({
message: 'Rejected promise returned by test',
stack: err instanceof Error && err.stack,
values: [formatErrorValue('Rejected promise returned by test. Reason:', err)]
stack: error instanceof Error && error.stack,
values: [formatErrorValue('Rejected promise returned by test. Reason:', error)]
}));
}
})
@@ -17,12 +17,12 @@ function installSourceMapSupport() {
try {
const map = fs.readFileSync(`${precompiled}.map`, 'utf8');
return {url, map};
} catch (err) {
if (err.code === 'ENOENT') {
} catch (error) {
if (error.code === 'ENOENT') {
return null;
}
throw err;
throw error;
}
}
});
Oops, something went wrong.

0 comments on commit bfe1630

Please sign in to comment.