aboutsummaryrefslogtreecommitdiff
path: root/node_modules/ava
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-05-28 00:38:50 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-05-28 00:40:43 +0200
commit7fff4499fd915bcea3fa93b1aa8b35f4fe7a6027 (patch)
tree6de9a1aebd150a23b7f8c273ec657a5d0a18fe3e /node_modules/ava
parent963b7a41feb29cc4be090a2446bdfe0c1f1bcd81 (diff)
add linting (and some initial fixes)
Diffstat (limited to 'node_modules/ava')
-rw-r--r--node_modules/ava/.iron-node.js7
-rw-r--r--node_modules/ava/api.js350
-rwxr-xr-xnode_modules/ava/cli.js27
-rw-r--r--node_modules/ava/index.js8
-rw-r--r--node_modules/ava/index.js.flow201
-rw-r--r--node_modules/ava/lib/assert.js378
-rw-r--r--node_modules/ava/lib/ava-error.js10
-rw-r--r--node_modules/ava/lib/ava-files.js282
-rw-r--r--node_modules/ava/lib/babel-config.js148
-rw-r--r--node_modules/ava/lib/beautify-stack.js37
-rw-r--r--node_modules/ava/lib/caching-precompiler.js103
-rw-r--r--node_modules/ava/lib/cli.js200
-rw-r--r--node_modules/ava/lib/code-excerpt.js57
-rw-r--r--node_modules/ava/lib/colors.js15
-rw-r--r--node_modules/ava/lib/concurrent.js64
-rw-r--r--node_modules/ava/lib/enhance-assert.js63
-rw-r--r--node_modules/ava/lib/extract-stack.js10
-rw-r--r--node_modules/ava/lib/fork.js178
-rw-r--r--node_modules/ava/lib/format-assert-error.js121
-rw-r--r--node_modules/ava/lib/globals.js10
-rw-r--r--node_modules/ava/lib/logger.js81
-rw-r--r--node_modules/ava/lib/main.js103
-rw-r--r--node_modules/ava/lib/prefix-title.js21
-rw-r--r--node_modules/ava/lib/process-adapter.js103
-rw-r--r--node_modules/ava/lib/reporters/improper-usage-messages.js21
-rw-r--r--node_modules/ava/lib/reporters/mini.js318
-rw-r--r--node_modules/ava/lib/reporters/tap.js119
-rw-r--r--node_modules/ava/lib/reporters/verbose.js165
-rw-r--r--node_modules/ava/lib/run-status.js125
-rw-r--r--node_modules/ava/lib/runner.js221
-rw-r--r--node_modules/ava/lib/sequence.js94
-rw-r--r--node_modules/ava/lib/serialize-error.js94
-rw-r--r--node_modules/ava/lib/test-collection.js206
-rw-r--r--node_modules/ava/lib/test-worker.js130
-rw-r--r--node_modules/ava/lib/test.js416
-rw-r--r--node_modules/ava/lib/validate-test.js48
-rw-r--r--node_modules/ava/lib/watcher.js322
-rw-r--r--node_modules/ava/license21
l---------node_modules/ava/node_modules/.bin/js-yaml1
l---------node_modules/ava/node_modules/.bin/mkdirp1
-rw-r--r--node_modules/ava/node_modules/has-flag/index.js10
-rw-r--r--node_modules/ava/node_modules/has-flag/license21
-rw-r--r--node_modules/ava/node_modules/has-flag/package.json49
-rw-r--r--node_modules/ava/node_modules/has-flag/readme.md67
-rw-r--r--node_modules/ava/node_modules/md5-hex/browser.js10
-rw-r--r--node_modules/ava/node_modules/md5-hex/index.js23
-rw-r--r--node_modules/ava/node_modules/md5-hex/license21
-rw-r--r--node_modules/ava/node_modules/md5-hex/package.json39
-rw-r--r--node_modules/ava/node_modules/md5-hex/readme.md46
-rw-r--r--node_modules/ava/package.json209
-rw-r--r--node_modules/ava/profile.js161
-rw-r--r--node_modules/ava/readme.md1209
-rw-r--r--node_modules/ava/types/generated.d.ts1142
-rw-r--r--node_modules/ava/types/make.js184
54 files changed, 8070 insertions, 0 deletions
diff --git a/node_modules/ava/.iron-node.js b/node_modules/ava/.iron-node.js
new file mode 100644
index 000000000..dc31ccece
--- /dev/null
+++ b/node_modules/ava/.iron-node.js
@@ -0,0 +1,7 @@
+module.exports = {
+ app: {
+ openDevToolsDetached: true,
+ hideMainWindow: true
+ },
+ workSpaceDirectory: () => __dirname
+};
diff --git a/node_modules/ava/api.js b/node_modules/ava/api.js
new file mode 100644
index 000000000..e5c5a7b92
--- /dev/null
+++ b/node_modules/ava/api.js
@@ -0,0 +1,350 @@
+'use strict';
+const EventEmitter = require('events');
+const path = require('path');
+const fs = require('fs');
+const commonPathPrefix = require('common-path-prefix');
+const uniqueTempDir = require('unique-temp-dir');
+const findCacheDir = require('find-cache-dir');
+const resolveCwd = require('resolve-cwd');
+const debounce = require('lodash.debounce');
+const autoBind = require('auto-bind');
+const Promise = require('bluebird');
+const getPort = require('get-port');
+const arrify = require('arrify');
+const ms = require('ms');
+const babelConfigHelper = require('./lib/babel-config');
+const CachingPrecompiler = require('./lib/caching-precompiler');
+const RunStatus = require('./lib/run-status');
+const AvaError = require('./lib/ava-error');
+const AvaFiles = require('./lib/ava-files');
+const fork = require('./lib/fork');
+
+function resolveModules(modules) {
+ return arrify(modules).map(name => {
+ const modulePath = resolveCwd(name);
+
+ if (modulePath === null) {
+ throw new Error(`Could not resolve required module '${name}'`);
+ }
+
+ return modulePath;
+ });
+}
+
+function getBlankResults() {
+ return {
+ stats: {
+ knownFailureCount: 0,
+ testCount: 0,
+ passCount: 0,
+ skipCount: 0,
+ todoCount: 0,
+ failCount: 0
+ },
+ tests: []
+ };
+}
+
+class Api extends EventEmitter {
+ constructor(options) {
+ super();
+ autoBind(this);
+
+ this.options = Object.assign({match: []}, options);
+ this.options.require = resolveModules(this.options.require);
+ }
+ _runFile(file, runStatus, execArgv) {
+ const hash = this.precompiler.precompileFile(file);
+ const precompiled = Object.assign({}, this._precompiledHelpers);
+ const resolvedfpath = fs.realpathSync(file);
+ precompiled[resolvedfpath] = hash;
+
+ const options = Object.assign({}, this.options, {precompiled});
+ const emitter = fork(file, options, execArgv);
+ runStatus.observeFork(emitter);
+
+ return emitter;
+ }
+ run(files, options) {
+ return new AvaFiles({cwd: this.options.resolveTestsFrom, files})
+ .findTestFiles()
+ .then(files => this._run(files, options));
+ }
+ _onTimeout(runStatus) {
+ const timeout = ms(this.options.timeout);
+ const err = new AvaError(`Exited because no new tests completed within the last ${timeout}ms of inactivity`);
+ this._handleError(runStatus, err);
+ runStatus.emit('timeout');
+ }
+ _setupTimeout(runStatus) {
+ const timeout = ms(this.options.timeout);
+
+ runStatus._restartTimer = debounce(() => {
+ this._onTimeout(runStatus);
+ }, timeout);
+
+ runStatus._restartTimer();
+ runStatus.on('test', runStatus._restartTimer);
+ }
+ _cancelTimeout(runStatus) {
+ runStatus._restartTimer.cancel();
+ }
+ _setupPrecompiler(files) {
+ const isCacheEnabled = this.options.cacheEnabled !== false;
+ let cacheDir = uniqueTempDir();
+
+ if (isCacheEnabled) {
+ const foundDir = findCacheDir({
+ name: 'ava',
+ files
+ });
+ if (foundDir !== null) {
+ cacheDir = foundDir;
+ }
+ }
+
+ this.options.cacheDir = cacheDir;
+
+ const isPowerAssertEnabled = this.options.powerAssert !== false;
+ return babelConfigHelper.build(this.options.projectDir, cacheDir, this.options.babelConfig, isPowerAssertEnabled)
+ .then(result => {
+ this.precompiler = new CachingPrecompiler({
+ path: cacheDir,
+ getBabelOptions: result.getOptions,
+ babelCacheKeys: result.cacheKeys
+ });
+ });
+ }
+ _precompileHelpers() {
+ this._precompiledHelpers = {};
+
+ // Assumes the tests only load helpers from within the `resolveTestsFrom`
+ // directory. Without arguments this is the `projectDir`, else it's
+ // `process.cwd()` which may be nested too deeply. This will be solved
+ // as we implement RFC 001 and move helper compilation into the worker
+ // processes, avoiding the need for precompilation.
+ return new AvaFiles({cwd: this.options.resolveTestsFrom})
+ .findTestHelpers()
+ .map(file => { // eslint-disable-line array-callback-return
+ const hash = this.precompiler.precompileFile(file);
+ this._precompiledHelpers[file] = hash;
+ });
+ }
+ _run(files, options) {
+ options = options || {};
+
+ const runStatus = new RunStatus({
+ runOnlyExclusive: options.runOnlyExclusive,
+ prefixTitles: this.options.explicitTitles || files.length > 1,
+ base: path.relative(process.cwd(), commonPathPrefix(files)) + path.sep,
+ failFast: this.options.failFast
+ });
+
+ this.emit('test-run', runStatus, files);
+
+ if (files.length === 0) {
+ const err = new AvaError('Couldn\'t find any files to test');
+ this._handleError(runStatus, err);
+ return Promise.resolve(runStatus);
+ }
+
+ return this._setupPrecompiler(files)
+ .then(() => this._precompileHelpers())
+ .then(() => {
+ if (this.options.timeout) {
+ this._setupTimeout(runStatus);
+ }
+
+ let overwatch;
+ if (this.options.concurrency > 0) {
+ const concurrency = this.options.serial ? 1 : this.options.concurrency;
+ overwatch = this._runWithPool(files, runStatus, concurrency);
+ } else {
+ // _runWithoutPool exists to preserve legacy behavior, specifically around `.only`
+ overwatch = this._runWithoutPool(files, runStatus);
+ }
+
+ return overwatch;
+ });
+ }
+ _computeForkExecArgs(files) {
+ const execArgv = this.options.testOnlyExecArgv || process.execArgv;
+ let debugArgIndex = -1;
+
+ // --debug-brk is used in addition to --inspect to break on first line and wait
+ execArgv.some((arg, index) => {
+ const isDebugArg = arg === '--inspect' || arg.indexOf('--inspect=') === 0;
+ if (isDebugArg) {
+ debugArgIndex = index;
+ }
+
+ return isDebugArg;
+ });
+
+ const isInspect = debugArgIndex >= 0;
+ if (!isInspect) {
+ execArgv.some((arg, index) => {
+ const isDebugArg = arg === '--debug' || arg === '--debug-brk' || arg.indexOf('--debug-brk=') === 0 || arg.indexOf('--debug=') === 0;
+ if (isDebugArg) {
+ debugArgIndex = index;
+ }
+
+ return isDebugArg;
+ });
+ }
+
+ if (debugArgIndex === -1) {
+ return Promise.resolve([]);
+ }
+
+ return Promise
+ .map(files, () => getPort())
+ .map(port => {
+ const forkExecArgv = execArgv.slice();
+ let flagName = isInspect ? '--inspect' : '--debug';
+ const oldValue = forkExecArgv[debugArgIndex];
+ if (oldValue.indexOf('brk') > 0) {
+ flagName += '-brk';
+ }
+
+ forkExecArgv[debugArgIndex] = `${flagName}=${port}`;
+
+ return forkExecArgv;
+ });
+ }
+ _handleError(runStatus, err) {
+ runStatus.handleExceptions({
+ exception: err,
+ file: err.file ? path.relative(process.cwd(), err.file) : undefined
+ });
+ }
+ _runWithoutPool(files, runStatus) {
+ const tests = [];
+ let execArgvList;
+
+ // TODO: This should be cleared at the end of the run
+ runStatus.on('timeout', () => {
+ tests.forEach(fork => {
+ fork.exit();
+ });
+ });
+
+ return this._computeForkExecArgs(files)
+ .then(argvList => {
+ execArgvList = argvList;
+ })
+ .return(files)
+ .each((file, index) => {
+ return new Promise(resolve => {
+ const forkArgs = execArgvList[index];
+ const test = this._runFile(file, runStatus, forkArgs);
+ tests.push(test);
+ test.on('stats', resolve);
+ test.catch(resolve);
+ }).catch(err => {
+ err.results = [];
+ err.file = file;
+ return Promise.reject(err);
+ });
+ })
+ .then(() => {
+ if (this.options.match.length > 0 && !runStatus.hasExclusive) {
+ const err = new AvaError('Couldn\'t find any matching tests');
+ err.file = undefined;
+ err.results = [];
+ return Promise.reject(err);
+ }
+
+ const method = this.options.serial ? 'mapSeries' : 'map';
+ const options = {
+ runOnlyExclusive: runStatus.hasExclusive
+ };
+
+ return Promise[method](files, (file, index) => {
+ return tests[index].run(options).catch(err => {
+ err.file = file;
+ this._handleError(runStatus, err);
+ return getBlankResults();
+ });
+ });
+ })
+ .catch(err => {
+ this._handleError(runStatus, err);
+ return err.results;
+ })
+ .tap(results => {
+ // If no tests ran, make sure to tear down the child processes
+ if (results.length === 0) {
+ tests.forEach(test => {
+ test.send('teardown');
+ });
+ }
+ })
+ .then(results => {
+ // Cancel debounced _onTimeout() from firing
+ if (this.options.timeout) {
+ this._cancelTimeout(runStatus);
+ }
+
+ runStatus.processResults(results);
+
+ return runStatus;
+ });
+ }
+ _runWithPool(files, runStatus, concurrency) {
+ const tests = [];
+ let execArgvList;
+
+ runStatus.on('timeout', () => {
+ tests.forEach(fork => {
+ fork.exit();
+ });
+ });
+
+ return this._computeForkExecArgs(files)
+ .then(argvList => {
+ execArgvList = argvList;
+ })
+ .return(files)
+ .map((file, index) => {
+ return new Promise(resolve => {
+ const forkArgs = execArgvList[index];
+ const test = this._runFile(file, runStatus, forkArgs);
+ tests.push(test);
+
+ // If we're looking for matches, run every single test process in exclusive-only mode
+ const options = {
+ runOnlyExclusive: this.options.match.length > 0
+ };
+
+ resolve(test.run(options));
+ }).catch(err => {
+ err.file = file;
+ this._handleError(runStatus, err);
+ return getBlankResults();
+ });
+ }, {concurrency})
+ .then(results => {
+ // Filter out undefined results (usually result of caught exceptions)
+ results = results.filter(Boolean);
+
+ // Cancel debounced _onTimeout() from firing
+ if (this.options.timeout) {
+ this._cancelTimeout(runStatus);
+ }
+
+ if (this.options.match.length > 0 && !runStatus.hasExclusive) {
+ results = [];
+
+ const err = new AvaError('Couldn\'t find any matching tests');
+ this._handleError(runStatus, err);
+ }
+
+ runStatus.processResults(results);
+
+ return runStatus;
+ });
+ }
+}
+
+module.exports = Api;
diff --git a/node_modules/ava/cli.js b/node_modules/ava/cli.js
new file mode 100755
index 000000000..d9d338941
--- /dev/null
+++ b/node_modules/ava/cli.js
@@ -0,0 +1,27 @@
+#!/usr/bin/env node
+'use strict';
+const path = require('path');
+const debug = require('debug')('ava');
+
+// Prefer the local installation of AVA.
+const resolveCwd = require('resolve-cwd');
+const localCLI = resolveCwd('ava/cli');
+
+// Use `path.relative()` to detect local AVA installation,
+// because __filename's case is inconsistent on Windows
+// see https://github.com/nodejs/node/issues/6624
+if (localCLI && path.relative(localCLI, __filename) !== '') {
+ debug('Using local install of AVA');
+ require(localCLI); // eslint-disable-line import/no-dynamic-require
+} else {
+ if (debug.enabled) {
+ require('time-require'); // eslint-disable-line import/no-unassigned-import
+ }
+
+ try {
+ require('./lib/cli').run();
+ } catch (err) {
+ console.error(`\n ${err.message}`);
+ process.exit(1);
+ }
+}
diff --git a/node_modules/ava/index.js b/node_modules/ava/index.js
new file mode 100644
index 000000000..3640c4839
--- /dev/null
+++ b/node_modules/ava/index.js
@@ -0,0 +1,8 @@
+'use strict';
+
+// Ensure the same AVA install is loaded by the test file as by the test worker
+if (process.env.AVA_PATH && process.env.AVA_PATH !== __dirname) {
+ module.exports = require(process.env.AVA_PATH); // eslint-disable-line import/no-dynamic-require
+} else {
+ module.exports = require('./lib/main');
+}
diff --git a/node_modules/ava/index.js.flow b/node_modules/ava/index.js.flow
new file mode 100644
index 000000000..38670fc39
--- /dev/null
+++ b/node_modules/ava/index.js.flow
@@ -0,0 +1,201 @@
+/* @flow */
+
+/**
+ * Misc Setup Types
+ */
+
+type PromiseLike<R> = {
+ then<U>(
+ onFulfill?: (value: R) => Promise<U> | U,
+ onReject?: (error: any) => Promise<U> | U
+ ): Promise<U>;
+}
+
+type ObservableLike = {
+ subscribe(observer: (value: {}) => void): void;
+};
+
+type SpecialReturnTypes =
+ | PromiseLike<any>
+ | Iterator<any>
+ | ObservableLike;
+
+type Constructor = Class<{
+ constructor(...args: Array<any>): any
+}>;
+
+type ErrorValidator =
+ | Constructor
+ | RegExp
+ | string
+ | ((error: any) => boolean);
+
+/**
+ * Assertion Types
+ */
+
+type AssertContext = {
+ // Passing assertion.
+ pass(message?: string): void;
+ // Failing assertion.
+ fail(message?: string): void;
+ // Assert that value is truthy.
+ truthy(value: mixed, message?: string): void;
+ // Assert that value is falsy.
+ falsy(value: mixed, message?: string): void;
+ // Assert that value is true.
+ true(value: mixed, message?: string): void;
+ // Assert that value is false.
+ false(value: mixed, message?: string): void;
+ // Assert that value is equal to expected.
+ is<U>(value: U, expected: U, message?: string): void;
+ // Assert that value is not equal to expected.
+ not<U>(value: U, expected: U, message?: string): void;
+ // Assert that value is deep equal to expected.
+ deepEqual<U>(value: U, expected: U, message?: string): void;
+ // Assert that value is not deep equal to expected.
+ notDeepEqual<U>(value: U, expected: U, message?: string): void;
+ // Assert that function throws an error or promise rejects.
+ // @param error Can be a constructor, regex, error message or validation function.
+ throws: {
+ (value: PromiseLike<mixed>, error?: ErrorValidator, message?: string): Promise<Error>;
+ (value: () => mixed, error?: ErrorValidator, message?: string): Error;
+ };
+ // Assert that function doesn't throw an error or promise resolves.
+ notThrows: {
+ (value: PromiseLike<mixed>, message?: string): Promise<void>;
+ (value: () => mixed, message?: string): void;
+ };
+ // Assert that contents matches regex.
+ regex(contents: string, regex: RegExp, message?: string): void;
+ // Assert that contents matches a snapshot.
+ snapshot(contents: any, message?: string): void;
+ // Assert that contents does not match regex.
+ notRegex(contents: string, regex: RegExp, message?: string): void;
+ // Assert that error is falsy.
+ ifError(error: any, message?: string): void;
+};
+
+/**
+ * Context Types
+ */
+
+type TestContext = AssertContext & {
+ plan(count: number): void;
+ skip: AssertContext;
+};
+type CallbackTestContext = TestContext & { end(): void; };
+type ContextualTestContext = TestContext & { context: any; };
+type ContextualCallbackTestContext = CallbackTestContext & { context: any; };
+
+/**
+ * Test Implementations
+ */
+
+type TestFunction<T, R> = {
+ (t: T, ...args: Array<any>): R;
+ title?: (providedTitle: string, ...args: Array<any>) => string;
+};
+
+type TestImplementation<T, R> =
+ | TestFunction<T, R>
+ | Array<TestFunction<T, R>>;
+
+type Test = TestImplementation<TestContext, SpecialReturnTypes | void>;
+type CallbackTest = TestImplementation<CallbackTestContext, void>;
+type ContextualTest = TestImplementation<ContextualTestContext, SpecialReturnTypes | void>;
+type ContextualCallbackTest = TestImplementation<ContextualCallbackTestContext, void>;
+
+
+/**
+ * Method Types
+ */
+
+type TestMethod = {
+ ( implementation: Test): void;
+ (name: string, implementation: Test): void;
+
+ serial : TestMethod;
+ before : TestMethod;
+ after : TestMethod;
+ skip : TestMethod;
+ todo : TestMethod;
+ failing : TestMethod;
+ only : TestMethod;
+ beforeEach : TestMethod;
+ afterEach : TestMethod;
+ cb : CallbackTestMethod;
+ always : TestMethod;
+};
+
+type CallbackTestMethod = {
+ ( implementation: CallbackTest): void;
+ (name: string, implementation: CallbackTest): void;
+
+ serial : CallbackTestMethod;
+ before : CallbackTestMethod;
+ after : CallbackTestMethod;
+ skip : CallbackTestMethod;
+ todo : CallbackTestMethod;
+ failing : CallbackTestMethod;
+ only : CallbackTestMethod;
+ beforeEach : CallbackTestMethod;
+ afterEach : CallbackTestMethod;
+ cb : CallbackTestMethod;
+ always : CallbackTestMethod;
+};
+
+type ContextualTestMethod = {
+ ( implementation: ContextualTest): void;
+ (name: string, implementation: ContextualTest): void;
+
+ serial : ContextualTestMethod;
+ before : ContextualTestMethod;
+ after : ContextualTestMethod;
+ skip : ContextualTestMethod;
+ todo : ContextualTestMethod;
+ failing : ContextualTestMethod;
+ only : ContextualTestMethod;
+ beforeEach : ContextualTestMethod;
+ afterEach : ContextualTestMethod;
+ cb : ContextualCallbackTestMethod;
+ always : ContextualTestMethod;
+};
+
+type ContextualCallbackTestMethod = {
+ ( implementation: ContextualCallbackTest): void;
+ (name: string, implementation: ContextualCallbackTest): void;
+
+ serial : ContextualCallbackTestMethod;
+ before : ContextualCallbackTestMethod;
+ after : ContextualCallbackTestMethod;
+ skip : ContextualCallbackTestMethod;
+ todo : ContextualCallbackTestMethod;
+ failing : ContextualCallbackTestMethod;
+ only : ContextualCallbackTestMethod;
+ beforeEach : ContextualCallbackTestMethod;
+ afterEach : ContextualCallbackTestMethod;
+ cb : ContextualCallbackTestMethod;
+ always : ContextualCallbackTestMethod;
+};
+
+/**
+ * Public API
+ */
+
+declare module.exports: {
+ ( run: ContextualTest): void;
+ (name: string, run: ContextualTest): void;
+
+ beforeEach : ContextualTestMethod;
+ afterEach : ContextualTestMethod;
+ serial : ContextualTestMethod;
+ before : ContextualTestMethod;
+ after : ContextualTestMethod;
+ skip : ContextualTestMethod;
+ todo : ContextualTestMethod;
+ failing : ContextualTestMethod;
+ only : ContextualTestMethod;
+ cb : ContextualCallbackTestMethod;
+ always : ContextualTestMethod;
+};
diff --git a/node_modules/ava/lib/assert.js b/node_modules/ava/lib/assert.js
new file mode 100644
index 000000000..c16e11a1a
--- /dev/null
+++ b/node_modules/ava/lib/assert.js
@@ -0,0 +1,378 @@
+'use strict';
+const coreAssert = require('core-assert');
+const deepEqual = require('lodash.isequal');
+const observableToPromise = require('observable-to-promise');
+const isObservable = require('is-observable');
+const isPromise = require('is-promise');
+const jestDiff = require('jest-diff');
+const enhanceAssert = require('./enhance-assert');
+const formatAssertError = require('./format-assert-error');
+
+class AssertionError extends Error {
+ constructor(opts) {
+ super(opts.message || '');
+ this.name = 'AssertionError';
+
+ this.assertion = opts.assertion;
+ this.fixedSource = opts.fixedSource;
+ this.improperUsage = opts.improperUsage || false;
+ this.operator = opts.operator;
+ this.values = opts.values || [];
+
+ // Reserved for power-assert statements
+ this.statements = [];
+
+ if (opts.stack) {
+ this.stack = opts.stack;
+ }
+ }
+}
+exports.AssertionError = AssertionError;
+
+function getStack() {
+ const obj = {};
+ Error.captureStackTrace(obj, getStack);
+ return obj.stack;
+}
+
+function wrapAssertions(callbacks) {
+ const pass = callbacks.pass;
+ const pending = callbacks.pending;
+ const fail = callbacks.fail;
+
+ const noop = () => {};
+ const makeNoop = () => noop;
+ const makeRethrow = reason => () => {
+ throw reason;
+ };
+
+ const assertions = {
+ pass() {
+ pass(this);
+ },
+
+ fail(message) {
+ fail(this, new AssertionError({
+ assertion: 'fail',
+ message: message || 'Test failed via `t.fail()`'
+ }));
+ },
+
+ is(actual, expected, message) {
+ if (actual === expected) {
+ pass(this);
+ } else {
+ const diff = formatAssertError.formatDiff(actual, expected);
+ const values = diff ? [diff] : [
+ formatAssertError.formatWithLabel('Actual:', actual),
+ formatAssertError.formatWithLabel('Must be strictly equal to:', expected)
+ ];
+
+ fail(this, new AssertionError({
+ assertion: 'is',
+ message,
+ operator: '===',
+ values
+ }));
+ }
+ },
+
+ not(actual, expected, message) {
+ if (actual === expected) {
+ fail(this, new AssertionError({
+ assertion: 'not',
+ message,
+ operator: '!==',
+ values: [formatAssertError.formatWithLabel('Value is strictly equal:', actual)]
+ }));
+ } else {
+ pass(this);
+ }
+ },
+
+ deepEqual(actual, expected, message) {
+ if (deepEqual(actual, expected)) {
+ pass(this);
+ } else {
+ const diff = formatAssertError.formatDiff(actual, expected);
+ const values = diff ? [diff] : [
+ formatAssertError.formatWithLabel('Actual:', actual),
+ formatAssertError.formatWithLabel('Must be deeply equal to:', expected)
+ ];
+
+ fail(this, new AssertionError({
+ assertion: 'deepEqual',
+ message,
+ values
+ }));
+ }
+ },
+
+ notDeepEqual(actual, expected, message) {
+ if (deepEqual(actual, expected)) {
+ fail(this, new AssertionError({
+ assertion: 'notDeepEqual',
+ message,
+ values: [formatAssertError.formatWithLabel('Value is deeply equal:', actual)]
+ }));
+ } else {
+ pass(this);
+ }
+ },
+
+ throws(fn, err, message) {
+ let promise;
+ if (isPromise(fn)) {
+ promise = fn;
+ } else if (isObservable(fn)) {
+ promise = observableToPromise(fn);
+ } else if (typeof fn !== 'function') {
+ fail(this, new AssertionError({
+ assertion: 'throws',
+ improperUsage: true,
+ message: '`t.throws()` must be called with a function, Promise, or Observable',
+ values: [formatAssertError.formatWithLabel('Called with:', fn)]
+ }));
+ return;
+ }
+
+ let coreAssertThrowsErrorArg;
+ if (typeof err === 'string') {
+ const expectedMessage = err;
+ coreAssertThrowsErrorArg = error => error.message === expectedMessage;
+ } else {
+ // Assume it's a constructor function or regular expression
+ coreAssertThrowsErrorArg = err;
+ }
+
+ const test = (fn, stack) => {
+ let actual;
+ let threw = false;
+ try {
+ coreAssert.throws(() => {
+ try {
+ fn();
+ } catch (err) {
+ actual = err;
+ threw = true;
+ throw err;
+ }
+ }, coreAssertThrowsErrorArg);
+ return actual;
+ } catch (err) {
+ const values = threw ?
+ [formatAssertError.formatWithLabel('Threw unexpected exception:', actual)] :
+ null;
+
+ throw new AssertionError({
+ assertion: 'throws',
+ message,
+ stack,
+ values
+ });
+ }
+ };
+
+ if (promise) {
+ // Record stack before it gets lost in the promise chain.
+ const stack = getStack();
+ const intermediate = promise.then(makeNoop, makeRethrow).then(fn => test(fn, stack));
+ pending(this, intermediate);
+ // Don't reject the returned promise, even if the assertion fails.
+ return intermediate.catch(noop);
+ }
+
+ try {
+ const retval = test(fn);
+ pass(this);
+ return retval;
+ } catch (err) {
+ fail(this, err);
+ }
+ },
+
+ notThrows(fn, message) {
+ let promise;
+ if (isPromise(fn)) {
+ promise = fn;
+ } else if (isObservable(fn)) {
+ promise = observableToPromise(fn);
+ } else if (typeof fn !== 'function') {
+ fail(this, new AssertionError({
+ assertion: 'notThrows',
+ improperUsage: true,
+ message: '`t.notThrows()` must be called with a function, Promise, or Observable',
+ values: [formatAssertError.formatWithLabel('Called with:', fn)]
+ }));
+ return;
+ }
+
+ const test = (fn, stack) => {
+ try {
+ coreAssert.doesNotThrow(fn);
+ } catch (err) {
+ throw new AssertionError({
+ assertion: 'notThrows',
+ message,
+ stack,
+ values: [formatAssertError.formatWithLabel('Threw:', err.actual)]
+ });
+ }
+ };
+
+ if (promise) {
+ // Record stack before it gets lost in the promise chain.
+ const stack = getStack();
+ const intermediate = promise.then(noop, reason => test(makeRethrow(reason), stack));
+ pending(this, intermediate);
+ // Don't reject the returned promise, even if the assertion fails.
+ return intermediate.catch(noop);
+ }
+
+ try {
+ test(fn);
+ pass(this);
+ } catch (err) {
+ fail(this, err);
+ }
+ },
+
+ ifError(actual, message) {
+ if (actual) {
+ fail(this, new AssertionError({
+ assertion: 'ifError',
+ message,
+ values: [formatAssertError.formatWithLabel('Error:', actual)]
+ }));
+ } else {
+ pass(this);
+ }
+ },
+
+ snapshot(actual, message) {
+ const state = this._test.getSnapshotState();
+ const result = state.match(this.title, actual);
+ if (result.pass) {
+ pass(this);
+ } else {
+ const diff = jestDiff(result.expected.trim(), result.actual.trim(), {expand: true})
+ // Remove annotation
+ .split('\n')
+ .slice(3)
+ .join('\n');
+ fail(this, new AssertionError({
+ assertion: 'snapshot',
+ message: message || 'Did not match snapshot',
+ values: [{label: 'Difference:', formatted: diff}]
+ }));
+ }
+ }
+ };
+
+ const enhancedAssertions = enhanceAssert(pass, fail, {
+ truthy(actual, message) {
+ if (!actual) {
+ throw new AssertionError({
+ assertion: 'truthy',
+ message,
+ operator: '!!',
+ values: [formatAssertError.formatWithLabel('Value is not truthy:', actual)]
+ });
+ }
+ },
+
+ falsy(actual, message) {
+ if (actual) {
+ throw new AssertionError({
+ assertion: 'falsy',
+ message,
+ operator: '!',
+ values: [formatAssertError.formatWithLabel('Value is not falsy:', actual)]
+ });
+ }
+ },
+
+ true(actual, message) {
+ if (actual !== true) {
+ throw new AssertionError({
+ assertion: 'true',
+ message,
+ values: [formatAssertError.formatWithLabel('Value is not `true`:', actual)]
+ });
+ }
+ },
+
+ false(actual, message) {
+ if (actual !== false) {
+ throw new AssertionError({
+ assertion: 'false',
+ message,
+ values: [formatAssertError.formatWithLabel('Value is not `false`:', actual)]
+ });
+ }
+ },
+
+ regex(string, regex, message) {
+ if (typeof string !== 'string') {
+ throw new AssertionError({
+ assertion: 'regex',
+ improperUsage: true,
+ message: '`t.regex()` must be called with a string',
+ values: [formatAssertError.formatWithLabel('Called with:', string)]
+ });
+ }
+ if (!(regex instanceof RegExp)) {
+ throw new AssertionError({
+ assertion: 'regex',
+ improperUsage: true,
+ message: '`t.regex()` must be called with a regular expression',
+ values: [formatAssertError.formatWithLabel('Called with:', regex)]
+ });
+ }
+
+ if (!regex.test(string)) {
+ throw new AssertionError({
+ assertion: 'regex',
+ message,
+ values: [
+ formatAssertError.formatWithLabel('Value must match expression:', string),
+ formatAssertError.formatWithLabel('Regular expression:', regex)
+ ]
+ });
+ }
+ },
+
+ notRegex(string, regex, message) {
+ if (typeof string !== 'string') {
+ throw new AssertionError({
+ assertion: 'notRegex',
+ improperUsage: true,
+ message: '`t.notRegex()` must be called with a string',
+ values: [formatAssertError.formatWithLabel('Called with:', string)]
+ });
+ }
+ if (!(regex instanceof RegExp)) {
+ throw new AssertionError({
+ assertion: 'notRegex',
+ improperUsage: true,
+ message: '`t.notRegex()` must be called with a regular expression',
+ values: [formatAssertError.formatWithLabel('Called with:', regex)]
+ });
+ }
+
+ if (regex.test(string)) {
+ throw new AssertionError({
+ assertion: 'notRegex',
+ message,
+ values: [
+ formatAssertError.formatWithLabel('Value must not match expression:', string),
+ formatAssertError.formatWithLabel('Regular expression:', regex)
+ ]
+ });
+ }
+ }
+ });
+
+ return Object.assign(assertions, enhancedAssertions);
+}
+exports.wrapAssertions = wrapAssertions;
diff --git a/node_modules/ava/lib/ava-error.js b/node_modules/ava/lib/ava-error.js
new file mode 100644
index 000000000..05df6b349
--- /dev/null
+++ b/node_modules/ava/lib/ava-error.js
@@ -0,0 +1,10 @@
+'use strict';
+
+class AvaError extends Error {
+ constructor(message) {
+ super(message);
+ this.name = 'AvaError';
+ }
+}
+
+module.exports = AvaError;
diff --git a/node_modules/ava/lib/ava-files.js b/node_modules/ava/lib/ava-files.js
new file mode 100644
index 000000000..dd9a2ee6d
--- /dev/null
+++ b/node_modules/ava/lib/ava-files.js
@@ -0,0 +1,282 @@
+'use strict';
+const fs = require('fs');
+const path = require('path');
+const Promise = require('bluebird');
+const slash = require('slash');
+const globby = require('globby');
+const flatten = require('lodash.flatten');
+const autoBind = require('auto-bind');
+const defaultIgnore = require('ignore-by-default').directories();
+const multimatch = require('multimatch');
+
+function handlePaths(files, excludePatterns, globOptions) {
+ // Convert Promise to Bluebird
+ files = Promise.resolve(globby(files.concat(excludePatterns), globOptions));
+
+ const searchedParents = new Set();
+ const foundFiles = new Set();
+
+ function alreadySearchingParent(dir) {
+ if (searchedParents.has(dir)) {
+ return true;
+ }
+
+ const parentDir = path.dirname(dir);
+
+ if (parentDir === dir) {
+ // We have reached the root path
+ return false;
+ }
+
+ return alreadySearchingParent(parentDir);
+ }
+
+ return files
+ .map(file => {
+ file = path.resolve(globOptions.cwd, file);
+
+ if (fs.statSync(file).isDirectory()) {
+ if (alreadySearchingParent(file)) {
+ return null;
+ }
+
+ searchedParents.add(file);
+
+ let pattern = path.join(file, '**', '*.js');
+
+ if (process.platform === 'win32') {
+ // Always use `/` in patterns, harmonizing matching across platforms
+ pattern = slash(pattern);
+ }
+
+ return handlePaths([pattern], excludePatterns, globOptions);
+ }
+
+ // `globby` returns slashes even on Windows. Normalize here so the file
+ // paths are consistently platform-accurate as tests are run.
+ return path.normalize(file);
+ })
+ .then(flatten)
+ .filter(file => file && path.extname(file) === '.js')
+ .filter(file => {
+ if (path.basename(file)[0] === '_' && globOptions.includeUnderscoredFiles !== true) {
+ return false;
+ }
+
+ return true;
+ })
+ .map(file => path.resolve(file))
+ .filter(file => {
+ const alreadyFound = foundFiles.has(file);
+ foundFiles.add(file);
+ return !alreadyFound;
+ });
+}
+
+const defaultExcludePatterns = () => [
+ '!**/node_modules/**',
+ '!**/fixtures/**',
+ '!**/helpers/**'
+];
+
+const defaultIncludePatterns = () => [
+ 'test.js',
+ 'test-*.js',
+ 'test',
+ '**/__tests__',
+ '**/*.test.js'
+];
+
+const defaultHelperPatterns = () => [
+ '**/__tests__/helpers/**/*.js',
+ '**/__tests__/**/_*.js',
+ '**/test/helpers/**/*.js',
+ '**/test/**/_*.js'
+];
+
+const getDefaultIgnorePatterns = () => defaultIgnore.map(dir => `${dir}/**/*`);
+
+// Used on paths before they're passed to multimatch to harmonize matching
+// across platforms
+const matchable = process.platform === 'win32' ? slash : (path => path);
+
+class AvaFiles {
+ constructor(options) {
+ options = options || {};
+
+ let files = (options.files || []).map(file => {
+ // `./` should be removed from the beginning of patterns because
+ // otherwise they won't match change events from Chokidar
+ if (file.slice(0, 2) === './') {
+ return file.slice(2);
+ }
+
+ return file;
+ });
+
+ if (files.length === 0) {
+ files = defaultIncludePatterns();
+ }
+
+ this.excludePatterns = defaultExcludePatterns();
+ this.files = files;
+ this.sources = options.sources || [];
+ this.cwd = options.cwd || process.cwd();
+
+ autoBind(this);
+ }
+ findTestFiles() {
+ return handlePaths(this.files, this.excludePatterns, {
+ cwd: this.cwd,
+ cache: Object.create(null),
+ statCache: Object.create(null),
+ realpathCache: Object.create(null),
+ symlinks: Object.create(null)
+ });
+ }
+ findTestHelpers() {
+ return handlePaths(defaultHelperPatterns(), ['!**/node_modules/**'], {
+ cwd: this.cwd,
+ includeUnderscoredFiles: true,
+ cache: Object.create(null),
+ statCache: Object.create(null),
+ realpathCache: Object.create(null),
+ symlinks: Object.create(null)
+ });
+ }
+ isSource(filePath) {
+ let mixedPatterns = [];
+ const defaultIgnorePatterns = getDefaultIgnorePatterns();
+ const overrideDefaultIgnorePatterns = [];
+
+ let hasPositivePattern = false;
+ this.sources.forEach(pattern => {
+ mixedPatterns.push(pattern);
+
+ // TODO: Why not just `pattern[0] !== '!'`?
+ if (!hasPositivePattern && pattern[0] !== '!') {
+ hasPositivePattern = true;
+ }
+
+ // Extract patterns that start with an ignored directory. These need to be
+ // rematched separately.
+ if (defaultIgnore.indexOf(pattern.split('/')[0]) >= 0) {
+ overrideDefaultIgnorePatterns.push(pattern);
+ }
+ });
+
+ // Same defaults as used for Chokidar
+ if (!hasPositivePattern) {
+ mixedPatterns = ['package.json', '**/*.js'].concat(mixedPatterns);
+ }
+
+ filePath = matchable(filePath);
+
+ // Ignore paths outside the current working directory.
+ // They can't be matched to a pattern.
+ if (/^\.\.\//.test(filePath)) {
+ return false;
+ }
+
+ const isSource = multimatch(filePath, mixedPatterns).length === 1;
+ if (!isSource) {
+ return false;
+ }
+
+ const isIgnored = multimatch(filePath, defaultIgnorePatterns).length === 1;
+ if (!isIgnored) {
+ return true;
+ }
+
+ const isErroneouslyIgnored = multimatch(filePath, overrideDefaultIgnorePatterns).length === 1;
+ if (isErroneouslyIgnored) {
+ return true;
+ }
+
+ return false;
+ }
+ isTest(filePath) {
+ const excludePatterns = this.excludePatterns;
+ const initialPatterns = this.files.concat(excludePatterns);
+
+ // Like in `api.js`, tests must be `.js` files and not start with `_`
+ if (path.extname(filePath) !== '.js' || path.basename(filePath)[0] === '_') {
+ return false;
+ }
+
+ // Check if the entire path matches a pattern
+ if (multimatch(matchable(filePath), initialPatterns).length === 1) {
+ return true;
+ }
+
+ // Check if the path contains any directory components
+ const dirname = path.dirname(filePath);
+ if (dirname === '.') {
+ return false;
+ }
+
+ // Compute all possible subpaths. Note that the dirname is assumed to be
+ // relative to the working directory, without a leading `./`.
+ const subpaths = dirname.split(/[\\/]/).reduce((subpaths, component) => {
+ const parent = subpaths[subpaths.length - 1];
+
+ if (parent) {
+ // Always use `/`` to makes multimatch consistent across platforms
+ subpaths.push(`${parent}/${component}`);
+ } else {
+ subpaths.push(component);
+ }
+
+ return subpaths;
+ }, []);
+
+ // Check if any of the possible subpaths match a pattern. If so, generate a
+ // new pattern with **/*.js.
+ const recursivePatterns = subpaths
+ .filter(subpath => multimatch(subpath, initialPatterns).length === 1)
+ // Always use `/` to makes multimatch consistent across platforms
+ .map(subpath => `${subpath}/**/*.js`);
+
+ // See if the entire path matches any of the subpaths patterns, taking the
+ // excludePatterns into account. This mimicks the behavior in api.js
+ return multimatch(matchable(filePath), recursivePatterns.concat(excludePatterns)).length === 1;
+ }
+ getChokidarPatterns() {
+ let paths = [];
+ let ignored = [];
+
+ this.sources.forEach(pattern => {
+ if (pattern[0] === '!') {
+ ignored.push(pattern.slice(1));
+ } else {
+ paths.push(pattern);
+ }
+ });
+
+ // Allow source patterns to override the default ignore patterns. Chokidar
+ // ignores paths that match the list of ignored patterns. It uses anymatch
+ // under the hood, which supports negation patterns. For any source pattern
+ // that starts with an ignored directory, ensure the corresponding negation
+ // pattern is added to the ignored paths.
+ const overrideDefaultIgnorePatterns = paths
+ .filter(pattern => defaultIgnore.indexOf(pattern.split('/')[0]) >= 0)
+ .map(pattern => `!${pattern}`);
+
+ ignored = getDefaultIgnorePatterns().concat(ignored, overrideDefaultIgnorePatterns);
+
+ if (paths.length === 0) {
+ paths = ['package.json', '**/*.js'];
+ }
+
+ paths = paths.concat(this.files);
+
+ return {
+ paths,
+ ignored
+ };
+ }
+}
+
+module.exports = AvaFiles;
+module.exports.defaultIncludePatterns = defaultIncludePatterns;
+module.exports.defaultExcludePatterns = defaultExcludePatterns;
diff --git a/node_modules/ava/lib/babel-config.js b/node_modules/ava/lib/babel-config.js
new file mode 100644
index 000000000..c3be0dcfb
--- /dev/null
+++ b/node_modules/ava/lib/babel-config.js
@@ -0,0 +1,148 @@
+'use strict';
+const fs = require('fs');
+const path = require('path');
+const chalk = require('chalk');
+const figures = require('figures');
+const configManager = require('hullabaloo-config-manager');
+const md5Hex = require('md5-hex');
+const mkdirp = require('mkdirp');
+const colors = require('./colors');
+
+function validate(conf) {
+ if (conf === undefined || conf === null) {
+ conf = 'default';
+ }
+
+ // Check for valid babel config shortcuts (can be either `default` or `inherit`)
+ const isValidShortcut = conf === 'default' || conf === 'inherit';
+
+ if (!conf || (typeof conf === 'string' && !isValidShortcut)) {
+ let message = colors.error(figures.cross);
+ message += ' Unexpected Babel configuration for AVA. ';
+ message += 'See ' + chalk.underline('https://github.com/avajs/ava#es2015-support') + ' for allowed values.';
+
+ throw new Error(message);
+ }
+
+ return conf;
+}
+
+const SOURCE = '(AVA) Base Babel config';
+const AVA_DIR = path.join(__dirname, '..');
+
+function verifyExistingOptions(verifierFile, baseConfig, cache) {
+ return new Promise((resolve, reject) => {
+ try {
+ resolve(fs.readFileSync(verifierFile));
+ } catch (err) {
+ if (err && err.code === 'ENOENT') {
+ resolve(null);
+ } else {
+ reject(err);
+ }
+ }
+ })
+ .then(buffer => {
+ if (!buffer) {
+ return null;
+ }
+
+ const verifier = configManager.restoreVerifier(buffer);
+ const fixedSourceHashes = new Map();
+ fixedSourceHashes.set(baseConfig.source, baseConfig.hash);
+ if (baseConfig.extends) {
+ fixedSourceHashes.set(baseConfig.extends.source, baseConfig.extends.hash);
+ }
+ return verifier.verifyCurrentEnv({sources: fixedSourceHashes}, cache)
+ .then(result => {
+ if (!result.cacheKeys) {
+ return null;
+ }
+
+ if (result.dependenciesChanged) {
+ fs.writeFileSync(verifierFile, result.verifier.toBuffer());
+ }
+
+ return result.cacheKeys;
+ });
+ });
+}
+
+function resolveOptions(baseConfig, cache, optionsFile, verifierFile) {
+ return configManager.fromConfig(baseConfig, {cache})
+ .then(result => {
+ fs.writeFileSync(optionsFile, result.generateModule());
+
+ return result.createVerifier()
+ .then(verifier => {
+ fs.writeFileSync(verifierFile, verifier.toBuffer());
+ return verifier.cacheKeysForCurrentEnv();
+ });
+ });
+}
+
+function build(projectDir, cacheDir, userOptions, powerAssert) {
+ // Compute a seed based on the Node.js version and the project directory.
+ // Dependency hashes may vary based on the Node.js version, e.g. with the
+ // @ava/stage-4 Babel preset. Sources and dependencies paths are absolute in
+ // the generated module and verifier state. Those paths wouldn't necessarily
+ // be valid if the project directory changes.
+ const seed = md5Hex([process.versions.node, projectDir]);
+
+ // Ensure cacheDir exists
+ mkdirp.sync(cacheDir);
+
+ // The file names predict where valid options may be cached, and thus should
+ // include the seed.
+ const optionsFile = path.join(cacheDir, `${seed}.babel-options.js`);
+ const verifierFile = path.join(cacheDir, `${seed}.verifier.bin`);
+
+ const baseOptions = {
+ babelrc: false,
+ presets: [
+ ['@ava/transform-test-files', {powerAssert}]
+ ]
+ };
+ if (userOptions === 'default') {
+ baseOptions.presets.unshift('@ava/stage-4');
+ }
+
+ const baseConfig = configManager.createConfig({
+ dir: AVA_DIR, // Presets are resolved relative to this directory
+ hash: md5Hex(JSON.stringify(baseOptions)),
+ json5: false,
+ options: baseOptions,
+ source: SOURCE
+ });
+
+ if (userOptions !== 'default') {
+ baseConfig.extend(configManager.createConfig({
+ dir: projectDir,
+ options: userOptions === 'inherit' ?
+ {babelrc: true} :
+ userOptions,
+ source: path.join(projectDir, 'package.json') + '#ava.babel',
+ hash: md5Hex(JSON.stringify(userOptions))
+ }));
+ }
+
+ const cache = configManager.prepareCache();
+ return verifyExistingOptions(verifierFile, baseConfig, cache)
+ .then(cacheKeys => {
+ if (cacheKeys) {
+ return cacheKeys;
+ }
+
+ return resolveOptions(baseConfig, cache, optionsFile, verifierFile);
+ })
+ .then(cacheKeys => ({
+ getOptions: require(optionsFile).getOptions, // eslint-disable-line import/no-dynamic-require
+ // Include the seed in the cache keys used to store compilation results.
+ cacheKeys: Object.assign({seed}, cacheKeys)
+ }));
+}
+
+module.exports = {
+ validate,
+ build
+};
diff --git a/node_modules/ava/lib/beautify-stack.js b/node_modules/ava/lib/beautify-stack.js
new file mode 100644
index 000000000..189ed0714
--- /dev/null
+++ b/node_modules/ava/lib/beautify-stack.js
@@ -0,0 +1,37 @@
+'use strict';
+const StackUtils = require('stack-utils');
+const cleanStack = require('clean-stack');
+const debug = require('debug')('ava');
+
+// Ignore unimportant stack trace lines
+let ignoreStackLines = [];
+
+const avaInternals = /\/ava\/(?:lib\/)?[\w-]+\.js:\d+:\d+\)?$/;
+const avaDependencies = /\/node_modules\/(?:bluebird|empower-core|(?:ava\/node_modules\/)?(?:babel-runtime|core-js))\//;
+
+if (!debug.enabled) {
+ ignoreStackLines = StackUtils.nodeInternals();
+ ignoreStackLines.push(avaInternals);
+ ignoreStackLines.push(avaDependencies);
+}
+
+const stackUtils = new StackUtils({internals: ignoreStackLines});
+
+module.exports = stack => {
+ if (!stack) {
+ return '';
+ }
+
+ // Workaround for https://github.com/tapjs/stack-utils/issues/14
+ // TODO: fix it in `stack-utils`
+ stack = cleanStack(stack);
+
+ const title = stack.split('\n')[0];
+ const lines = stackUtils
+ .clean(stack)
+ .split('\n')
+ .map(x => ` ${x}`)
+ .join('\n');
+
+ return `${title}\n${lines}`;
+};
diff --git a/node_modules/ava/lib/caching-precompiler.js b/node_modules/ava/lib/caching-precompiler.js
new file mode 100644
index 000000000..937309bf0
--- /dev/null
+++ b/node_modules/ava/lib/caching-precompiler.js
@@ -0,0 +1,103 @@
+'use strict';
+const path = require('path');
+const fs = require('fs');
+const convertSourceMap = require('convert-source-map');
+const cachingTransform = require('caching-transform');
+const packageHash = require('package-hash');
+const stripBomBuf = require('strip-bom-buf');
+const autoBind = require('auto-bind');
+const md5Hex = require('md5-hex');
+
+function getSourceMap(filePath, code) {
+ let sourceMap = convertSourceMap.fromSource(code);
+
+ if (!sourceMap) {
+ const dirPath = path.dirname(filePath);
+ sourceMap = convertSourceMap.fromMapFileSource(code, dirPath);
+ }
+
+ if (sourceMap) {
+ sourceMap = sourceMap.toObject();
+ }
+
+ return sourceMap;
+}
+
+class CachingPrecompiler {
+ constructor(options) {
+ autoBind(this);
+
+ this.getBabelOptions = options.getBabelOptions;
+ this.babelCacheKeys = options.babelCacheKeys;
+ this.cacheDirPath = options.path;
+ this.fileHashes = {};
+ this.transform = this._createTransform();
+ }
+ precompileFile(filePath) {
+ if (!this.fileHashes[filePath]) {
+ const source = stripBomBuf(fs.readFileSync(filePath));
+ this.transform(source, filePath);
+ }
+
+ return this.fileHashes[filePath];
+ }
+ // Conditionally called by caching-transform when precompiling is required
+ _init() {
+ this.babel = require('babel-core');
+ return this._transform;
+ }
+ _transform(code, filePath, hash) {
+ code = code.toString();
+
+ let result;
+ const originalBabelDisableCache = process.env.BABEL_DISABLE_CACHE;
+ try {
+ // Disable Babel's cache. AVA has good cache management already.
+ process.env.BABEL_DISABLE_CACHE = '1';
+
+ result = this.babel.transform(code, Object.assign(this.getBabelOptions(), {
+ inputSourceMap: getSourceMap(filePath, code),
+ filename: filePath,
+ sourceMaps: true,
+ ast: false
+ }));
+ } finally {
+ // Restore the original value. It is passed to workers, where users may
+ // not want Babel's cache to be disabled.
+ process.env.BABEL_DISABLE_CACHE = originalBabelDisableCache;
+ }
+
+ // Save source map
+ const 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
+ const dirPath = path.dirname(filePath);
+ const relativeMapPath = path.relative(dirPath, mapPath);
+ const comment = convertSourceMap.generateMapFileComment(relativeMapPath);
+
+ return `${result.code}\n${comment}`;
+ }
+ _createTransform() {
+ const salt = packageHash.sync([
+ require.resolve('../package.json'),
+ require.resolve('babel-core/package.json')
+ ], this.babelCacheKeys);
+
+ return cachingTransform({
+ factory: this._init,
+ cacheDir: this.cacheDirPath,
+ hash: this._generateHash,
+ salt,
+ ext: '.js'
+ });
+ }
+ _generateHash(code, filePath, salt) {
+ const hash = md5Hex([code, filePath, salt]);
+ this.fileHashes[filePath] = hash;
+ return hash;
+ }
+}
+
+module.exports = CachingPrecompiler;
diff --git a/node_modules/ava/lib/cli.js b/node_modules/ava/lib/cli.js
new file mode 100644
index 000000000..f6213f107
--- /dev/null
+++ b/node_modules/ava/lib/cli.js
@@ -0,0 +1,200 @@
+'use strict';
+const path = require('path');
+const updateNotifier = require('update-notifier');
+const figures = require('figures');
+const arrify = require('arrify');
+const meow = require('meow');
+const Promise = require('bluebird');
+const pkgConf = require('pkg-conf');
+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 Logger = require('./logger');
+const Watcher = require('./watcher');
+const babelConfigHelper = require('./babel-config');
+
+// Bluebird specific
+Promise.longStackTraces();
+
+exports.run = () => {
+ const conf = pkgConf.sync('ava');
+
+ const filepath = pkgConf.filepath(conf);
+ const projectDir = filepath === null ? process.cwd() : path.dirname(filepath);
+
+ const cli = meow(`
+ Usage
+ ava [<file|directory|glob> ...]
+
+ Options
+ --init Add AVA to your project
+ --fail-fast Stop after first test failure
+ --serial, -s Run tests serially
+ --tap, -t Generate TAP output
+ --verbose, -v Enable verbose output
+ --no-cache Disable the transpiler cache
+ --no-power-assert Disable Power Assert
+ --color Force color output
+ --no-color Disable color output
+ --match, -m Only run tests with matching title (Can be repeated)
+ --watch, -w Re-run tests when tests and source files change
+ --timeout, -T Set global timeout
+ --concurrency, -c Maximum number of test files running at the same time (EXPERIMENTAL)
+ --update-snapshots, -u Update snapshots
+
+ Examples
+ ava
+ ava test.js test2.js
+ ava test-*.js
+ ava test
+ ava --init
+ ava --init foo.js
+
+ Default patterns when no arguments:
+ test.js test-*.js test/**/*.js **/__tests__/**/*.js **/*.test.js
+ `, {
+ string: [
+ '_',
+ 'match',
+ 'timeout',
+ 'concurrency'
+ ],
+ boolean: [
+ 'init',
+ 'fail-fast',
+ 'serial',
+ 'tap',
+ 'verbose',
+ 'watch',
+ 'update-snapshots',
+ 'color'
+ ],
+ default: {
+ cache: conf.cache,
+ color: 'color' in conf ? conf.color : require('supports-color') !== false,
+ concurrency: conf.concurrency,
+ failFast: conf.failFast,
+ init: conf.init,
+ match: conf.match,
+ powerAssert: conf.powerAssert,
+ serial: conf.serial,
+ tap: conf.tap,
+ timeout: conf.timeout,
+ updateSnapshots: conf.updateSnapshots,
+ verbose: conf.verbose,
+ watch: conf.watch
+ },
+ alias: {
+ t: 'tap',
+ v: 'verbose',
+ s: 'serial',
+ m: 'match',
+ w: 'watch',
+ T: 'timeout',
+ c: 'concurrency',
+ u: 'update-snapshots'
+ }
+ });
+
+ updateNotifier({pkg: cli.pkg}).notify();
+
+ if (cli.flags.init) {
+ require('ava-init')();
+ return;
+ }
+
+ if (
+ ((hasFlag('--watch') || hasFlag('-w')) && (hasFlag('--tap') || hasFlag('-t'))) ||
+ (conf.watch && conf.tap)
+ ) {
+ throw new Error(colors.error(figures.cross) + ' The TAP reporter is not available when using watch mode.');
+ }
+
+ if ((hasFlag('--watch') || hasFlag('-w')) && isCi) {
+ throw new Error(colors.error(figures.cross) + ' Watch mode is not available in CI, as it prevents AVA from terminating.');
+ }
+
+ if (hasFlag('--require') || hasFlag('-r')) {
+ throw new Error(colors.error(figures.cross) + ' The --require and -r flags are deprecated. Requirements should be configured in package.json - see documentation.');
+ }
+
+ // Copy resultant cli.flags into conf for use with Api and elsewhere
+ Object.assign(conf, cli.flags);
+
+ const api = new Api({
+ failFast: conf.failFast,
+ failWithoutAssertions: conf.failWithoutAssertions !== false,
+ serial: conf.serial,
+ require: arrify(conf.require),
+ cacheEnabled: conf.cache !== false,
+ powerAssert: conf.powerAssert !== false,
+ explicitTitles: conf.watch,
+ match: arrify(conf.match),
+ babelConfig: babelConfigHelper.validate(conf.babel),
+ resolveTestsFrom: cli.input.length === 0 ? projectDir : process.cwd(),
+ projectDir,
+ timeout: conf.timeout,
+ concurrency: conf.concurrency ? parseInt(conf.concurrency, 10) : 0,
+ updateSnapshots: conf.updateSnapshots,
+ color: conf.color
+ });
+
+ let reporter;
+
+ if (conf.tap && !conf.watch) {
+ reporter = new TapReporter();
+ } else if (conf.verbose || isCi) {
+ reporter = new VerboseReporter({color: conf.color});
+ } else {
+ reporter = new MiniReporter({color: conf.color, watching: conf.watch});
+ }
+
+ reporter.api = api;
+ const logger = new Logger(reporter);
+
+ logger.start();
+
+ api.on('test-run', runStatus => {
+ reporter.api = runStatus;
+ runStatus.on('test', logger.test);
+ runStatus.on('error', logger.unhandledError);
+
+ runStatus.on('stdout', logger.stdout);
+ runStatus.on('stderr', logger.stderr);
+ });
+
+ const files = cli.input.length ? cli.input : arrify(conf.files);
+
+ if (conf.watch) {
+ try {
+ const watcher = new Watcher(logger, api, files, arrify(conf.source));
+ watcher.observeStdin(process.stdin);
+ } catch (err) {
+ if (err.name === 'AvaError') {
+ // An AvaError may be thrown if `chokidar` is not installed. Log it nicely.
+ console.error(` ${colors.error(figures.cross)} ${err.message}`);
+ logger.exit(1);
+ } else {
+ // Rethrow so it becomes an uncaught exception
+ throw err;
+ }
+ }
+ } else {
+ api.run(files)
+ .then(runStatus => {
+ logger.finish(runStatus);
+ logger.exit(runStatus.failCount > 0 || runStatus.rejectionCount > 0 || runStatus.exceptionCount > 0 ? 1 : 0);
+ })
+ .catch(err => {
+ // Don't swallow exceptions. Note that any expected error should already
+ // have been logged.
+ setImmediate(() => {
+ throw err;
+ });
+ });
+ }
+};
diff --git a/node_modules/ava/lib/code-excerpt.js b/node_modules/ava/lib/code-excerpt.js
new file mode 100644
index 000000000..aa619a0b2
--- /dev/null
+++ b/node_modules/ava/lib/code-excerpt.js
@@ -0,0 +1,57 @@
+'use strict';
+const fs = require('fs');
+const equalLength = require('equal-length');
+const codeExcerpt = require('code-excerpt');
+const truncate = require('cli-truncate');
+const chalk = require('chalk');
+
+const formatLineNumber = (lineNumber, maxLineNumber) =>
+ ' '.repeat(Math.max(0, String(maxLineNumber).length - String(lineNumber).length)) + lineNumber;
+
+module.exports = (source, options) => {
+ if (!source.isWithinProject || source.isDependency) {
+ return null;
+ }
+
+ const file = source.file;
+ const line = source.line;
+
+ options = options || {};
+ const maxWidth = options.maxWidth || 80;
+
+ let contents;
+ try {
+ contents = fs.readFileSync(file, 'utf8');
+ } catch (err) {
+ return null;
+ }
+
+ const excerpt = codeExcerpt(contents, line, {around: 1});
+ if (!excerpt) {
+ return null;
+ }
+
+ const lines = excerpt.map(item => ({
+ line: item.line,
+ value: truncate(item.value, maxWidth - String(line).length - 5)
+ }));
+
+ const joinedLines = lines.map(line => line.value).join('\n');
+ const extendedLines = equalLength(joinedLines).split('\n');
+
+ return lines
+ .map((item, index) => ({
+ line: item.line,
+ value: extendedLines[index]
+ }))
+ .map(item => {
+ const isErrorSource = item.line === line;
+
+ const lineNumber = formatLineNumber(item.line, line) + ':';
+ const coloredLineNumber = isErrorSource ? lineNumber : chalk.grey(lineNumber);
+ const result = ` ${coloredLineNumber} ${item.value}`;
+
+ return isErrorSource ? chalk.bgRed(result) : result;
+ })
+ .join('\n');
+};
diff --git a/node_modules/ava/lib/colors.js b/node_modules/ava/lib/colors.js
new file mode 100644
index 000000000..74be14bb1
--- /dev/null
+++ b/node_modules/ava/lib/colors.js
@@ -0,0 +1,15 @@
+'use strict';
+const chalk = require('chalk');
+
+module.exports = {
+ title: chalk.bold.white,
+ error: chalk.red,
+ skip: chalk.yellow,
+ todo: chalk.blue,
+ pass: chalk.green,
+ duration: chalk.gray.dim,
+ errorSource: chalk.gray,
+ errorStack: chalk.gray,
+ stack: chalk.red,
+ information: chalk.magenta
+};
diff --git a/node_modules/ava/lib/concurrent.js b/node_modules/ava/lib/concurrent.js
new file mode 100644
index 000000000..3cdbb41c3
--- /dev/null
+++ b/node_modules/ava/lib/concurrent.js
@@ -0,0 +1,64 @@
+'use strict';
+
+class Concurrent {
+ constructor(runnables, bail) {
+ if (!Array.isArray(runnables)) {
+ throw new TypeError('Expected an array of runnables');
+ }
+
+ this.runnables = runnables;
+ this.bail = bail || false;
+ }
+
+ run() {
+ let allPassed = true;
+
+ let pending;
+ let rejectPending;
+ let resolvePending;
+ const allPromises = [];
+ const handlePromise = promise => {
+ if (!pending) {
+ pending = new Promise((resolve, reject) => {
+ rejectPending = reject;
+ resolvePending = resolve;
+ });
+ }
+
+ allPromises.push(promise.then(passed => {
+ if (!passed) {
+ allPassed = false;
+
+ if (this.bail) {
+ // Stop if the test failed and bail mode is on.
+ resolvePending();
+ }
+ }
+ }, rejectPending));
+ };
+
+ for (const runnable of this.runnables) {
+ const passedOrPromise = runnable.run();
+
+ if (!passedOrPromise) {
+ if (this.bail) {
+ // Stop if the test failed and bail mode is on.
+ return false;
+ }
+
+ allPassed = false;
+ } else if (passedOrPromise !== true) {
+ handlePromise(passedOrPromise);
+ }
+ }
+
+ if (pending) {
+ Promise.all(allPromises).then(resolvePending);
+ return pending.then(() => allPassed);
+ }
+
+ return allPassed;
+ }
+}
+
+module.exports = Concurrent;
diff --git a/node_modules/ava/lib/enhance-assert.js b/node_modules/ava/lib/enhance-assert.js
new file mode 100644
index 000000000..7808765b7
--- /dev/null
+++ b/node_modules/ava/lib/enhance-assert.js
@@ -0,0 +1,63 @@
+'use strict';
+const dotProp = require('dot-prop');
+const formatValue = require('./format-assert-error').formatValue;
+
+// When adding patterns, don't forget to add to
+// https://github.com/avajs/babel-preset-transform-test-files/blob/master/espower-patterns.json
+// Then release a new version of that preset and bump the SemVer range here.
+const PATTERNS = [
+ 't.truthy(value, [message])',
+ 't.falsy(value, [message])',
+ 't.true(value, [message])',
+ 't.false(value, [message])',
+ 't.regex(contents, regex, [message])',
+ 't.notRegex(contents, regex, [message])'
+];
+
+const isRangeMatch = (a, b) => {
+ return (a[0] === b[0] && a[1] === b[1]) ||
+ (a[0] > b[0] && a[0] < b[1]) ||
+ (a[1] > b[0] && a[1] < b[1]);
+};
+
+const computeStatement = (tokens, range) => {
+ return tokens
+ .filter(token => isRangeMatch(token.range, range))
+ .map(token => token.value === undefined ? token.type.label : token.value)
+ .join('');
+};
+
+const getNode = (ast, path) => dotProp.get(ast, path.replace(/\//g, '.'));
+
+const formatter = context => {
+ const ast = JSON.parse(context.source.ast);
+ const tokens = JSON.parse(context.source.tokens);
+ const args = context.args[0].events;
+
+ return args
+ .map(arg => {
+ const range = getNode(ast, arg.espath).range;
+ return [computeStatement(tokens, range), formatValue(arg.value, {maxDepth: 1})];
+ })
+ .reverse();
+};
+
+const enhanceAssert = (pass, fail, assertions) => {
+ const empower = require('empower-core');
+ return empower(assertions, {
+ destructive: true,
+ onError(event) {
+ const error = event.error;
+ if (event.powerAssertContext) { // Context may be missing in internal tests.
+ error.statements = formatter(event.powerAssertContext);
+ }
+ fail(this, error);
+ },
+ onSuccess() {
+ pass(this);
+ },
+ patterns: PATTERNS,
+ bindReceiver: false
+ });
+};
+module.exports = enhanceAssert;
diff --git a/node_modules/ava/lib/extract-stack.js b/node_modules/ava/lib/extract-stack.js
new file mode 100644
index 000000000..64f63db1c
--- /dev/null
+++ b/node_modules/ava/lib/extract-stack.js
@@ -0,0 +1,10 @@
+'use strict';
+const stackLineRegex = /^.+ \(.+:[0-9]+:[0-9]+\)$/;
+
+module.exports = stack => {
+ return stack
+ .split('\n')
+ .filter(line => stackLineRegex.test(line))
+ .map(line => line.trim())
+ .join('\n');
+};
diff --git a/node_modules/ava/lib/fork.js b/node_modules/ava/lib/fork.js
new file mode 100644
index 000000000..bf918d391
--- /dev/null
+++ b/node_modules/ava/lib/fork.js
@@ -0,0 +1,178 @@
+'use strict';
+const childProcess = require('child_process');
+const path = require('path');
+const fs = require('fs');
+const Promise = require('bluebird');
+const debug = require('debug')('ava');
+const AvaError = require('./ava-error');
+
+if (fs.realpathSync(__filename) !== __filename) {
+ console.warn('WARNING: `npm link ava` and the `--preserve-symlink` flag are incompatible. We have detected that AVA is linked via `npm link`, and that you are using either an early version of Node 6, or the `--preserve-symlink` flag. This breaks AVA. You should upgrade to Node 6.2.0+, avoid the `--preserve-symlink` flag, or avoid using `npm link ava`.');
+}
+
+let env = process.env;
+
+// Ensure NODE_PATH paths are absolute
+if (env.NODE_PATH) {
+ env = Object.assign({}, env);
+
+ env.NODE_PATH = env.NODE_PATH
+ .split(path.delimiter)
+ .map(x => path.resolve(x))
+ .join(path.delimiter);
+}
+
+// In case the test file imports a different AVA install,
+// the presence of this variable allows it to require this one instead
+env.AVA_PATH = path.resolve(__dirname, '..');
+
+module.exports = (file, opts, execArgv) => {
+ opts = Object.assign({
+ file,
+ baseDir: process.cwd(),
+ tty: process.stdout.isTTY ? {
+ columns: process.stdout.columns,
+ rows: process.stdout.rows
+ } : false
+ }, opts);
+
+ const args = [JSON.stringify(opts), opts.color ? '--color' : '--no-color'];
+
+ const ps = childProcess.fork(path.join(__dirname, 'test-worker.js'), args, {
+ cwd: opts.projectDir,
+ silent: true,
+ env,
+ execArgv: execArgv || process.execArgv
+ });
+
+ const relFile = path.relative('.', file);
+
+ let exiting = false;
+ const send = (name, data) => {
+ if (!exiting) {
+ // This seems to trigger a Node bug which kills the AVA master process, at
+ // least while running AVA's tests. See
+ // <https://github.com/novemberborn/_ava-tap-crash> for more details.
+ ps.send({
+ name: `ava-${name}`,
+ data,
+ ava: true
+ });
+ }
+ };
+
+ const testResults = [];
+ let results;
+
+ const promise = new Promise((resolve, reject) => {
+ ps.on('error', reject);
+
+ // Emit `test` and `stats` events
+ ps.on('message', event => {
+ if (!event.ava) {
+ return;
+ }
+
+ event.name = event.name.replace(/^ava-/, '');
+ event.data.file = relFile;
+
+ debug('ipc %s:\n%o', event.name, event.data);
+
+ ps.emit(event.name, event.data);
+ });
+
+ ps.on('test', props => {
+ testResults.push(props);
+ });
+
+ ps.on('results', data => {
+ results = data;
+ data.tests = testResults;
+ send('teardown');
+ });
+
+ ps.on('exit', (code, signal) => {
+ if (code > 0) {
+ return reject(new AvaError(`${relFile} exited with a non-zero exit code: ${code}`));
+ }
+
+ if (code === null && signal) {
+ return reject(new AvaError(`${relFile} exited due to ${signal}`));
+ }
+
+ if (results) {
+ resolve(results);
+ } else {
+ reject(new AvaError(`Test results were not received from ${relFile}`));
+ }
+ });
+
+ ps.on('no-tests', data => {
+ send('teardown');
+
+ let message = `No tests found in ${relFile}`;
+
+ if (!data.avaRequired) {
+ message += ', make sure to import "ava" at the top of your test file';
+ }
+
+ reject(new AvaError(message));
+ });
+ });
+
+ // Teardown finished, now exit
+ ps.on('teardown', () => {
+ send('exit');
+ exiting = true;
+ });
+
+ // Uncaught exception in fork, need to exit
+ ps.on('uncaughtException', () => {
+ send('teardown');
+ });
+
+ ps.stdout.on('data', data => {
+ ps.emit('stdout', data);
+ });
+
+ ps.stderr.on('data', data => {
+ ps.emit('stderr', data);
+ });
+
+ promise.on = function () {
+ ps.on.apply(ps, arguments);
+ return promise;
+ };
+
+ promise.send = (name, data) => {
+ send(name, data);
+ return promise;
+ };
+
+ promise.exit = () => {
+ send('init-exit');
+ return promise;
+ };
+
+ // Send 'run' event only when fork is listening for it
+ let isReady = false;
+
+ ps.on('stats', () => {
+ isReady = true;
+ });
+
+ promise.run = options => {
+ if (isReady) {
+ send('run', options);
+ return promise;
+ }
+
+ ps.on('stats', () => {
+ send('run', options);
+ });
+
+ return promise;
+ };
+
+ return promise;
+};
diff --git a/node_modules/ava/lib/format-assert-error.js b/node_modules/ava/lib/format-assert-error.js
new file mode 100644
index 000000000..a899af463
--- /dev/null
+++ b/node_modules/ava/lib/format-assert-error.js
@@ -0,0 +1,121 @@
+'use strict';
+const prettyFormat = require('@ava/pretty-format');
+const reactTestPlugin = require('@ava/pretty-format/plugins/ReactTestComponent');
+const chalk = require('chalk');
+const diff = require('diff');
+const DiffMatchPatch = require('diff-match-patch');
+const indentString = require('indent-string');
+const globals = require('./globals');
+
+function formatValue(value, options) {
+ return prettyFormat(value, Object.assign({
+ callToJSON: false,
+ plugins: [reactTestPlugin],
+ highlight: globals.options.color !== false
+ }, options));
+}
+exports.formatValue = formatValue;
+
+const cleanUp = line => {
+ if (line[0] === '+') {
+ return `${chalk.green('+')} ${line.slice(1)}`;
+ }
+
+ if (line[0] === '-') {
+ return `${chalk.red('-')} ${line.slice(1)}`;
+ }
+
+ if (line.match(/@@/)) {
+ return null;
+ }
+
+ if (line.match(/\\ No newline/)) {
+ return null;
+ }
+
+ return ` ${line}`;
+};
+
+const getType = value => {
+ const type = typeof value;
+ if (type === 'object') {
+ if (type === null) {
+ return 'null';
+ }
+ if (Array.isArray(value)) {
+ return 'array';
+ }
+ }
+ return type;
+};
+
+function formatDiff(actual, expected) {
+ const actualType = getType(actual);
+ const expectedType = getType(expected);
+ if (actualType !== expectedType) {
+ return null;
+ }
+
+ if (actualType === 'array' || actualType === 'object') {
+ const formatted = diff.createPatch('string', formatValue(actual), formatValue(expected))
+ .split('\n')
+ .slice(4)
+ .map(cleanUp)
+ .filter(Boolean)
+ .join('\n')
+ .trimRight();
+
+ return {label: 'Difference:', formatted};
+ }
+
+ if (actualType === 'string') {
+ const formatted = new DiffMatchPatch()
+ .diff_main(formatValue(actual, {highlight: false}), formatValue(expected, {highlight: false}))
+ .map(part => {
+ if (part[0] === 1) {
+ return chalk.bgGreen.black(part[1]);
+ }
+
+ if (part[0] === -1) {
+ return chalk.bgRed.black(part[1]);
+ }
+
+ return chalk.red(part[1]);
+ })
+ .join('')
+ .trimRight();
+
+ return {label: 'Difference:', formatted};
+ }
+
+ return null;
+}
+exports.formatDiff = formatDiff;
+
+function formatWithLabel(label, value) {
+ return {label, formatted: formatValue(value)};
+}
+exports.formatWithLabel = formatWithLabel;
+
+function formatSerializedError(error) {
+ if (error.statements.length === 0 && error.values.length === 0) {
+ return null;
+ }
+
+ let result = error.values
+ .map(value => `${value.label}\n\n${indentString(value.formatted, 2).trimRight()}\n`)
+ .join('\n');
+
+ if (error.statements.length > 0) {
+ if (error.values.length > 0) {
+ result += '\n';
+ }
+
+ result += error.statements
+ .map(statement => `${statement[0]}\n${chalk.grey('=>')} ${statement[1]}\n`)
+ .join('\n');
+ }
+
+ return result;
+}
+exports.formatSerializedError = formatSerializedError;
diff --git a/node_modules/ava/lib/globals.js b/node_modules/ava/lib/globals.js
new file mode 100644
index 000000000..51176c113
--- /dev/null
+++ b/node_modules/ava/lib/globals.js
@@ -0,0 +1,10 @@
+'use strict';
+
+// Global objects / functions to be bound before requiring test file, so tests do not interfere
+
+const x = module.exports;
+x.now = Date.now;
+x.setTimeout = setTimeout;
+x.clearTimeout = clearTimeout;
+x.setImmediate = setImmediate;
+x.options = {};
diff --git a/node_modules/ava/lib/logger.js b/node_modules/ava/lib/logger.js
new file mode 100644
index 000000000..54bd23c94
--- /dev/null
+++ b/node_modules/ava/lib/logger.js
@@ -0,0 +1,81 @@
+'use strict';
+const autoBind = require('auto-bind');
+
+class Logger {
+ constructor(reporter) {
+ this.reporter = reporter;
+ autoBind(this);
+ }
+ start(runStatus) {
+ if (!this.reporter.start) {
+ return;
+ }
+
+ this.write(this.reporter.start(runStatus), runStatus);
+ }
+ reset(runStatus) {
+ if (!this.reporter.reset) {
+ return;
+ }
+
+ this.write(this.reporter.reset(runStatus), runStatus);
+ }
+ test(test, runStatus) {
+ this.write(this.reporter.test(test, runStatus), runStatus);
+ }
+ unhandledError(err, runStatus) {
+ if (!this.reporter.unhandledError) {
+ return;
+ }
+
+ this.write(this.reporter.unhandledError(err, runStatus), runStatus);
+ }
+ finish(runStatus) {
+ if (!this.reporter.finish) {
+ return;
+ }
+
+ this.write(this.reporter.finish(runStatus), runStatus);
+ }
+ section() {
+ if (!this.reporter.section) {
+ return;
+ }
+
+ this.write(this.reporter.section());
+ }
+ clear() {
+ if (!this.reporter.clear) {
+ return false;
+ }
+
+ this.write(this.reporter.clear());
+ return true;
+ }
+ write(str, runStatus) {
+ if (typeof str === 'undefined') {
+ return;
+ }
+
+ this.reporter.write(str, runStatus);
+ }
+ stdout(data, runStatus) {
+ if (!this.reporter.stdout) {
+ return;
+ }
+
+ this.reporter.stdout(data, runStatus);
+ }
+ stderr(data, runStatus) {
+ if (!this.reporter.stderr) {
+ return;
+ }
+
+ this.reporter.stderr(data, runStatus);
+ }
+ exit(code) {
+ process.exit(code); // eslint-disable-line unicorn/no-process-exit
+ }
+}
+
+module.exports = Logger;
diff --git a/node_modules/ava/lib/main.js b/node_modules/ava/lib/main.js
new file mode 100644
index 000000000..52618e8b7
--- /dev/null
+++ b/node_modules/ava/lib/main.js
@@ -0,0 +1,103 @@
+'use strict';
+const worker = require('./test-worker');
+const adapter = require('./process-adapter');
+const serializeError = require('./serialize-error');
+const globals = require('./globals');
+const Runner = require('./runner');
+
+const opts = globals.options;
+const runner = new Runner({
+ bail: opts.failFast,
+ failWithoutAssertions: opts.failWithoutAssertions,
+ file: opts.file,
+ match: opts.match,
+ serial: opts.serial,
+ updateSnapshots: opts.updateSnapshots
+});
+
+worker.setRunner(runner);
+
+// If fail-fast is enabled, use this variable to detect
+// that no more tests should be logged
+let isFailed = false;
+
+Error.stackTraceLimit = Infinity;
+
+function test(props) {
+ if (isFailed) {
+ return;
+ }
+
+ const hasError = typeof props.error !== 'undefined';
+
+ // Don't display anything if it's a passed hook
+ if (!hasError && props.type !== 'test') {
+ return;
+ }
+
+ if (hasError) {
+ props.error = serializeError(props.error);
+ } else {
+ props.error = null;
+ }
+
+ adapter.send('test', props);
+
+ if (hasError && opts.failFast) {
+ isFailed = true;
+ exit();
+ }
+}
+
+function exit() {
+ // Reference the IPC channel now that tests have finished running.
+ adapter.ipcChannel.ref();
+
+ const stats = runner.buildStats();
+ adapter.send('results', {stats});
+}
+
+globals.setImmediate(() => {
+ const hasExclusive = runner.tests.hasExclusive;
+ const numberOfTests = runner.tests.testCount;
+
+ if (numberOfTests === 0) {
+ adapter.send('no-tests', {avaRequired: true});
+ return;
+ }
+
+ adapter.send('stats', {
+ testCount: numberOfTests,
+ hasExclusive
+ });
+
+ runner.on('test', test);
+
+ process.on('ava-run', options => {
+ // Unreference the IPC channel. This stops it from keeping the event loop
+ // busy, which means the `beforeExit` event can be used to detect when tests
+ // stall.
+ adapter.ipcChannel.unref();
+
+ runner.run(options)
+ .then(() => {
+ runner.saveSnapshotState();
+
+ return exit();
+ })
+ .catch(err => {
+ process.emit('uncaughtException', err);
+ });
+ });
+
+ process.on('ava-init-exit', () => {
+ exit();
+ });
+});
+
+module.exports = runner.chain;
+
+// TypeScript imports the `default` property for
+// an ES2015 default import (`import test from 'ava'`)
+// See: https://github.com/Microsoft/TypeScript/issues/2242#issuecomment-83694181
+module.exports.default = runner.chain;
diff --git a/node_modules/ava/lib/prefix-title.js b/node_modules/ava/lib/prefix-title.js
new file mode 100644
index 000000000..a1c7b4f3b
--- /dev/null
+++ b/node_modules/ava/lib/prefix-title.js
@@ -0,0 +1,21 @@
+'use strict';
+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
+ .replace(base, (match, offset) => offset === 0 ? '' : match)
+ .replace(/\.spec/, '')
+ .replace(/\.test/, '')
+ .replace(/test-/g, '')
+ .replace(/\.js$/, '')
+ .split(path.sep)
+ .filter(p => p !== '__tests__')
+ .join(separator);
+
+ if (prefix.length > 0) {
+ prefix += separator;
+ }
+
+ return prefix;
+};
diff --git a/node_modules/ava/lib/process-adapter.js b/node_modules/ava/lib/process-adapter.js
new file mode 100644
index 000000000..b50f37398
--- /dev/null
+++ b/node_modules/ava/lib/process-adapter.js
@@ -0,0 +1,103 @@
+'use strict';
+const fs = require('fs');
+const path = require('path');
+const debug = require('debug')('ava');
+const sourceMapSupport = require('source-map-support');
+const installPrecompiler = require('require-precompiled');
+
+// Parse and re-emit AVA messages
+process.on('message', message => {
+ if (!message.ava) {
+ return;
+ }
+
+ process.emit(message.name, message.data);
+});
+
+exports.send = (name, data) => {
+ process.send({
+ name: `ava-${name}`,
+ data,
+ ava: true
+ });
+};
+
+// `process.channel` was added in Node.js 7.1.0, but the channel was available
+// through an undocumented API as `process._channel`.
+exports.ipcChannel = process.channel || process._channel;
+
+const opts = JSON.parse(process.argv[2]);
+exports.opts = opts;
+
+// Fake TTY support
+if (opts.tty) {
+ process.stdout.isTTY = true;
+ process.stdout.columns = opts.tty.columns || 80;
+ process.stdout.rows = opts.tty.rows;
+
+ const tty = require('tty');
+ const isatty = tty.isatty;
+
+ tty.isatty = function (fd) {
+ if (fd === 1 || fd === process.stdout) {
+ return true;
+ }
+
+ return isatty(fd);
+ };
+}
+
+if (debug.enabled) {
+ // Forward the `time-require` `--sorted` flag.
+ // Intended for internal optimization tests only.
+ if (opts._sorted) {
+ process.argv.push('--sorted');
+ }
+
+ require('time-require'); // eslint-disable-line import/no-unassigned-import
+}
+
+const sourceMapCache = new Map();
+const cacheDir = opts.cacheDir;
+
+exports.installSourceMapSupport = () => {
+ sourceMapSupport.install({
+ environment: 'node',
+ handleUncaughtExceptions: false,
+ retrieveSourceMap(source) {
+ if (sourceMapCache.has(source)) {
+ return {
+ url: source,
+ map: fs.readFileSync(sourceMapCache.get(source), 'utf8')
+ };
+ }
+ }
+ });
+};
+
+exports.installPrecompilerHook = () => {
+ installPrecompiler(filename => {
+ const precompiled = opts.precompiled[filename];
+
+ if (precompiled) {
+ sourceMapCache.set(filename, path.join(cacheDir, `${precompiled}.js.map`));
+ return fs.readFileSync(path.join(cacheDir, `${precompiled}.js`), 'utf8');
+ }
+
+ return null;
+ });
+};
+
+exports.installDependencyTracking = (dependencies, testPath) => {
+ Object.keys(require.extensions).forEach(ext => {
+ const wrappedHandler = require.extensions[ext];
+
+ require.extensions[ext] = (module, filename) => {
+ if (filename !== testPath) {
+ dependencies.push(filename);
+ }
+
+ wrappedHandler(module, filename);
+ };
+ });
+};
diff --git a/node_modules/ava/lib/reporters/improper-usage-messages.js b/node_modules/ava/lib/reporters/improper-usage-messages.js
new file mode 100644
index 000000000..0a2626638
--- /dev/null
+++ b/node_modules/ava/lib/reporters/improper-usage-messages.js
@@ -0,0 +1,21 @@
+'use strict';
+const chalk = require('chalk');
+
+exports.forError = error => {
+ if (!error.improperUsage) {
+ return null;
+ }
+
+ const assertion = error.assertion;
+ if (assertion !== 'throws' || !assertion === 'notThrows') {
+ return null;
+ }
+
+ return `Try wrapping the first argument to \`t.${assertion}()\` in a function:
+
+ ${chalk.cyan(`t.${assertion}(() => { `)}${chalk.grey('/* your code here */')}${chalk.cyan(' })')}
+
+Visit the following URL for more details:
+
+ ${chalk.blue.underline('https://github.com/avajs/ava#throwsfunctionpromise-error-message')}`;
+};
diff --git a/node_modules/ava/lib/reporters/mini.js b/node_modules/ava/lib/reporters/mini.js
new file mode 100644
index 000000000..df481a76a
--- /dev/null
+++ b/node_modules/ava/lib/reporters/mini.js
@@ -0,0 +1,318 @@
+'use strict';
+const StringDecoder = require('string_decoder').StringDecoder;
+const cliCursor = require('cli-cursor');
+const lastLineTracker = require('last-line-stream/tracker');
+const plur = require('plur');
+const spinners = require('cli-spinners');
+const chalk = require('chalk');
+const cliTruncate = require('cli-truncate');
+const cross = require('figures').cross;
+const indentString = require('indent-string');
+const formatAssertError = require('../format-assert-error');
+const extractStack = require('../extract-stack');
+const codeExcerpt = require('../code-excerpt');
+const colors = require('../colors');
+const improperUsageMessages = require('./improper-usage-messages');
+
+// TODO(@jamestalamge): This should be fixed in log-update and ansi-escapes once we are confident it's a good solution.
+const CSI = '\u001B[';
+const ERASE_LINE = CSI + '2K';
+const CURSOR_TO_COLUMN_0 = CSI + '0G';
+const CURSOR_UP = CSI + '1A';
+
+// Returns a string that will erase `count` lines from the end of the terminal.
+function eraseLines(count) {
+ let clear = '';
+
+ for (let i = 0; i < count; i++) {
+ clear += ERASE_LINE + (i < count - 1 ? CURSOR_UP : '');
+ }
+
+ if (count) {
+ clear += CURSOR_TO_COLUMN_0;
+ }
+
+ return clear;
+}
+
+class MiniReporter {
+ constructor(options) {
+ this.options = Object.assign({}, options);
+
+ chalk.enabled = this.options.color;
+ for (const key of Object.keys(colors)) {
+ colors[key].enabled = this.options.color;
+ }
+
+ const spinnerDef = spinners[process.platform === 'win32' ? 'line' : 'dots'];
+ this.spinnerFrames = spinnerDef.frames.map(c => chalk.gray.dim(c));
+ this.spinnerInterval = spinnerDef.interval;
+
+ this.reset();
+ this.stream = process.stderr;
+ this.stringDecoder = new StringDecoder();
+ }
+ start() {
+ this.interval = setInterval(() => {
+ this.spinnerIndex = (this.spinnerIndex + 1) % this.spinnerFrames.length;
+ this.write(this.prefix());
+ }, this.spinnerInterval);
+
+ return this.prefix('');
+ }
+ reset() {
+ this.clearInterval();
+ this.passCount = 0;
+ this.knownFailureCount = 0;
+ this.failCount = 0;
+ this.skipCount = 0;
+ this.todoCount = 0;
+ this.rejectionCount = 0;
+ this.exceptionCount = 0;
+ this.currentStatus = '';
+ this.currentTest = '';
+ this.statusLineCount = 0;
+ this.spinnerIndex = 0;
+ this.lastLineTracker = lastLineTracker();
+ }
+ spinnerChar() {
+ return this.spinnerFrames[this.spinnerIndex];
+ }
+ clearInterval() {
+ clearInterval(this.interval);
+ this.interval = null;
+ }
+ test(test) {
+ if (test.todo) {
+ this.todoCount++;
+ } else if (test.skip) {
+ this.skipCount++;
+ } else if (test.error) {
+ this.failCount++;
+ } else {
+ this.passCount++;
+ if (test.failing) {
+ this.knownFailureCount++;
+ }
+ }
+
+ if (test.todo || test.skip) {
+ return;
+ }
+
+ return this.prefix(this._test(test));
+ }
+ prefix(str) {
+ str = str || this.currentTest;
+ this.currentTest = str;
+
+ // The space before the newline is required for proper formatting
+ // TODO(jamestalmage): Figure out why it's needed and document it here
+ return ` \n ${this.spinnerChar()} ${str}`;
+ }
+ _test(test) {
+ const SPINNER_WIDTH = 3;
+ const PADDING = 1;
+ let title = cliTruncate(test.title, process.stdout.columns - SPINNER_WIDTH - PADDING);
+
+ if (test.error || test.failing) {
+ title = colors.error(test.title);
+ }
+
+ return title + '\n' + this.reportCounts();
+ }
+ unhandledError(err) {
+ if (err.type === 'exception') {
+ this.exceptionCount++;
+ } else {
+ this.rejectionCount++;
+ }
+ }
+ reportCounts(time) {
+ const lines = [
+ this.passCount > 0 ? '\n ' + colors.pass(this.passCount, 'passed') : '',
+ this.knownFailureCount > 0 ? '\n ' + colors.error(this.knownFailureCount, plur('known failure', this.knownFailureCount)) : '',
+ this.failCount > 0 ? '\n ' + colors.error(this.failCount, 'failed') : '',
+ this.skipCount > 0 ? '\n ' + colors.skip(this.skipCount, 'skipped') : '',
+ this.todoCount > 0 ? '\n ' + colors.todo(this.todoCount, 'todo') : ''
+ ].filter(Boolean);
+
+ if (time && lines.length > 0) {
+ lines[0] += ' ' + time;
+ }
+
+ return lines.join('');
+ }
+ finish(runStatus) {
+ this.clearInterval();
+ let time;
+
+ if (this.options.watching) {
+ time = chalk.gray.dim('[' + new Date().toLocaleTimeString('en-US', {hour12: false}) + ']');
+ }
+
+ let status = this.reportCounts(time);
+
+ if (this.rejectionCount > 0) {
+ status += '\n ' + colors.error(this.rejectionCount, plur('rejection', this.rejectionCount));
+ }
+
+ if (this.exceptionCount > 0) {
+ status += '\n ' + colors.error(this.exceptionCount, plur('exception', this.exceptionCount));
+ }
+
+ if (runStatus.previousFailCount > 0) {
+ status += '\n ' + colors.error(runStatus.previousFailCount, 'previous', plur('failure', runStatus.previousFailCount), 'in test files that were not rerun');
+ }
+
+ if (this.knownFailureCount > 0) {
+ for (const test of runStatus.knownFailures) {
+ const title = test.title;
+ status += '\n\n ' + colors.title(title);
+ // TODO: Output description with link
+ // status += colors.stack(description);
+ }
+ }
+
+ if (this.failCount > 0) {
+ runStatus.errors.forEach((test, index) => {
+ if (!test.error) {
+ return;
+ }
+
+ const beforeSpacing = index === 0 ? '\n\n' : '\n\n\n\n';
+
+ status += beforeSpacing + ' ' + colors.title(test.title) + '\n';
+ if (test.error.source) {
+ status += ' ' + colors.errorSource(test.error.source.file + ':' + test.error.source.line) + '\n';
+
+ const excerpt = codeExcerpt(test.error.source, {maxWidth: process.stdout.columns});
+ if (excerpt) {
+ status += '\n' + indentString(excerpt, 2) + '\n';
+ }
+ }
+
+ if (test.error.message) {
+ status += '\n' + indentString(test.error.message, 2) + '\n';
+ }
+
+ if (test.error.avaAssertionError) {
+ const formatted = formatAssertError.formatSerializedError(test.error);
+ if (formatted) {
+ status += '\n' + indentString(formatted, 2);
+ }
+
+ const message = improperUsageMessages.forError(test.error);
+ if (message) {
+ status += '\n' + indentString(message, 2) + '\n';
+ }
+ }
+
+ if (test.error.stack) {
+ const extracted = extractStack(test.error.stack);
+ if (extracted.includes('\n')) {
+ status += '\n' + indentString(colors.errorStack(extracted), 2);
+ }
+ }
+ });
+ }
+
+ if (this.rejectionCount > 0 || this.exceptionCount > 0) {
+ // TODO(sindresorhus): Figure out why this causes a test failure when switched to a for-of loop
+ runStatus.errors.forEach(err => {
+ if (err.title) {
+ return;
+ }
+
+ if (err.type === 'exception' && err.name === 'AvaError') {
+ status += '\n\n ' + colors.error(cross + ' ' + err.message);
+ } else {
+ const title = err.type === 'rejection' ? 'Unhandled Rejection' : 'Uncaught Exception';
+ let description = err.stack ? err.stack.trimRight() : JSON.stringify(err);
+ description = description.split('\n');
+ const errorTitle = err.name ? description[0] : 'Threw non-error: ' + description[0];
+ const errorStack = description.slice(1).join('\n');
+
+ status += '\n\n ' + colors.title(title) + '\n';
+ status += ' ' + colors.stack(errorTitle) + '\n';
+ status += colors.errorStack(errorStack);
+ }
+ });
+ }
+
+ if (runStatus.failFastEnabled === true && runStatus.remainingCount > 0 && runStatus.failCount > 0) {
+ const remaining = 'At least ' + runStatus.remainingCount + ' ' + plur('test was', 'tests were', runStatus.remainingCount) + ' skipped.';
+ status += '\n\n ' + colors.information('`--fail-fast` is on. ' + remaining);
+ }
+
+ if (runStatus.hasExclusive === true && runStatus.remainingCount > 0) {
+ status += '\n\n ' + colors.information('The .only() modifier is used in some tests.', runStatus.remainingCount, plur('test', runStatus.remainingCount), plur('was', 'were', runStatus.remainingCount), 'not run');
+ }
+
+ return status + '\n\n';
+ }
+ section() {
+ return '\n' + chalk.gray.dim('\u2500'.repeat(process.stdout.columns || 80));
+ }
+ clear() {
+ return '';
+ }
+ write(str) {
+ cliCursor.hide();
+ this.currentStatus = str;
+ this._update();
+ this.statusLineCount = this.currentStatus.split('\n').length;
+ }
+ stdout(data) {
+ this._update(data);
+ }
+ stderr(data) {
+ this._update(data);
+ }
+ _update(data) {
+ let str = '';
+ let ct = this.statusLineCount;
+ const columns = process.stdout.columns;
+ let lastLine = this.lastLineTracker.lastLine();
+
+ // Terminals automatically wrap text. We only need the last log line as seen on the screen.
+ lastLine = lastLine.substring(lastLine.length - (lastLine.length % columns));
+
+ // Don't delete the last log line if it's completely empty.
+ if (lastLine.length > 0) {
+ ct++;
+ }
+
+ // Erase the existing status message, plus the last log line.
+ str += eraseLines(ct);
+
+ // Rewrite the last log line.
+ str += lastLine;
+
+ if (str.length > 0) {
+ this.stream.write(str);
+ }
+
+ if (data) {
+ // Send new log data to the terminal, and update the last line status.
+ this.lastLineTracker.update(this.stringDecoder.write(data));
+ this.stream.write(data);
+ }
+
+ let currentStatus = this.currentStatus;
+
+ if (currentStatus.length > 0) {
+ lastLine = this.lastLineTracker.lastLine();
+ // We need a newline at the end of the last log line, before the status message.
+ // However, if the last log line is the exact width of the terminal a newline is implied,
+ // and adding a second will cause problems.
+ if (lastLine.length % columns) {
+ currentStatus = '\n' + currentStatus;
+ }
+ // Rewrite the status message.
+ this.stream.write(currentStatus);
+ }
+ }
+}
+
+module.exports = MiniReporter;
diff --git a/node_modules/ava/lib/reporters/tap.js b/node_modules/ava/lib/reporters/tap.js
new file mode 100644
index 000000000..37c2cfd95
--- /dev/null
+++ b/node_modules/ava/lib/reporters/tap.js
@@ -0,0 +1,119 @@
+'use strict';
+const format = require('util').format;
+const indentString = require('indent-string');
+const stripAnsi = require('strip-ansi');
+const yaml = require('js-yaml');
+const extractStack = require('../extract-stack');
+
+// Parses stack trace and extracts original function name, file name and line
+function getSourceFromStack(stack) {
+ return extractStack(stack).split('\n')[0];
+}
+
+function dumpError(error, includeMessage) {
+ const obj = Object.assign({}, error.object);
+ if (error.name) {
+ obj.name = error.name;
+ }
+ if (includeMessage && error.message) {
+ obj.message = error.message;
+ }
+
+ if (error.avaAssertionError) {
+ if (error.assertion) {
+ obj.assertion = error.assertion;
+ }
+ if (error.operator) {
+ obj.operator = error.operator;
+ }
+ if (error.values.length > 0) {
+ obj.values = error.values.reduce((acc, value) => {
+ acc[value.label] = stripAnsi(value.formatted);
+ return acc;
+ }, {});
+ }
+ }
+
+ if (error.stack) {
+ obj.at = getSourceFromStack(error.stack);
+ }
+
+ return ` ---\n${indentString(yaml.safeDump(obj).trim(), 4)}\n ...`;
+}
+
+class TapReporter {
+ constructor() {
+ this.i = 0;
+ }
+ start() {
+ return 'TAP version 13';
+ }
+ test(test) {
+ let output;
+
+ let directive = '';
+ const passed = test.todo ? 'not ok' : 'ok';
+
+ if (test.todo) {
+ directive = '# TODO';
+ } else if (test.skip) {
+ directive = '# SKIP';
+ }
+
+ const title = stripAnsi(test.title);
+
+ if (test.error) {
+ output = [
+ '# ' + title,
+ format('not ok %d - %s', ++this.i, title),
+ dumpError(test.error, true)
+ ];
+ } else {
+ output = [
+ `# ${title}`,
+ format('%s %d - %s %s', passed, ++this.i, title, directive).trim()
+ ];
+ }
+
+ return output.join('\n');
+ }
+ unhandledError(err) {
+ const output = [
+ `# ${err.message}`,
+ format('not ok %d - %s', ++this.i, err.message)
+ ];
+ // AvaErrors don't have stack traces
+ if (err.type !== 'exception' || err.name !== 'AvaError') {
+ output.push(dumpError(err, false));
+ }
+
+ return output.join('\n');
+ }
+ finish(runStatus) {
+ const output = [
+ '',
+ '1..' + (runStatus.passCount + runStatus.failCount + runStatus.skipCount),
+ '# tests ' + (runStatus.passCount + runStatus.failCount + runStatus.skipCount),
+ '# pass ' + runStatus.passCount
+ ];
+
+ if (runStatus.skipCount > 0) {
+ output.push(`# skip ${runStatus.skipCount}`);
+ }
+
+ output.push('# fail ' + (runStatus.failCount + runStatus.rejectionCount + runStatus.exceptionCount), '');
+
+ return output.join('\n');
+ }
+ write(str) {
+ console.log(str);
+ }
+ stdout(data) {
+ process.stderr.write(data);
+ }
+ stderr(data) {
+ this.stdout(data);
+ }
+}
+
+module.exports = TapReporter;
diff --git a/node_modules/ava/lib/reporters/verbose.js b/node_modules/ava/lib/reporters/verbose.js
new file mode 100644
index 000000000..1be43ce5e
--- /dev/null
+++ b/node_modules/ava/lib/reporters/verbose.js
@@ -0,0 +1,165 @@
+'use strict';
+const indentString = require('indent-string');
+const prettyMs = require('pretty-ms');
+const figures = require('figures');
+const chalk = require('chalk');
+const plur = require('plur');
+const formatAssertError = require('../format-assert-error');
+const extractStack = require('../extract-stack');
+const codeExcerpt = require('../code-excerpt');
+const colors = require('../colors');
+const improperUsageMessages = require('./improper-usage-messages');
+
+class VerboseReporter {
+ constructor(options) {
+ this.options = Object.assign({}, options);
+
+ chalk.enabled = this.options.color;
+ for (const key of Object.keys(colors)) {
+ colors[key].enabled = this.options.color;
+ }
+ }
+ start() {
+ return '';
+ }
+ test(test, runStatus) {
+ if (test.error) {
+ return ' ' + colors.error(figures.cross) + ' ' + test.title + ' ' + colors.error(test.error.message);
+ }
+
+ if (test.todo) {
+ return ' ' + colors.todo('- ' + test.title);
+ } else if (test.skip) {
+ return ' ' + colors.skip('- ' + test.title);
+ }
+
+ if (test.failing) {
+ return ' ' + colors.error(figures.tick) + ' ' + colors.error(test.title);
+ }
+
+ if (runStatus.fileCount === 1 && runStatus.testCount === 1 && test.title === '[anonymous]') {
+ return undefined;
+ }
+
+ // Display duration only over a threshold
+ const threshold = 100;
+ const duration = test.duration > threshold ? colors.duration(' (' + prettyMs(test.duration) + ')') : '';
+
+ return ' ' + colors.pass(figures.tick) + ' ' + test.title + duration;
+ }
+ unhandledError(err) {
+ if (err.type === 'exception' && err.name === 'AvaError') {
+ return colors.error(' ' + figures.cross + ' ' + err.message);
+ }
+
+ const types = {
+ rejection: 'Unhandled Rejection',
+ exception: 'Uncaught Exception'
+ };
+
+ let output = colors.error(types[err.type] + ':', err.file) + '\n';
+
+ if (err.stack) {
+ output += ' ' + colors.stack(err.stack) + '\n';
+ } else {
+ output += ' ' + colors.stack(JSON.stringify(err)) + '\n';
+ }
+
+ output += '\n';
+
+ return output;
+ }
+ finish(runStatus) {
+ let output = '\n';
+
+ const lines = [
+ runStatus.failCount > 0 ?
+ ' ' + colors.error(runStatus.failCount, plur('test', runStatus.failCount), 'failed') :
+ ' ' + colors.pass(runStatus.passCount, plur('test', runStatus.passCount), 'passed'),
+ runStatus.knownFailureCount > 0 ? ' ' + colors.error(runStatus.knownFailureCount, plur('known failure', runStatus.knownFailureCount)) : '',
+ runStatus.skipCount > 0 ? ' ' + colors.skip(runStatus.skipCount, plur('test', runStatus.skipCount), 'skipped') : '',
+ runStatus.todoCount > 0 ? ' ' + colors.todo(runStatus.todoCount, plur('test', runStatus.todoCount), 'todo') : '',
+ runStatus.rejectionCount > 0 ? ' ' + colors.error(runStatus.rejectionCount, 'unhandled', plur('rejection', runStatus.rejectionCount)) : '',
+ runStatus.exceptionCount > 0 ? ' ' + colors.error(runStatus.exceptionCount, 'uncaught', plur('exception', runStatus.exceptionCount)) : '',
+ runStatus.previousFailCount > 0 ? ' ' + colors.error(runStatus.previousFailCount, 'previous', plur('failure', runStatus.previousFailCount), 'in test files that were not rerun') : ''
+ ].filter(Boolean);
+
+ if (lines.length > 0) {
+ lines[0] += ' ' + chalk.gray.dim('[' + new Date().toLocaleTimeString('en-US', {hour12: false}) + ']');
+ output += lines.join('\n');
+ }
+
+ if (runStatus.knownFailureCount > 0) {
+ runStatus.knownFailures.forEach(test => {
+ output += '\n\n\n ' + colors.error(test.title);
+ });
+ }
+
+ if (runStatus.failCount > 0) {
+ runStatus.tests.forEach((test, index) => {
+ if (!test.error) {
+ return;
+ }
+
+ const beforeSpacing = index === 0 ? '\n\n' : '\n\n\n\n';
+ output += beforeSpacing + ' ' + colors.title(test.title) + '\n';
+ if (test.error.source) {
+ output += ' ' + colors.errorSource(test.error.source.file + ':' + test.error.source.line) + '\n';
+
+ const excerpt = codeExcerpt(test.error.source, {maxWidth: process.stdout.columns});
+ if (excerpt) {
+ output += '\n' + indentString(excerpt, 2) + '\n';
+ }
+ }
+
+ if (test.error.message) {
+ output += '\n' + indentString(test.error.message, 2) + '\n';
+ }
+
+ if (test.error.avaAssertionError) {
+ const formatted = formatAssertError.formatSerializedError(test.error);
+ if (formatted) {
+ output += '\n' + indentString(formatted, 2);
+ }
+
+ const message = improperUsageMessages.forError(test.error);
+ if (message) {
+ output += '\n' + indentString(message, 2) + '\n';
+ }
+ }
+
+ if (test.error.stack) {
+ const extracted = extractStack(test.error.stack);
+ if (extracted.includes('\n')) {
+ output += '\n' + indentString(colors.errorStack(extracted), 2);
+ }
+ }
+ });
+ }
+
+ if (runStatus.failFastEnabled === true && runStatus.remainingCount > 0 && runStatus.failCount > 0) {
+ const remaining = 'At least ' + runStatus.remainingCount + ' ' + plur('test was', 'tests were', runStatus.remainingCount) + ' skipped.';
+ output += '\n\n\n ' + colors.information('`--fail-fast` is on. ' + remaining);
+ }
+
+ if (runStatus.hasExclusive === true && runStatus.remainingCount > 0) {
+ output += '\n\n\n ' + colors.information('The .only() modifier is used in some tests.', runStatus.remainingCount, plur('test', runStatus.remainingCount), plur('was', 'were', runStatus.remainingCount), 'not run');
+ }
+
+ return output + '\n';
+ }
+ section() {
+ return chalk.gray.dim('\u2500'.repeat(process.stdout.columns || 80));
+ }
+ write(str) {
+ console.error(str);
+ }
+ stdout(data) {
+ process.stderr.write(data);
+ }
+ stderr(data) {
+ process.stderr.write(data);
+ }
+}
+
+module.exports = VerboseReporter;
diff --git a/node_modules/ava/lib/run-status.js b/node_modules/ava/lib/run-status.js
new file mode 100644
index 000000000..6526f7bdc
--- /dev/null
+++ b/node_modules/ava/lib/run-status.js
@@ -0,0 +1,125 @@
+'use strict';
+const EventEmitter = require('events');
+const chalk = require('chalk');
+const flatten = require('arr-flatten');
+const figures = require('figures');
+const autoBind = require('auto-bind');
+const prefixTitle = require('./prefix-title');
+
+function sum(arr, key) {
+ let result = 0;
+
+ arr.forEach(item => {
+ result += item[key];
+ });
+
+ return result;
+}
+
+class RunStatus extends EventEmitter {
+ constructor(opts) {
+ super();
+
+ opts = opts || {};
+ this.prefixTitles = opts.prefixTitles !== false;
+ this.hasExclusive = Boolean(opts.runOnlyExclusive);
+ this.base = opts.base || '';
+ this.rejectionCount = 0;
+ this.exceptionCount = 0;
+ this.passCount = 0;
+ this.knownFailureCount = 0;
+ this.skipCount = 0;
+ this.todoCount = 0;
+ this.failCount = 0;
+ this.fileCount = 0;
+ this.testCount = 0;
+ this.remainingCount = 0;
+ this.previousFailCount = 0;
+ this.knownFailures = [];
+ this.errors = [];
+ this.stats = [];
+ this.tests = [];
+ this.failFastEnabled = opts.failFast || false;
+
+ autoBind(this);
+ }
+ observeFork(emitter) {
+ emitter
+ .on('teardown', this.handleTeardown)
+ .on('stats', this.handleStats)
+ .on('test', this.handleTest)
+ .on('unhandledRejections', this.handleRejections)
+ .on('uncaughtException', this.handleExceptions)
+ .on('stdout', this.handleOutput.bind(this, 'stdout'))
+ .on('stderr', this.handleOutput.bind(this, 'stderr'));
+ }
+ handleRejections(data) {
+ this.rejectionCount += data.rejections.length;
+
+ data.rejections.forEach(err => {
+ err.type = 'rejection';
+ err.file = data.file;
+ this.emit('error', err, this);
+ this.errors.push(err);
+ });
+ }
+ handleExceptions(data) {
+ this.exceptionCount++;
+ const err = data.exception;
+ err.type = 'exception';
+ err.file = data.file;
+ this.emit('error', err, this);
+ this.errors.push(err);
+ }
+ handleTeardown(data) {
+ this.emit('dependencies', data.file, data.dependencies, this);
+ }
+ handleStats(stats) {
+ this.emit('stats', stats, this);
+
+ if (stats.hasExclusive) {
+ this.hasExclusive = true;
+ }
+
+ this.testCount += stats.testCount;
+ }
+ handleTest(test) {
+ test.title = this.prefixTitle(test.file) + test.title;
+
+ if (test.error) {
+ this.errors.push(test);
+ }
+
+ if (test.failing && !test.error) {
+ this.knownFailures.push(test);
+ }
+
+ this.emit('test', test, this);
+ }
+ prefixTitle(file) {
+ if (!this.prefixTitles) {
+ return '';
+ }
+
+ const separator = ' ' + chalk.gray.dim(figures.pointerSmall) + ' ';
+
+ return prefixTitle(file, this.base, separator);
+ }
+ handleOutput(channel, data) {
+ this.emit(channel, data, this);
+ }
+ processResults(results) {
+ // Assemble stats from all tests
+ this.stats = results.map(result => result.stats);
+ this.tests = results.map(result => result.tests);
+ this.tests = flatten(this.tests);
+ this.passCount = sum(this.stats, 'passCount');
+ this.knownFailureCount = sum(this.stats, 'knownFailureCount');
+ this.skipCount = sum(this.stats, 'skipCount');
+ this.todoCount = sum(this.stats, 'todoCount');
+ this.failCount = sum(this.stats, 'failCount');
+ this.remainingCount = this.testCount - this.passCount - this.failCount - this.skipCount - this.todoCount - this.knownFailureCount;
+ }
+}
+
+module.exports = RunStatus;
diff --git a/node_modules/ava/lib/runner.js b/node_modules/ava/lib/runner.js
new file mode 100644
index 000000000..5f0edacb2
--- /dev/null
+++ b/node_modules/ava/lib/runner.js
@@ -0,0 +1,221 @@
+'use strict';
+const EventEmitter = require('events');
+const path = require('path');
+const Bluebird = require('bluebird');
+const jestSnapshot = require('jest-snapshot');
+const optionChain = require('option-chain');
+const matcher = require('matcher');
+const TestCollection = require('./test-collection');
+const validateTest = require('./validate-test');
+
+const chainableMethods = {
+ defaults: {
+ type: 'test',
+ serial: false,
+ exclusive: false,
+ skipped: false,
+ todo: false,
+ failing: false,
+ callback: false,
+ always: false
+ },
+ chainableMethods: {
+ test: {},
+ serial: {serial: true},
+ before: {type: 'before'},
+ after: {type: 'after'},
+ skip: {skipped: true},
+ todo: {todo: true},
+ failing: {failing: true},
+ only: {exclusive: true},
+ beforeEach: {type: 'beforeEach'},
+ afterEach: {type: 'afterEach'},
+ cb: {callback: true},
+ always: {always: true}
+ }
+};
+
+function wrapFunction(fn, args) {
+ return function (t) {
+ return fn.apply(this, [t].concat(args));
+ };
+}
+
+class Runner extends EventEmitter {
+ constructor(options) {
+ super();
+
+ options = options || {};
+
+ this.file = options.file;
+ this.match = options.match || [];
+ this.serial = options.serial;
+ this.updateSnapshots = options.updateSnapshots;
+
+ this.hasStarted = false;
+ this.results = [];
+ this.snapshotState = null;
+ this.tests = new TestCollection({
+ bail: options.bail,
+ failWithoutAssertions: options.failWithoutAssertions,
+ getSnapshotState: () => this.getSnapshotState()
+ });
+
+ this.chain = optionChain(chainableMethods, (opts, args) => {
+ let title;
+ let fn;
+ let macroArgIndex;
+
+ if (this.hasStarted) {
+ throw new Error('All tests and hooks must be declared synchronously in your ' +
+ 'test file, and cannot be nested within other tests or hooks.');
+ }
+
+ if (typeof args[0] === 'string') {
+ title = args[0];
+ fn = args[1];
+ macroArgIndex = 2;
+ } else {
+ fn = args[0];
+ title = null;
+ macroArgIndex = 1;
+ }
+
+ if (this.serial) {
+ opts.serial = true;
+ }
+
+ if (args.length > macroArgIndex) {
+ args = args.slice(macroArgIndex);
+ } else {
+ args = null;
+ }
+
+ if (Array.isArray(fn)) {
+ fn.forEach(fn => {
+ this.addTest(title, opts, fn, args);
+ });
+ } else {
+ this.addTest(title, opts, fn, args);
+ }
+ });
+ }
+
+ addTest(title, metadata, fn, args) {
+ if (args) {
+ if (fn.title) {
+ title = fn.title.apply(fn, [title || ''].concat(args));
+ }
+
+ fn = wrapFunction(fn, args);
+ }
+
+ if (metadata.type === 'test' && this.match.length > 0) {
+ metadata.exclusive = title !== null && matcher([title], this.match).length === 1;
+ }
+
+ const validationError = validateTest(title, fn, metadata);
+ if (validationError !== null) {
+ throw new TypeError(validationError);
+ }
+
+ this.tests.add({
+ metadata,
+ fn,
+ title
+ });
+ }
+
+ addTestResult(result) {
+ const test = result.result;
+ const props = {
+ duration: test.duration,
+ title: test.title,
+ error: result.reason,
+ type: test.metadata.type,
+ skip: test.metadata.skipped,
+ todo: test.metadata.todo,
+ failing: test.metadata.failing
+ };
+
+ this.results.push(result);
+ this.emit('test', props);
+ }
+
+ buildStats() {
+ const stats = {
+ failCount: 0,
+ knownFailureCount: 0,
+ passCount: 0,
+ skipCount: 0,
+ testCount: 0,
+ todoCount: 0
+ };
+
+ for (const result of this.results) {
+ if (!result.passed) {
+ // Includes hooks
+ stats.failCount++;
+ }
+
+ const metadata = result.result.metadata;
+ if (metadata.type === 'test') {
+ stats.testCount++;
+
+ if (metadata.skipped) {
+ stats.skipCount++;
+ } else if (metadata.todo) {
+ stats.todoCount++;
+ } else if (result.passed) {
+ if (metadata.failing) {
+ stats.knownFailureCount++;
+ } else {
+ stats.passCount++;
+ }
+ }
+ }
+ }
+
+ return stats;
+ }
+
+ getSnapshotState() {
+ if (this.snapshotState) {
+ return this.snapshotState;
+ }
+
+ const name = path.basename(this.file) + '.snap';
+ const dir = path.dirname(this.file);
+
+ const snapshotPath = path.join(dir, '__snapshots__', name);
+ const testPath = this.file;
+ const update = this.updateSnapshots;
+
+ const state = jestSnapshot.initializeSnapshotState(testPath, update, snapshotPath);
+ this.snapshotState = state;
+ return state;
+ }
+
+ saveSnapshotState() {
+ if (this.snapshotState) {
+ this.snapshotState.save(this.updateSnapshots);
+ }
+ }
+
+ run(options) {
+ if (options.runOnlyExclusive && !this.tests.hasExclusive) {
+ return Promise.resolve(null);
+ }
+
+ this.hasStarted = true;
+ this.tests.on('test', result => {
+ this.addTestResult(result);
+ });
+ return Bluebird.try(() => this.tests.build().run());
+ }
+ attributeLeakedError(err) {
+ return this.tests.attributeLeakedError(err);
+ }
+}
+
+module.exports = Runner;
diff --git a/node_modules/ava/lib/sequence.js b/node_modules/ava/lib/sequence.js
new file mode 100644
index 000000000..1e5960a98
--- /dev/null
+++ b/node_modules/ava/lib/sequence.js
@@ -0,0 +1,94 @@
+'use strict';
+
+const beforeExitSubscribers = new Set();
+const beforeExitHandler = () => {
+ for (const subscriber of beforeExitSubscribers) {
+ subscriber();
+ }
+};
+const onBeforeExit = subscriber => {
+ if (beforeExitSubscribers.size === 0) {
+ // Only listen for the event once, no matter how many Sequences are run
+ // concurrently.
+ process.on('beforeExit', beforeExitHandler);
+ }
+
+ beforeExitSubscribers.add(subscriber);
+ return {
+ dispose() {
+ beforeExitSubscribers.delete(subscriber);
+ if (beforeExitSubscribers.size === 0) {
+ process.removeListener('beforeExit', beforeExitHandler);
+ }
+ }
+ };
+};
+
+class Sequence {
+ constructor(runnables, bail) {
+ if (!Array.isArray(runnables)) {
+ throw new TypeError('Expected an array of runnables');
+ }
+
+ this.runnables = runnables;
+ this.bail = bail || false;
+ }
+
+ run() {
+ const iterator = this.runnables[Symbol.iterator]();
+
+ let activeRunnable;
+ const beforeExit = onBeforeExit(() => {
+ if (activeRunnable.finishDueToInactivity) {
+ activeRunnable.finishDueToInactivity();
+ }
+ });
+
+ let allPassed = true;
+ const finish = () => {
+ beforeExit.dispose();
+ return allPassed;
+ };
+
+ const runNext = () => {
+ let promise;
+
+ for (let next = iterator.next(); !next.done; next = iterator.next()) {
+ activeRunnable = next.value;
+ const passedOrPromise = activeRunnable.run();
+ if (!passedOrPromise) {
+ allPassed = false;
+
+ if (this.bail) {
+ // Stop if the test failed and bail mode is on.
+ break;
+ }
+ } else if (passedOrPromise !== true) {
+ promise = passedOrPromise;
+ break;
+ }
+ }
+
+ if (!promise) {
+ return finish();
+ }
+
+ return promise.then(passed => {
+ if (!passed) {
+ allPassed = false;
+
+ if (this.bail) {
+ // Stop if the test failed and bail mode is on.
+ return finish();
+ }
+ }
+
+ return runNext();
+ });
+ };
+
+ return runNext();
+ }
+}
+
+module.exports = Sequence;
diff --git a/node_modules/ava/lib/serialize-error.js b/node_modules/ava/lib/serialize-error.js
new file mode 100644
index 000000000..55717e161
--- /dev/null
+++ b/node_modules/ava/lib/serialize-error.js
@@ -0,0 +1,94 @@
+'use strict';
+const path = require('path');
+const cleanYamlObject = require('clean-yaml-object');
+const StackUtils = require('stack-utils');
+const assert = require('./assert');
+const beautifyStack = require('./beautify-stack');
+const extractStack = require('./extract-stack');
+
+function isAvaAssertionError(source) {
+ return source instanceof assert.AssertionError;
+}
+
+function filter(propertyName, isRoot) {
+ return !isRoot || (propertyName !== 'message' && propertyName !== 'name' && propertyName !== 'stack');
+}
+
+const stackUtils = new StackUtils();
+function extractSource(stack) {
+ if (!stack) {
+ return null;
+ }
+
+ const firstStackLine = extractStack(stack).split('\n')[0];
+ return stackUtils.parseLine(firstStackLine);
+}
+function buildSource(source) {
+ if (!source) {
+ return null;
+ }
+
+ // Assume the CWD is the project directory. This holds since this function
+ // is only called in test workers, which are created with their working
+ // directory set to the project directory.
+ const projectDir = process.cwd();
+
+ const file = path.resolve(projectDir, source.file.trim());
+ const rel = path.relative(projectDir, file);
+
+ const isWithinProject = rel.split(path.sep)[0] !== '..';
+ const isDependency = isWithinProject && path.dirname(rel).split(path.sep).indexOf('node_modules') > -1;
+
+ return {
+ isDependency,
+ isWithinProject,
+ file,
+ line: source.line
+ };
+}
+
+module.exports = error => {
+ const stack = typeof error.stack === 'string' ?
+ beautifyStack(error.stack) :
+ null;
+
+ const retval = {
+ avaAssertionError: isAvaAssertionError(error),
+ source: buildSource(extractSource(stack))
+ };
+ if (stack) {
+ retval.stack = stack;
+ }
+
+ if (retval.avaAssertionError) {
+ retval.improperUsage = error.improperUsage;
+ retval.message = error.message;
+ retval.name = error.name;
+ retval.statements = error.statements;
+ retval.values = error.values;
+
+ if (error.fixedSource) {
+ const source = buildSource(error.fixedSource);
+ if (source) {
+ retval.source = source;
+ }
+ }
+
+ if (error.assertion) {
+ retval.assertion = error.assertion;
+ }
+ if (error.operator) {
+ retval.operator = error.operator;
+ }
+ } else {
+ retval.object = cleanYamlObject(error, filter); // Cleanly copy non-standard properties
+ if (typeof error.message === 'string') {
+ retval.message = error.message;
+ }
+ if (typeof error.name === 'string') {
+ retval.name = error.name;
+ }
+ }
+
+ return retval;
+};
diff --git a/node_modules/ava/lib/test-collection.js b/node_modules/ava/lib/test-collection.js
new file mode 100644
index 000000000..5404cb119
--- /dev/null
+++ b/node_modules/ava/lib/test-collection.js
@@ -0,0 +1,206 @@
+'use strict';
+const EventEmitter = require('events');
+const fnName = require('fn-name');
+const Concurrent = require('./concurrent');
+const Sequence = require('./sequence');
+const Test = require('./test');
+
+class TestCollection extends EventEmitter {
+ constructor(options) {
+ super();
+
+ this.bail = options.bail;
+ this.failWithoutAssertions = options.failWithoutAssertions;
+ this.getSnapshotState = options.getSnapshotState;
+ this.hasExclusive = false;
+ this.testCount = 0;
+
+ this.tests = {
+ concurrent: [],
+ serial: []
+ };
+
+ this.hooks = {
+ before: [],
+ beforeEach: [],
+ after: [],
+ afterAlways: [],
+ afterEach: [],
+ afterEachAlways: []
+ };
+
+ this.pendingTestInstances = new Set();
+
+ this._emitTestResult = this._emitTestResult.bind(this);
+ }
+ add(test) {
+ const metadata = test.metadata;
+ const type = metadata.type;
+
+ if (!type) {
+ throw new Error('Test type must be specified');
+ }
+
+ if (!test.title && test.fn) {
+ test.title = fnName(test.fn);
+ }
+
+ // Workaround for Babel giving anonymous functions a name
+ if (test.title === 'callee$0$0') {
+ test.title = null;
+ }
+
+ if (!test.title) {
+ if (type === 'test') {
+ test.title = '[anonymous]';
+ } else {
+ test.title = type;
+ }
+ }
+
+ if (metadata.always && type !== 'after' && type !== 'afterEach') {
+ throw new Error('"always" can only be used with after and afterEach hooks');
+ }
+
+ // Add a hook
+ if (type !== 'test') {
+ if (metadata.exclusive) {
+ throw new Error(`"only" cannot be used with a ${type} hook`);
+ }
+
+ this.hooks[type + (metadata.always ? 'Always' : '')].push(test);
+ return;
+ }
+
+ this.testCount++;
+
+ // Add `.only()` tests if `.only()` was used previously
+ if (this.hasExclusive && !metadata.exclusive) {
+ return;
+ }
+
+ if (metadata.exclusive && !this.hasExclusive) {
+ this.tests.concurrent = [];
+ this.tests.serial = [];
+ this.hasExclusive = true;
+ }
+
+ if (metadata.serial) {
+ this.tests.serial.push(test);
+ } else {
+ this.tests.concurrent.push(test);
+ }
+ }
+ _skippedTest(test) {
+ return {
+ run: () => {
+ this._emitTestResult({
+ passed: true,
+ result: test
+ });
+
+ return true;
+ }
+ };
+ }
+ _emitTestResult(result) {
+ this.pendingTestInstances.delete(result.result);
+ this.emit('test', result);
+ }
+ _buildHooks(hooks, testTitle, context) {
+ return hooks.map(hook => {
+ const test = this._buildHook(hook, testTitle, context);
+
+ if (hook.metadata.skipped || hook.metadata.todo) {
+ return this._skippedTest(test);
+ }
+
+ return test;
+ });
+ }
+ _buildHook(hook, testTitle, contextRef) {
+ let title = hook.title;
+
+ if (testTitle) {
+ title += ` for ${testTitle}`;
+ }
+
+ if (!contextRef) {
+ contextRef = null;
+ }
+
+ const test = new Test({
+ contextRef,
+ failWithoutAssertions: false,
+ fn: hook.fn,
+ getSnapshotState: this.getSnapshotState,
+ metadata: hook.metadata,
+ onResult: this._emitTestResult,
+ title
+ });
+ this.pendingTestInstances.add(test);
+ return test;
+ }
+ _buildTest(test, contextRef) {
+ if (!contextRef) {
+ contextRef = null;
+ }
+
+ test = new Test({
+ contextRef,
+ failWithoutAssertions: this.failWithoutAssertions,
+ fn: test.fn,
+ getSnapshotState: this.getSnapshotState,
+ metadata: test.metadata,
+ onResult: this._emitTestResult,
+ title: test.title
+ });
+ this.pendingTestInstances.add(test);
+ return test;
+ }
+ _buildTestWithHooks(test) {
+ if (test.metadata.skipped || test.metadata.todo) {
+ return new Sequence([this._skippedTest(this._buildTest(test))], true);
+ }
+
+ const context = {context: {}};
+
+ const beforeHooks = this._buildHooks(this.hooks.beforeEach, test.title, context);
+ const afterHooks = this._buildHooks(this.hooks.afterEach, test.title, context);
+
+ let sequence = new Sequence([].concat(beforeHooks, this._buildTest(test, context), afterHooks), true);
+ if (this.hooks.afterEachAlways.length > 0) {
+ const afterAlwaysHooks = new Sequence(this._buildHooks(this.hooks.afterEachAlways, test.title, context));
+ sequence = new Sequence([sequence, afterAlwaysHooks], false);
+ }
+ return sequence;
+ }
+ _buildTests(tests) {
+ return tests.map(test => this._buildTestWithHooks(test));
+ }
+ build() {
+ const beforeHooks = new Sequence(this._buildHooks(this.hooks.before));
+ const afterHooks = new Sequence(this._buildHooks(this.hooks.after));
+
+ const serialTests = new Sequence(this._buildTests(this.tests.serial), this.bail);
+ const concurrentTests = new Concurrent(this._buildTests(this.tests.concurrent), this.bail);
+ const allTests = new Sequence([serialTests, concurrentTests]);
+
+ let finalTests = new Sequence([beforeHooks, allTests, afterHooks], true);
+ if (this.hooks.afterAlways.length > 0) {
+ const afterAlwaysHooks = new Sequence(this._buildHooks(this.hooks.afterAlways));
+ finalTests = new Sequence([finalTests, afterAlwaysHooks], false);
+ }
+ return finalTests;
+ }
+ attributeLeakedError(err) {
+ for (const test of this.pendingTestInstances) {
+ if (test.attributeLeakedError(err)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
+
+module.exports = TestCollection;
diff --git a/node_modules/ava/lib/test-worker.js b/node_modules/ava/lib/test-worker.js
new file mode 100644
index 000000000..2df7f745d
--- /dev/null
+++ b/node_modules/ava/lib/test-worker.js
@@ -0,0 +1,130 @@
+'use strict';
+
+// Check if the test is being run without AVA cli
+{
+ /* eslint-disable import/order */
+ const path = require('path');
+ const chalk = require('chalk');
+
+ const isForked = typeof process.send === 'function';
+ if (!isForked) {
+ const fp = path.relative('.', process.argv[1]);
+
+ console.log();
+ console.error('Test files must be run with the AVA CLI:\n\n ' + chalk.grey.dim('$') + ' ' + chalk.cyan('ava ' + fp) + '\n');
+
+ process.exit(1); // eslint-disable-line unicorn/no-process-exit
+ }
+}
+
+/* eslint-enable import/order */
+const Bluebird = require('bluebird');
+const currentlyUnhandled = require('currently-unhandled')();
+const isObj = require('is-obj');
+const adapter = require('./process-adapter');
+const globals = require('./globals');
+const serializeError = require('./serialize-error');
+
+const opts = adapter.opts;
+const testPath = opts.file;
+globals.options = opts;
+
+// Bluebird specific
+Bluebird.longStackTraces();
+
+(opts.require || []).forEach(require);
+
+adapter.installSourceMapSupport();
+adapter.installPrecompilerHook();
+
+const dependencies = [];
+adapter.installDependencyTracking(dependencies, testPath);
+
+// Set when main.js is required (since test files should have `require('ava')`).
+let runner = null;
+exports.setRunner = newRunner => {
+ runner = newRunner;
+};
+
+require(testPath); // eslint-disable-line import/no-dynamic-require
+
+// If AVA was not required, show an error
+if (!runner) {
+ adapter.send('no-tests', {avaRequired: false});
+}
+
+function attributeLeakedError(err) {
+ if (!runner) {
+ return false;
+ }
+
+ return runner.attributeLeakedError(err);
+}
+
+const attributedRejections = new Set();
+process.on('unhandledRejection', (reason, promise) => {
+ if (attributeLeakedError(reason)) {
+ attributedRejections.add(promise);
+ }
+});
+
+process.on('uncaughtException', exception => {
+ if (attributeLeakedError(exception)) {
+ return;
+ }
+
+ let serialized;
+ try {
+ serialized = serializeError(exception);
+ } catch (ignore) { // eslint-disable-line unicorn/catch-error-name
+ // Avoid using serializeError
+ const err = new Error('Failed to serialize uncaught exception');
+ serialized = {
+ avaAssertionError: false,
+ name: err.name,
+ message: err.message,
+ stack: err.stack
+ };
+ }
+
+ // Ensure the IPC channel is refereced. The uncaught exception will kick off
+ // the teardown sequence, for which the messages must be received.
+ adapter.ipcChannel.ref();
+
+ adapter.send('uncaughtException', {exception: serialized});
+});
+
+let tearingDown = false;
+process.on('ava-teardown', () => {
+ // AVA-teardown can be sent more than once
+ if (tearingDown) {
+ return;
+ }
+ tearingDown = true;
+
+ let rejections = currentlyUnhandled()
+ .filter(rejection => !attributedRejections.has(rejection.promise));
+
+ if (rejections.length > 0) {
+ rejections = rejections.map(rejection => {
+ let reason = rejection.reason;
+ if (!isObj(reason) || typeof reason.message !== 'string') {
+ reason = {
+ message: String(reason)
+ };
+ }
+ return serializeError(reason);
+ });
+
+ adapter.send('unhandledRejections', {rejections});
+ }
+
+ // Include dependencies in the final teardown message. This ensures the full
+ // set of dependencies is included no matter how the process exits, unless
+ // it flat out crashes.
+ adapter.send('teardown', {dependencies});
+});
+
+process.on('ava-exit', () => {
+ process.exit(0); // eslint-disable-line xo/no-process-exit
+});
diff --git a/node_modules/ava/lib/test.js b/node_modules/ava/lib/test.js
new file mode 100644
index 000000000..a9b0fb1d9
--- /dev/null
+++ b/node_modules/ava/lib/test.js
@@ -0,0 +1,416 @@
+'use strict';
+const isGeneratorFn = require('is-generator-fn');
+const co = require('co-with-promise');
+const observableToPromise = require('observable-to-promise');
+const isPromise = require('is-promise');
+const isObservable = require('is-observable');
+const plur = require('plur');
+const assert = require('./assert');
+const formatAssertError = require('./format-assert-error');
+const globals = require('./globals');
+
+class SkipApi {
+ constructor(test) {
+ this._test = test;
+ }
+}
+
+const captureStack = start => {
+ const limitBefore = Error.stackTraceLimit;
+ Error.stackTraceLimit = 1;
+ const obj = {};
+ Error.captureStackTrace(obj, start);
+ Error.stackTraceLimit = limitBefore;
+ return obj.stack;
+};
+
+class ExecutionContext {
+ constructor(test) {
+ this._test = test;
+ this.skip = new SkipApi(test);
+ }
+
+ plan(ct) {
+ this._test.plan(ct, captureStack(this.plan));
+ }
+
+ get end() {
+ const end = this._test.bindEndCallback();
+ const endFn = err => end(err, captureStack(endFn));
+ return endFn;
+ }
+
+ get title() {
+ return this._test.title;
+ }
+
+ get context() {
+ const contextRef = this._test.contextRef;
+ return contextRef && contextRef.context;
+ }
+
+ set context(context) {
+ const contextRef = this._test.contextRef;
+
+ if (!contextRef) {
+ this._test.saveFirstError(new Error(`\`t.context\` is not available in ${this._test.metadata.type} tests`));
+ return;
+ }
+
+ contextRef.context = context;
+ }
+
+ _throwsArgStart(assertion, file, line) {
+ this._test.trackThrows({assertion, file, line});
+ }
+ _throwsArgEnd() {
+ this._test.trackThrows(null);
+ }
+}
+Object.defineProperty(ExecutionContext.prototype, 'context', {enumerable: true});
+
+{
+ const assertions = assert.wrapAssertions({
+ pass(executionContext) {
+ executionContext._test.countPassedAssertion();
+ },
+
+ pending(executionContext, promise) {
+ executionContext._test.addPendingAssertion(promise);
+ },
+
+ fail(executionContext, error) {
+ executionContext._test.addFailedAssertion(error);
+ }
+ });
+ Object.assign(ExecutionContext.prototype, assertions);
+
+ function skipFn() {
+ this._test.countPassedAssertion();
+ }
+ Object.keys(assertions).forEach(el => {
+ SkipApi.prototype[el] = skipFn;
+ });
+}
+
+class Test {
+ constructor(options) {
+ this.contextRef = options.contextRef;
+ this.failWithoutAssertions = options.failWithoutAssertions;
+ this.fn = isGeneratorFn(options.fn) ? co.wrap(options.fn) : options.fn;
+ this.getSnapshotState = options.getSnapshotState;
+ this.metadata = options.metadata;
+ this.onResult = options.onResult;
+ this.title = options.title;
+
+ this.assertCount = 0;
+ this.assertError = undefined;
+ this.calledEnd = false;
+ this.duration = null;
+ this.endCallbackFinisher = null;
+ this.finishDueToAttributedError = null;
+ this.finishDueToInactivity = null;
+ this.finishing = false;
+ this.pendingAssertionCount = 0;
+ this.pendingThrowsAssertion = null;
+ this.planCount = null;
+ this.startedAt = 0;
+ }
+
+ bindEndCallback() {
+ if (this.metadata.callback) {
+ return (err, stack) => {
+ this.endCallback(err, 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) {
+ if (this.calledEnd) {
+ this.saveFirstError(new Error('`t.end()` called more than once'));
+ return;
+ }
+ this.calledEnd = true;
+
+ if (err) {
+ this.saveFirstError(new assert.AssertionError({
+ actual: err,
+ message: 'Callback called with an error',
+ stack,
+ values: [formatAssertError.formatWithLabel('Error:', err)]
+ }));
+ }
+
+ if (this.endCallbackFinisher) {
+ this.endCallbackFinisher();
+ }
+ }
+
+ createExecutionContext() {
+ return new ExecutionContext(this);
+ }
+
+ countPassedAssertion() {
+ if (this.finishing) {
+ this.saveFirstError(new Error('Assertion passed, but test has already finished'));
+ }
+
+ this.assertCount++;
+ }
+
+ addPendingAssertion(promise) {
+ if (this.finishing) {
+ this.saveFirstError(new Error('Assertion passed, but test has already finished'));
+ }
+
+ this.assertCount++;
+ this.pendingAssertionCount++;
+ promise
+ .catch(err => this.saveFirstError(err))
+ .then(() => this.pendingAssertionCount--);
+ }
+
+ addFailedAssertion(error) {
+ if (this.finishing) {
+ this.saveFirstError(new Error('Assertion failed, but test has already finished'));
+ }
+
+ this.assertCount++;
+ this.saveFirstError(error);
+ }
+
+ saveFirstError(err) {
+ if (!this.assertError) {
+ this.assertError = err;
+ }
+ }
+
+ plan(count, planStack) {
+ if (typeof count !== 'number') {
+ throw new TypeError('Expected a number');
+ }
+
+ this.planCount = count;
+
+ // In case the `planCount` doesn't match `assertCount, we need the stack of
+ // this function to throw with a useful stack.
+ this.planStack = planStack;
+ }
+
+ verifyPlan() {
+ if (!this.assertError && this.planCount !== null && this.planCount !== this.assertCount) {
+ this.saveFirstError(new assert.AssertionError({
+ assertion: 'plan',
+ message: `Planned for ${this.planCount} ${plur('assertion', this.planCount)}, but got ${this.assertCount}.`,
+ operator: '===',
+ stack: this.planStack
+ }));
+ }
+ }
+
+ verifyAssertions() {
+ if (!this.assertError) {
+ if (this.failWithoutAssertions && !this.calledEnd && this.planCount === null && this.assertCount === 0) {
+ this.saveFirstError(new Error('Test finished without running any assertions'));
+ } else if (this.pendingAssertionCount > 0) {
+ this.saveFirstError(new Error('Test finished, but an assertion is still pending'));
+ }
+ }
+ }
+
+ trackThrows(pending) {
+ this.pendingThrowsAssertion = pending;
+ }
+
+ detectImproperThrows(err) {
+ if (!this.pendingThrowsAssertion) {
+ return false;
+ }
+
+ const pending = this.pendingThrowsAssertion;
+ this.pendingThrowsAssertion = null;
+
+ const values = [];
+ if (err) {
+ values.push(formatAssertError.formatWithLabel(`The following error was thrown, possibly before \`t.${pending.assertion}()\` could be called:`, err));
+ }
+
+ 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,
+ values
+ }));
+ return true;
+ }
+
+ waitForPendingThrowsAssertion() {
+ return new Promise(resolve => {
+ this.finishDueToAttributedError = () => {
+ resolve(this.finishPromised());
+ };
+
+ this.finishDueToInactivity = () => {
+ this.detectImproperThrows();
+ resolve(this.finishPromised());
+ };
+
+ // Wait up to a second to see if an error can be attributed to the
+ // pending assertion.
+ globals.setTimeout(() => this.finishDueToInactivity(), 1000).unref();
+ });
+ }
+
+ attributeLeakedError(err) {
+ if (!this.detectImproperThrows(err)) {
+ return false;
+ }
+
+ this.finishDueToAttributedError();
+ return true;
+ }
+
+ callFn() {
+ try {
+ return {
+ ok: true,
+ retval: this.fn(this.createExecutionContext())
+ };
+ } catch (err) {
+ return {
+ ok: false,
+ error: err
+ };
+ }
+ }
+
+ run() {
+ this.startedAt = globals.now();
+
+ const result = this.callFn();
+ if (!result.ok) {
+ if (!this.detectImproperThrows(result.error)) {
+ this.saveFirstError(new assert.AssertionError({
+ message: 'Error thrown in test',
+ stack: result.error instanceof Error && result.error.stack,
+ values: [formatAssertError.formatWithLabel('Error:', result.error)]
+ }));
+ }
+ return this.finish();
+ }
+
+ const returnedObservable = isObservable(result.retval);
+ const returnedPromise = isPromise(result.retval);
+
+ let promise;
+ if (returnedObservable) {
+ promise = observableToPromise(result.retval);
+ } else if (returnedPromise) {
+ // `retval` can be any thenable, so convert to a proper promise.
+ promise = Promise.resolve(result.retval);
+ }
+
+ if (this.metadata.callback) {
+ if (returnedObservable || returnedPromise) {
+ const asyncType = returnedObservable ? 'observables' : 'promises';
+ this.saveFirstError(new Error(`Do not return ${asyncType} from tests declared via \`test.cb(...)\`, if you want to return a promise simply declare the test via \`test(...)\``));
+ return this.finish();
+ }
+
+ if (this.calledEnd) {
+ return this.finish();
+ }
+
+ return new Promise(resolve => {
+ this.endCallbackFinisher = () => {
+ resolve(this.finishPromised());
+ };
+
+ this.finishDueToAttributedError = () => {
+ resolve(this.finishPromised());
+ };
+
+ this.finishDueToInactivity = () => {
+ this.saveFirstError(new Error('`t.end()` was never called'));
+ resolve(this.finishPromised());
+ };
+ });
+ }
+
+ if (promise) {
+ return new Promise(resolve => {
+ this.finishDueToAttributedError = () => {
+ resolve(this.finishPromised());
+ };
+
+ this.finishDueToInactivity = () => {
+ const err = returnedObservable ?
+ new Error('Observable returned by test never completed') :
+ new Error('Promise returned by test never resolved');
+ this.saveFirstError(err);
+ resolve(this.finishPromised());
+ };
+
+ promise
+ .catch(err => {
+ if (!this.detectImproperThrows(err)) {
+ this.saveFirstError(new assert.AssertionError({
+ message: 'Rejected promise returned by test',
+ stack: err instanceof Error && err.stack,
+ values: [formatAssertError.formatWithLabel('Rejection reason:', err)]
+ }));
+ }
+ })
+ .then(() => resolve(this.finishPromised()));
+ });
+ }
+
+ return this.finish();
+ }
+
+ finish() {
+ this.finishing = true;
+
+ if (!this.assertError && this.pendingThrowsAssertion) {
+ return this.waitForPendingThrowsAssertion();
+ }
+
+ this.verifyPlan();
+ this.verifyAssertions();
+
+ this.duration = globals.now() - this.startedAt;
+
+ let reason = this.assertError;
+ let passed = !reason;
+
+ if (this.metadata.failing) {
+ passed = !passed;
+
+ if (passed) {
+ reason = undefined;
+ } else {
+ reason = new Error('Test was expected to fail, but succeeded, you should stop marking the test as failing');
+ }
+ }
+
+ this.onResult({
+ passed,
+ result: this,
+ reason
+ });
+
+ return passed;
+ }
+
+ finishPromised() {
+ return new Promise(resolve => {
+ resolve(this.finish());
+ });
+ }
+}
+
+module.exports = Test;
diff --git a/node_modules/ava/lib/validate-test.js b/node_modules/ava/lib/validate-test.js
new file mode 100644
index 000000000..8258a5990
--- /dev/null
+++ b/node_modules/ava/lib/validate-test.js
@@ -0,0 +1,48 @@
+'use strict';
+
+function validate(title, fn, metadata) {
+ if (metadata.type !== 'test') {
+ if (metadata.exclusive) {
+ return '`only` is only for tests and cannot be used with hooks';
+ }
+
+ if (metadata.failing) {
+ return '`failing` is only for tests and cannot be used with hooks';
+ }
+
+ if (metadata.todo) {
+ return '`todo` is only for documentation of future tests and cannot be used with hooks';
+ }
+ }
+
+ if (metadata.todo) {
+ if (typeof fn === 'function') {
+ return '`todo` tests are not allowed to have an implementation. Use ' +
+ '`test.skip()` for tests with an implementation.';
+ }
+
+ if (typeof title !== 'string') {
+ return '`todo` tests require a title';
+ }
+
+ if (metadata.skipped || metadata.failing || metadata.exclusive) {
+ return '`todo` tests are just for documentation and cannot be used with `skip`, `only`, or `failing`';
+ }
+ } else if (typeof fn !== 'function') {
+ return 'Expected an implementation. Use `test.todo()` for tests without an implementation.';
+ }
+
+ if (metadata.always) {
+ if (!(metadata.type === 'after' || metadata.type === 'afterEach')) {
+ return '`always` can only be used with `after` and `afterEach`';
+ }
+ }
+
+ if (metadata.skipped && metadata.exclusive) {
+ return '`only` tests cannot be skipped';
+ }
+
+ return null;
+}
+
+module.exports = validate;
diff --git a/node_modules/ava/lib/watcher.js b/node_modules/ava/lib/watcher.js
new file mode 100644
index 000000000..3d7094ffb
--- /dev/null
+++ b/node_modules/ava/lib/watcher.js
@@ -0,0 +1,322 @@
+'use strict';
+const nodePath = require('path');
+const debug = require('debug')('ava:watcher');
+const diff = require('lodash.difference');
+const chokidar = require('chokidar');
+const flatten = require('arr-flatten');
+const union = require('array-union');
+const uniq = require('array-uniq');
+const AvaFiles = require('./ava-files');
+
+function rethrowAsync(err) {
+ // Don't swallow exceptions. Note that any
+ // expected error should already have been logged
+ setImmediate(() => {
+ throw err;
+ });
+}
+
+class Debouncer {
+ constructor(watcher) {
+ this.watcher = watcher;
+ this.timer = null;
+ this.repeat = false;
+ }
+ debounce() {
+ if (this.timer) {
+ this.again = true;
+ return;
+ }
+
+ const timer = setTimeout(() => {
+ this.watcher.busy.then(() => {
+ // Do nothing if debouncing was canceled while waiting for the busy
+ // promise to fulfil
+ if (this.timer !== timer) {
+ return;
+ }
+
+ if (this.again) {
+ this.timer = null;
+ this.again = false;
+ this.debounce();
+ } else {
+ this.watcher.runAfterChanges();
+ this.timer = null;
+ this.again = false;
+ }
+ });
+ }, 10);
+
+ this.timer = timer;
+ }
+ cancel() {
+ if (this.timer) {
+ clearTimeout(this.timer);
+ this.timer = null;
+ this.again = false;
+ }
+ }
+}
+
+class TestDependency {
+ constructor(file, sources) {
+ this.file = file;
+ this.sources = sources;
+ }
+ contains(source) {
+ return this.sources.indexOf(source) !== -1;
+ }
+}
+
+class Watcher {
+ constructor(logger, api, files, sources) {
+ this.debouncer = new Debouncer(this);
+ this.avaFiles = new AvaFiles({
+ files,
+ sources
+ });
+
+ this.clearLogOnNextRun = true;
+ this.runVector = 0;
+ this.run = specificFiles => {
+ if (this.runVector > 0) {
+ const cleared = this.clearLogOnNextRun && logger.clear();
+ if (!cleared) {
+ logger.reset();
+ logger.section();
+ }
+ this.clearLogOnNextRun = true;
+
+ logger.reset();
+ logger.start();
+ }
+
+ this.runVector += 1;
+
+ const currentVector = this.runVector;
+
+ let runOnlyExclusive = false;
+
+ if (specificFiles) {
+ const exclusiveFiles = specificFiles.filter(file => this.filesWithExclusiveTests.indexOf(file) !== -1);
+
+ runOnlyExclusive = exclusiveFiles.length !== this.filesWithExclusiveTests.length;
+
+ if (runOnlyExclusive) {
+ // The test files that previously contained exclusive tests are always
+ // run, together with the remaining specific files.
+ const remainingFiles = diff(specificFiles, exclusiveFiles);
+ specificFiles = this.filesWithExclusiveTests.concat(remainingFiles);
+ }
+ }
+
+ this.busy = api.run(specificFiles || files, {runOnlyExclusive})
+ .then(runStatus => {
+ runStatus.previousFailCount = this.sumPreviousFailures(currentVector);
+ logger.finish(runStatus);
+
+ const badCounts = runStatus.failCount + runStatus.rejectionCount + runStatus.exceptionCount;
+ this.clearLogOnNextRun = this.clearLogOnNextRun && badCounts === 0;
+ })
+ .catch(rethrowAsync);
+ };
+
+ this.testDependencies = [];
+ this.trackTestDependencies(api, sources);
+
+ this.filesWithExclusiveTests = [];
+ this.trackExclusivity(api);
+
+ this.filesWithFailures = [];
+ this.trackFailures(api);
+
+ this.dirtyStates = {};
+ this.watchFiles();
+ this.rerunAll();
+ }
+ watchFiles() {
+ const patterns = this.avaFiles.getChokidarPatterns();
+
+ chokidar.watch(patterns.paths, {
+ ignored: patterns.ignored,
+ ignoreInitial: true
+ }).on('all', (event, path) => {
+ if (event === 'add' || event === 'change' || event === 'unlink') {
+ debug('Detected %s of %s', event, path);
+ this.dirtyStates[path] = event;
+ this.debouncer.debounce();
+ }
+ });
+ }
+ trackTestDependencies(api) {
+ const relative = absPath => nodePath.relative(process.cwd(), absPath);
+
+ api.on('test-run', runStatus => {
+ runStatus.on('dependencies', (file, dependencies) => {
+ const sourceDeps = dependencies.map(relative).filter(this.avaFiles.isSource);
+ this.updateTestDependencies(file, sourceDeps);
+ });
+ });
+ }
+ updateTestDependencies(file, sources) {
+ if (sources.length === 0) {
+ this.testDependencies = this.testDependencies.filter(dep => dep.file !== file);
+ return;
+ }
+
+ const isUpdate = this.testDependencies.some(dep => {
+ if (dep.file !== file) {
+ return false;
+ }
+
+ dep.sources = sources;
+
+ return true;
+ });
+
+ if (!isUpdate) {
+ this.testDependencies.push(new TestDependency(file, sources));
+ }
+ }
+ trackExclusivity(api) {
+ api.on('stats', stats => {
+ this.updateExclusivity(stats.file, stats.hasExclusive);
+ });
+ }
+ updateExclusivity(file, hasExclusiveTests) {
+ const index = this.filesWithExclusiveTests.indexOf(file);
+
+ if (hasExclusiveTests && index === -1) {
+ this.filesWithExclusiveTests.push(file);
+ } else if (!hasExclusiveTests && index !== -1) {
+ this.filesWithExclusiveTests.splice(index, 1);
+ }
+ }
+ trackFailures(api) {
+ api.on('test-run', (runStatus, files) => {
+ files.forEach(file => {
+ this.pruneFailures(nodePath.relative(process.cwd(), file));
+ });
+
+ const currentVector = this.runVector;
+ runStatus.on('error', err => {
+ this.countFailure(err.file, currentVector);
+ });
+ runStatus.on('test', result => {
+ if (result.error) {
+ this.countFailure(result.file, currentVector);
+ }
+ });
+ });
+ }
+ pruneFailures(file) {
+ this.filesWithFailures = this.filesWithFailures.filter(state => state.file !== file);
+ }
+ countFailure(file, vector) {
+ const isUpdate = this.filesWithFailures.some(state => {
+ if (state.file !== file) {
+ return false;
+ }
+
+ state.count++;
+ return true;
+ });
+
+ if (!isUpdate) {
+ this.filesWithFailures.push({
+ file,
+ vector,
+ count: 1
+ });
+ }
+ }
+ sumPreviousFailures(beforeVector) {
+ let total = 0;
+
+ this.filesWithFailures.forEach(state => {
+ if (state.vector < beforeVector) {
+ total += state.count;
+ }
+ });
+
+ return total;
+ }
+ cleanUnlinkedTests(unlinkedTests) {
+ unlinkedTests.forEach(testFile => {
+ this.updateTestDependencies(testFile, []);
+ this.updateExclusivity(testFile, false);
+ this.pruneFailures(testFile);
+ });
+ }
+ observeStdin(stdin) {
+ stdin.resume();
+ stdin.setEncoding('utf8');
+
+ stdin.on('data', data => {
+ data = data.trim().toLowerCase();
+ if (data !== 'r' && data !== 'rs') {
+ return;
+ }
+
+ // Cancel the debouncer, it might rerun specific tests whereas *all* tests
+ // need to be rerun
+ this.debouncer.cancel();
+ this.busy.then(() => {
+ // Cancel the debouncer again, it might have restarted while waiting for
+ // the busy promise to fulfil
+ this.debouncer.cancel();
+ this.clearLogOnNextRun = false;
+ this.rerunAll();
+ });
+ });
+ }
+ rerunAll() {
+ this.dirtyStates = {};
+ this.run();
+ }
+ runAfterChanges() {
+ const dirtyStates = this.dirtyStates;
+ this.dirtyStates = {};
+
+ const dirtyPaths = Object.keys(dirtyStates);
+ const dirtyTests = dirtyPaths.filter(this.avaFiles.isTest);
+ const dirtySources = diff(dirtyPaths, dirtyTests);
+ const addedOrChangedTests = dirtyTests.filter(path => dirtyStates[path] !== 'unlink');
+ const unlinkedTests = diff(dirtyTests, addedOrChangedTests);
+
+ this.cleanUnlinkedTests(unlinkedTests);
+
+ // No need to rerun tests if the only change is that tests were deleted
+ if (unlinkedTests.length === dirtyPaths.length) {
+ return;
+ }
+
+ if (dirtySources.length === 0) {
+ // Run any new or changed tests
+ this.run(addedOrChangedTests);
+ return;
+ }
+
+ // Try to find tests that depend on the changed source files
+ const testsBySource = dirtySources.map(path => {
+ return this.testDependencies.filter(dep => dep.contains(path)).map(dep => {
+ debug('%s is a dependency of %s', path, dep.file);
+ return dep.file;
+ });
+ }, this).filter(tests => tests.length > 0);
+
+ // Rerun all tests if source files were changed that could not be traced to
+ // specific tests
+ if (testsBySource.length !== dirtySources.length) {
+ debug('Sources remain that cannot be traced to specific tests. Rerunning all tests');
+ this.run();
+ return;
+ }
+
+ // Run all affected tests
+ this.run(union(addedOrChangedTests, uniq(flatten(testsBySource))));
+ }
+}
+
+module.exports = Watcher;
diff --git a/node_modules/ava/license b/node_modules/ava/license
new file mode 100644
index 000000000..654d0bfe9
--- /dev/null
+++ b/node_modules/ava/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/node_modules/ava/node_modules/.bin/js-yaml b/node_modules/ava/node_modules/.bin/js-yaml
new file mode 120000
index 000000000..daf9f1158
--- /dev/null
+++ b/node_modules/ava/node_modules/.bin/js-yaml
@@ -0,0 +1 @@
+../../../js-yaml/bin/js-yaml.js \ No newline at end of file
diff --git a/node_modules/ava/node_modules/.bin/mkdirp b/node_modules/ava/node_modules/.bin/mkdirp
new file mode 120000
index 000000000..91a5f623f
--- /dev/null
+++ b/node_modules/ava/node_modules/.bin/mkdirp
@@ -0,0 +1 @@
+../../../mkdirp/bin/cmd.js \ No newline at end of file
diff --git a/node_modules/ava/node_modules/has-flag/index.js b/node_modules/ava/node_modules/has-flag/index.js
new file mode 100644
index 000000000..68820307d
--- /dev/null
+++ b/node_modules/ava/node_modules/has-flag/index.js
@@ -0,0 +1,10 @@
+'use strict';
+module.exports = function (flag, argv) {
+ argv = argv || process.argv;
+
+ var terminatorPos = argv.indexOf('--');
+ var prefix = /^-{1,2}/.test(flag) ? '' : '--';
+ var pos = argv.indexOf(prefix + flag);
+
+ return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
+};
diff --git a/node_modules/ava/node_modules/has-flag/license b/node_modules/ava/node_modules/has-flag/license
new file mode 100644
index 000000000..654d0bfe9
--- /dev/null
+++ b/node_modules/ava/node_modules/has-flag/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/node_modules/ava/node_modules/has-flag/package.json b/node_modules/ava/node_modules/has-flag/package.json
new file mode 100644
index 000000000..bfcd302ea
--- /dev/null
+++ b/node_modules/ava/node_modules/has-flag/package.json
@@ -0,0 +1,49 @@
+{
+ "name": "has-flag",
+ "version": "2.0.0",
+ "description": "Check if argv has a specific flag",
+ "license": "MIT",
+ "repository": "sindresorhus/has-flag",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "maintainers": [
+ "Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)",
+ "Joshua Appelman <jappelman@xebia.com> (jbnicolai.com)",
+ "JD Ballard <i.am.qix@gmail.com> (github.com/qix-)"
+ ],
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "scripts": {
+ "test": "xo && ava"
+ },
+ "files": [
+ "index.js"
+ ],
+ "keywords": [
+ "has",
+ "check",
+ "detect",
+ "contains",
+ "find",
+ "flag",
+ "cli",
+ "command-line",
+ "argv",
+ "process",
+ "arg",
+ "args",
+ "argument",
+ "arguments",
+ "getopt",
+ "minimist",
+ "optimist"
+ ],
+ "devDependencies": {
+ "ava": "*",
+ "xo": "*"
+ }
+}
diff --git a/node_modules/ava/node_modules/has-flag/readme.md b/node_modules/ava/node_modules/has-flag/readme.md
new file mode 100644
index 000000000..0caca6cba
--- /dev/null
+++ b/node_modules/ava/node_modules/has-flag/readme.md
@@ -0,0 +1,67 @@
+# has-flag [![Build Status](https://travis-ci.org/sindresorhus/has-flag.svg?branch=master)](https://travis-ci.org/sindresorhus/has-flag)
+
+> Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag
+
+Correctly stops looking after an `--` argument terminator.
+
+
+## Install
+
+```
+$ npm install --save has-flag
+```
+
+
+## Usage
+
+```js
+// foo.js
+const hasFlag = require('has-flag');
+
+hasFlag('unicorn');
+//=> true
+
+hasFlag('--unicorn');
+//=> true
+
+hasFlag('-f');
+//=> true
+
+hasFlag('foo=bar');
+//=> true
+
+hasFlag('foo');
+//=> false
+
+hasFlag('rainbow');
+//=> false
+```
+
+```
+$ node foo.js -f --unicorn --foo=bar -- --rainbow
+```
+
+
+## API
+
+### hasFlag(flag, [argv])
+
+Returns a boolean whether the flag exists.
+
+#### flag
+
+Type: `string`
+
+CLI flag to look for. The `--` prefix is optional.
+
+#### argv
+
+Type: `array`<br>
+Default: `process.argv`
+
+CLI arguments.
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/node_modules/ava/node_modules/md5-hex/browser.js b/node_modules/ava/node_modules/md5-hex/browser.js
new file mode 100644
index 000000000..d6c2da0bf
--- /dev/null
+++ b/node_modules/ava/node_modules/md5-hex/browser.js
@@ -0,0 +1,10 @@
+'use strict';
+const md5OMatic = require('md5-o-matic');
+
+module.exports = input => {
+ if (Array.isArray(input)) {
+ input = input.join('');
+ }
+
+ return md5OMatic(input);
+};
diff --git a/node_modules/ava/node_modules/md5-hex/index.js b/node_modules/ava/node_modules/md5-hex/index.js
new file mode 100644
index 000000000..82cfae306
--- /dev/null
+++ b/node_modules/ava/node_modules/md5-hex/index.js
@@ -0,0 +1,23 @@
+'use strict';
+const crypto = require('crypto');
+
+module.exports = function (input) {
+ const hash = crypto.createHash('md5');
+
+ const update = buf => {
+ const inputEncoding = typeof buf === 'string' ? 'utf8' : undefined;
+ hash.update(buf, inputEncoding);
+ };
+
+ if (arguments.length > 1) {
+ throw new Error('Too many arguments. Try specifying an array.');
+ }
+
+ if (Array.isArray(input)) {
+ input.forEach(update);
+ } else {
+ update(input);
+ }
+
+ return hash.digest('hex');
+};
diff --git a/node_modules/ava/node_modules/md5-hex/license b/node_modules/ava/node_modules/md5-hex/license
new file mode 100644
index 000000000..654d0bfe9
--- /dev/null
+++ b/node_modules/ava/node_modules/md5-hex/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/node_modules/ava/node_modules/md5-hex/package.json b/node_modules/ava/node_modules/md5-hex/package.json
new file mode 100644
index 000000000..a87ce154f
--- /dev/null
+++ b/node_modules/ava/node_modules/md5-hex/package.json
@@ -0,0 +1,39 @@
+{
+ "name": "md5-hex",
+ "version": "2.0.0",
+ "description": "Create a MD5 hash with hex encoding",
+ "license": "MIT",
+ "repository": "sindresorhus/md5-hex",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "scripts": {
+ "test": "xo && ava"
+ },
+ "files": [
+ "index.js",
+ "browser.js"
+ ],
+ "keywords": [
+ "hash",
+ "crypto",
+ "md5",
+ "hex",
+ "buffer",
+ "browser",
+ "browserify"
+ ],
+ "dependencies": {
+ "md5-o-matic": "^0.1.1"
+ },
+ "devDependencies": {
+ "ava": "*",
+ "xo": "*"
+ },
+ "browser": "browser.js"
+}
diff --git a/node_modules/ava/node_modules/md5-hex/readme.md b/node_modules/ava/node_modules/md5-hex/readme.md
new file mode 100644
index 000000000..630b31d0b
--- /dev/null
+++ b/node_modules/ava/node_modules/md5-hex/readme.md
@@ -0,0 +1,46 @@
+# md5-hex [![Build Status](https://travis-ci.org/sindresorhus/md5-hex.svg?branch=master)](https://travis-ci.org/sindresorhus/md5-hex)
+
+> Create a MD5 hash with hex encoding
+
+*Please don't use MD5 hashes for anything sensitive!*
+
+Works in the browser too, when used with browserify/webpack.
+
+Checkout [`hasha`](https://github.com/sindresorhus/hasha) if you need something more flexible.
+
+
+## Install
+
+```
+$ npm install --save md5-hex
+```
+
+
+## Usage
+
+```js
+const fs = require('fs');
+const md5Hex = require('md5-hex');
+const buffer = fs.readFileSync('unicorn.png');
+
+md5Hex(buffer);
+//=> '1abcb33beeb811dca15f0ac3e47b88d9'
+```
+
+
+## API
+
+### md5Hex(input)
+
+#### input
+
+Type: `Buffer` `string` `Buffer[]` `string[]`
+
+Prefer buffers as they're faster to hash, but strings can be useful for small things.
+
+Pass an array instead of concatenating strings and/or buffers. The output is the same, but arrays do not incur the overhead of concatenation.
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/node_modules/ava/package.json b/node_modules/ava/package.json
new file mode 100644
index 000000000..eb9678ff1
--- /dev/null
+++ b/node_modules/ava/package.json
@@ -0,0 +1,209 @@
+{
+ "name": "ava",
+ "version": "0.19.1",
+ "description": "Futuristic test runner 🚀",
+ "license": "MIT",
+ "repository": "avajs/ava",
+ "homepage": "https://ava.li",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "maintainers": [
+ {
+ "name": "Vadim Demedes",
+ "email": "vdemedes@gmail.com",
+ "url": "github.com/vadimdemedes"
+ },
+ {
+ "name": "James Talmage",
+ "email": "james@talmage.io",
+ "url": "github.com/jamestalmage"
+ },
+ {
+ "name": "Mark Wubben",
+ "email": "mark@novemberborn.net",
+ "url": "novemberborn.net"
+ },
+ {
+ "name": "Juan Soto",
+ "email": "juan@juansoto.me",
+ "url": "juansoto.me"
+ },
+ {
+ "name": "Jeroen Engels",
+ "email": "jfm.engels@gmail.com",
+ "url": "github.com/jfmengels"
+ }
+ ],
+ "bin": "cli.js",
+ "typings": "types/generated.d.ts",
+ "engines": {
+ "node": ">=4"
+ },
+ "scripts": {
+ "test": "xo && flow check test/flow-types && tsc -p test/ts-types && nyc tap --no-cov --timeout=150 --jobs=4 test/*.js test/reporters/*.js",
+ "test-win": "tap --no-cov --reporter=classic --timeout=150 --jobs=4 test/*.js test/reporters/*.js",
+ "visual": "node test/visual/run-visual-tests.js",
+ "prepublish": "npm run make-ts",
+ "make-ts": "node types/make.js"
+ },
+ "files": [
+ "lib",
+ "*.js",
+ "*.js.flow",
+ "types/generated.d.ts"
+ ],
+ "keywords": [
+ "test",
+ "runner",
+ "ava",
+ "concurrent",
+ "parallel",
+ "fast",
+ "tape",
+ "tap",
+ "jest",
+ "mocha",
+ "qunit",
+ "jasmine",
+ "testing",
+ "tdd",
+ "cli-app",
+ "cli",
+ "assert",
+ "assertion",
+ "futuristic",
+ "promise",
+ "promises",
+ "async",
+ "function",
+ "await",
+ "generator",
+ "generators",
+ "yield",
+ "observable",
+ "observables"
+ ],
+ "dependencies": {
+ "@ava/babel-preset-stage-4": "^1.0.0",
+ "@ava/babel-preset-transform-test-files": "^3.0.0",
+ "@ava/pretty-format": "^1.1.0",
+ "arr-flatten": "^1.0.1",
+ "array-union": "^1.0.1",
+ "array-uniq": "^1.0.2",
+ "arrify": "^1.0.0",
+ "auto-bind": "^1.1.0",
+ "ava-init": "^0.2.0",
+ "babel-code-frame": "^6.16.0",
+ "babel-core": "^6.17.0",
+ "bluebird": "^3.0.0",
+ "caching-transform": "^1.0.0",
+ "chalk": "^1.0.0",
+ "chokidar": "^1.4.2",
+ "clean-stack": "^1.1.1",
+ "clean-yaml-object": "^0.1.0",
+ "cli-cursor": "^2.1.0",
+ "cli-spinners": "^1.0.0",
+ "cli-truncate": "^1.0.0",
+ "co-with-promise": "^4.6.0",
+ "code-excerpt": "^2.1.0",
+ "common-path-prefix": "^1.0.0",
+ "convert-source-map": "^1.2.0",
+ "core-assert": "^0.2.0",
+ "currently-unhandled": "^0.4.1",
+ "debug": "^2.2.0",
+ "diff": "^3.0.1",
+ "diff-match-patch": "^1.0.0",
+ "dot-prop": "^4.1.0",
+ "empower-core": "^0.6.1",
+ "equal-length": "^1.0.0",
+ "figures": "^2.0.0",
+ "find-cache-dir": "^0.1.1",
+ "fn-name": "^2.0.0",
+ "get-port": "^3.0.0",
+ "globby": "^6.0.0",
+ "has-flag": "^2.0.0",
+ "hullabaloo-config-manager": "^1.0.0",
+ "ignore-by-default": "^1.0.0",
+ "indent-string": "^3.0.0",
+ "is-ci": "^1.0.7",
+ "is-generator-fn": "^1.0.0",
+ "is-obj": "^1.0.0",
+ "is-observable": "^0.2.0",
+ "is-promise": "^2.1.0",
+ "jest-diff": "19.0.0",
+ "jest-snapshot": "19.0.2",
+ "js-yaml": "^3.8.2",
+ "last-line-stream": "^1.0.0",
+ "lodash.debounce": "^4.0.3",
+ "lodash.difference": "^4.3.0",
+ "lodash.flatten": "^4.2.0",
+ "lodash.isequal": "^4.5.0",
+ "loud-rejection": "^1.2.0",
+ "matcher": "^0.1.1",
+ "md5-hex": "^2.0.0",
+ "meow": "^3.7.0",
+ "mkdirp": "^0.5.1",
+ "ms": "^0.7.1",
+ "multimatch": "^2.1.0",
+ "observable-to-promise": "^0.5.0",
+ "option-chain": "^0.1.0",
+ "package-hash": "^2.0.0",
+ "pkg-conf": "^2.0.0",
+ "plur": "^2.0.0",
+ "pretty-ms": "^2.0.0",
+ "require-precompiled": "^0.1.0",
+ "resolve-cwd": "^1.0.0",
+ "slash": "^1.0.0",
+ "source-map-support": "^0.4.0",
+ "stack-utils": "^1.0.0",
+ "strip-ansi": "^3.0.1",
+ "strip-bom-buf": "^1.0.0",
+ "supports-color": "^3.2.3",
+ "time-require": "^0.1.2",
+ "unique-temp-dir": "^1.0.0",
+ "update-notifier": "^2.1.0"
+ },
+ "devDependencies": {
+ "babel-preset-react": "^6.5.0",
+ "cli-table2": "^0.2.0",
+ "coveralls": "^2.11.4",
+ "delay": "^1.3.0",
+ "execa": "^0.6.0",
+ "flow-bin": "^0.42.0",
+ "get-stream": "^3.0.0",
+ "git-branch": "^0.3.0",
+ "has-ansi": "^2.0.0",
+ "inquirer": "^3.0.5",
+ "is-array-sorted": "^1.0.0",
+ "lolex": "^1.4.0",
+ "nyc": "^10.0.0",
+ "proxyquire": "^1.7.4",
+ "rimraf": "^2.5.0",
+ "signal-exit": "^3.0.0",
+ "sinon": "^2.0.0",
+ "source-map-fixtures": "^2.1.0",
+ "tap": "^10.0.0",
+ "temp-write": "^3.1.0",
+ "touch": "^1.0.0",
+ "typescript": "^2.2.2",
+ "xo": "^0.18.0",
+ "zen-observable": "^0.5.1"
+ },
+ "xo": {
+ "esnext": true,
+ "rules": {
+ "import/newline-after-import": "off",
+ "no-use-extend-native/no-use-extend-native": "off"
+ }
+ },
+ "nyc": {
+ "reporter": [
+ "html",
+ "lcov",
+ "text"
+ ]
+ }
+}
diff --git a/node_modules/ava/profile.js b/node_modules/ava/profile.js
new file mode 100644
index 000000000..530543fcb
--- /dev/null
+++ b/node_modules/ava/profile.js
@@ -0,0 +1,161 @@
+'use strict';
+
+// Iron-node does not work with forked processes
+// This cli command will run a single file in the current process.
+// Intended to be used with iron-node for profiling purposes.
+
+const path = require('path');
+const EventEmitter = require('events');
+const meow = require('meow');
+const Promise = require('bluebird');
+const pkgConf = require('pkg-conf');
+const findCacheDir = require('find-cache-dir');
+const uniqueTempDir = require('unique-temp-dir');
+const arrify = require('arrify');
+const resolveCwd = require('resolve-cwd');
+const babelConfigHelper = require('./lib/babel-config');
+const CachingPrecompiler = require('./lib/caching-precompiler');
+const globals = require('./lib/globals');
+
+function resolveModules(modules) {
+ return arrify(modules).map(name => {
+ const modulePath = resolveCwd(name);
+
+ if (modulePath === null) {
+ throw new Error(`Could not resolve required module '${name}'`);
+ }
+
+ return modulePath;
+ });
+}
+
+// Chrome gets upset when the `this` value is non-null for these functions
+globals.setTimeout = setTimeout.bind(null);
+globals.clearTimeout = clearTimeout.bind(null);
+
+Promise.longStackTraces();
+
+const conf = pkgConf.sync('ava', {
+ defaults: {
+ babel: 'default'
+ }
+});
+
+// Define a minimal set of options from the main CLI
+const cli = meow(`
+ Usage
+ $ iron-node node_modules/ava/profile.js <test-file>
+
+ Options
+ --fail-fast Stop after first test failure
+ --serial, -s Run tests serially
+
+`, {
+ string: [
+ '_'
+ ],
+ boolean: [
+ 'fail-fast',
+ 'verbose',
+ 'serial',
+ 'tap'
+ ],
+ default: conf,
+ alias: {
+ s: 'serial'
+ }
+});
+
+if (cli.input.length !== 1) {
+ throw new Error('Specify a test file');
+}
+
+const file = path.resolve(cli.input[0]);
+const cacheDir = findCacheDir({
+ name: 'ava',
+ files: [file]
+}) || uniqueTempDir();
+
+babelConfigHelper.build(process.cwd(), cacheDir, conf.babel, true)
+ .then(result => {
+ const precompiler = new CachingPrecompiler({
+ path: cacheDir,
+ getBabelOptions: result.getOptions,
+ babelCacheKeys: result.cacheKeys
+ });
+
+ const precompiled = {};
+ precompiled[file] = precompiler.precompileFile(file);
+
+ const opts = {
+ file,
+ failFast: cli.flags.failFast,
+ serial: cli.flags.serial,
+ tty: false,
+ cacheDir,
+ precompiled,
+ require: resolveModules(conf.require)
+ };
+
+ const events = new EventEmitter();
+ let uncaughtExceptionCount = 0;
+
+ // Mock the behavior of a parent process
+ process.channel = {ref() {}, unref() {}};
+ process.send = data => {
+ if (data && data.ava) {
+ const name = data.name.replace(/^ava-/, '');
+
+ if (events.listeners(name).length > 0) {
+ events.emit(name, data.data);
+ } else {
+ console.log('UNHANDLED AVA EVENT:', name, data.data);
+ }
+
+ return;
+ }
+
+ console.log('NON AVA EVENT:', data);
+ };
+
+ events.on('test', data => {
+ console.log('TEST:', data.title, data.error);
+ });
+
+ events.on('results', data => {
+ if (console.profileEnd) {
+ console.profileEnd();
+ }
+
+ console.log('RESULTS:', data.stats);
+
+ if (process.exit) {
+ process.exit(data.stats.failCount + uncaughtExceptionCount); // eslint-disable-line unicorn/no-process-exit
+ }
+ });
+
+ events.on('stats', () => {
+ setImmediate(() => {
+ process.emit('ava-run', {});
+ });
+ });
+
+ events.on('uncaughtException', data => {
+ uncaughtExceptionCount++;
+ let stack = data && data.exception && data.exception.stack;
+ stack = stack || data;
+ console.log(stack);
+ });
+
+ // `test-worker` will read process.argv[2] for options
+ process.argv[2] = JSON.stringify(opts);
+ process.argv.length = 3;
+
+ if (console.profile) {
+ console.profile('AVA test-worker process');
+ }
+
+ setImmediate(() => {
+ require('./lib/test-worker'); // eslint-disable-line import/no-unassigned-import
+ });
+ });
diff --git a/node_modules/ava/readme.md b/node_modules/ava/readme.md
new file mode 100644
index 000000000..1283a43bb
--- /dev/null
+++ b/node_modules/ava/readme.md
@@ -0,0 +1,1209 @@
+# [![AVA](media/header.png)](https://ava.li)
+
+> Futuristic test runner
+
+[![Build Status: Linux](https://travis-ci.org/avajs/ava.svg?branch=master)](https://travis-ci.org/avajs/ava) [![Build status: Windows](https://ci.appveyor.com/api/projects/status/e7v91mu2m5x48ehx/branch/master?svg=true)](https://ci.appveyor.com/project/ava/ava/branch/master) [![Coverage Status](https://coveralls.io/repos/github/avajs/ava/badge.svg?branch=master)](https://coveralls.io/github/avajs/ava?branch=master) [![Dependency Status](https://dependencyci.com/github/avajs/ava/badge)](https://dependencyci.com/github/avajs/ava) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo) [![Gitter](https://badges.gitter.im/join_chat.svg)](https://gitter.im/avajs/ava)
+
+Even though JavaScript is single-threaded, IO in Node.js can happen in parallel due to its async nature. AVA takes advantage of this and runs your tests concurrently, which is especially beneficial for IO heavy tests. In addition, test files are run in parallel as separate processes, giving you even better performance and an isolated environment for each test file. [Switching](https://github.com/sindresorhus/pageres/commit/663be15acb3dd2eb0f71b1956ef28c2cd3fdeed0) from Mocha to AVA in Pageres brought the test time down from 31 to 11 seconds. Having tests run concurrently forces you to write atomic tests, meaning tests don't depend on global state or the state of other tests, which is a great thing!
+
+![](media/screenshot-mini-reporter.gif)
+
+*Read our [contributing guide](contributing.md) if you're looking to contribute (issues/PRs/etc).*
+
+Follow the [AVA Twitter account](https://twitter.com/ava__js) for updates.
+
+Translations: [Español](https://github.com/avajs/ava-docs/blob/master/es_ES/readme.md), [Français](https://github.com/avajs/ava-docs/blob/master/fr_FR/readme.md), [Italiano](https://github.com/avajs/ava-docs/blob/master/it_IT/readme.md), [日本語](https://github.com/avajs/ava-docs/blob/master/ja_JP/readme.md), [한국어](https://github.com/avajs/ava-docs/blob/master/ko_KR/readme.md), [Português](https://github.com/avajs/ava-docs/blob/master/pt_BR/readme.md), [Русский](https://github.com/avajs/ava-docs/blob/master/ru_RU/readme.md), [简体中文](https://github.com/avajs/ava-docs/blob/master/zh_CN/readme.md)
+
+
+## Contents
+
+- [Usage](#usage)
+- [CLI Usage](#cli)
+- [Debugging](#debugging)
+- [Reporters](#reporters)
+- [Configuration](#configuration)
+- [Documentation](#documentation)
+- [API](#api)
+- [Assertions](#assertions)
+- [Snapshot testing](#snapshot-testing)
+- [Tips](#tips)
+- [FAQ](#faq)
+- [Recipes](#recipes)
+- [Support](#support)
+- [Related](#related)
+- [Links](#links)
+- [Team](#team)
+
+
+## Why AVA?
+
+- Minimal and fast
+- Simple test syntax
+- Runs tests concurrently
+- Enforces writing atomic tests
+- No implicit globals
+- Includes TypeScript & Flow type definitions
+- [Magic assert](#magic-assert)
+- [Isolated environment for each test file](#process-isolation)
+- [Write your tests in ES2017](#es2017-support)
+- [Promise support](#promise-support)
+- [Generator function support](#generator-function-support)
+- [Async function support](#async-function-support)
+- [Observable support](#observable-support)
+- [Enhanced assertion messages](#enhanced-assertion-messages)
+- [TAP reporter](#tap-reporter)
+- [Automatic migration from other test runners](https://github.com/avajs/ava-codemods#migrating-to-ava)
+
+
+## Test syntax
+
+```js
+import test from 'ava';
+
+test(t => {
+ t.deepEqual([1, 2], [1, 2]);
+});
+```
+
+## Usage
+
+### Add AVA to your project
+
+Install AVA globally and run it with `--init` to add AVA to your `package.json`. [Yarn](https://yarnpkg.com/) currently provides significant speed improvements over npm during the installation process. Consider [using Yarn](https://yarnpkg.com/en/docs/install) if the installation is too slow for your needs.
+
+
+```console
+$ yarn global add ava
+$ ava --init
+```
+
+If you prefer using npm:
+
+```console
+$ npm install --global ava
+$ ava --init
+```
+
+Your `package.json` will then look like this:
+
+```json
+{
+ "name": "awesome-package",
+ "scripts": {
+ "test": "ava"
+ },
+ "devDependencies": {
+ "ava": "^0.18.0"
+ }
+}
+```
+
+Any arguments passed after `--init` are added as config to `package.json`.
+
+#### Manual installation
+
+You can also install AVA directly:
+
+```console
+$ yarn add --dev ava
+```
+
+Alternatively using npm:
+
+```console
+$ npm install --save-dev ava
+```
+
+You'll have to configure the `test` script in your `package.json` to use `ava` (see above).
+
+### Create your test file
+
+Create a file named `test.js` in the project root directory:
+
+```js
+import test from 'ava';
+
+test('foo', t => {
+ t.pass();
+});
+
+test('bar', async t => {
+ const bar = Promise.resolve('bar');
+
+ t.is(await bar, 'bar');
+});
+```
+
+### Run it
+
+```console
+$ npm test
+```
+
+### Watch it
+
+```console
+$ npm test -- --watch
+```
+
+AVA comes with an intelligent watch mode. [Learn more in its recipe](docs/recipes/watch-mode.md).
+
+## CLI
+
+```console
+$ ava --help
+
+ Usage
+ ava [<file|directory|glob> ...]
+
+ Options
+ --init Add AVA to your project
+ --fail-fast Stop after first test failure
+ --serial, -s Run tests serially
+ --tap, -t Generate TAP output
+ --verbose, -v Enable verbose output
+ --no-cache Disable the transpiler cache
+ --no-power-assert Disable Power Assert
+ --color Force color output
+ --no-color Disable color output
+ --match, -m Only run tests with matching title (Can be repeated)
+ --watch, -w Re-run tests when tests and source files change
+ --timeout, -T Set global timeout
+ --concurrency, -c Maximum number of test files running at the same time (EXPERIMENTAL)
+ --update-snapshots, -u Update snapshots
+
+ Examples
+ ava
+ ava test.js test2.js
+ ava test-*.js
+ ava test
+ ava --init
+ ava --init foo.js
+
+ Default patterns when no arguments:
+ test.js test-*.js test/**/*.js **/__tests__/**/*.js **/*.test.js
+```
+
+*Note that the CLI will use your local install of AVA when available, even when run globally.*
+
+Directories are recursed, with all `*.js` files being treated as test files. Directories named `fixtures`, `helpers` and `node_modules` are *always* ignored. So are files starting with `_` which allows you to place helpers in the same directory as your test files.
+
+When using `npm test`, you can pass positional arguments directly `npm test test2.js`, but flags needs to be passed like `npm test -- --verbose`.
+
+
+## Debugging
+
+AVA runs tests in child processes, so to debug tests, you need to do this workaround:
+
+```console
+$ node --inspect node_modules/ava/profile.js some/test/file.js
+```
+
+### Debugger-specific tips
+
+- [Chrome DevTools](docs/recipes/debugging-with-chrome-devtools.md)
+- [WebStorm](docs/recipes/debugging-with-webstorm.md)
+
+
+## Reporters
+
+### Mini-reporter
+
+The mini-reporter is the default reporter.
+
+<img src="media/screenshot-mini-reporter.gif" width="460">
+
+### Verbose reporter
+
+Use the `--verbose` flag to enable the verbose reporter. This is always used in CI environments unless the [TAP reporter](#tap-reporter) is enabled.
+
+<img src="media/screenshot.png" width="150">
+
+### TAP reporter
+
+AVA supports the TAP format and thus is compatible with [any TAP reporter](https://github.com/sindresorhus/awesome-tap#reporters). Use the `--tap` flag to enable TAP output.
+
+```console
+$ ava --tap | tap-nyan
+```
+
+<img src="media/tap-output.png" width="398">
+
+Please note that the TAP reporter is unavailable when using [watch mode](#watch-it).
+
+### Magic assert
+
+AVA adds code excerpts and clean diffs for actual and expected values. If values in the assertion are objects or arrays, only a diff is displayed, to remove the noise and focus on the problem. The diff is syntax-highlighted too! If you are comparing strings, both single and multi line, AVA displays a different kind of output, highlighting the added or missing characters.
+
+![](media/magic-assert-combined.png)
+
+### Clean stack traces
+
+AVA automatically removes unrelated lines in stack traces, allowing you to find the source of an error much faster, as seen above.
+
+
+## Configuration
+
+All of the CLI options can be configured in the `ava` section of your `package.json`. This allows you to modify the default behavior of the `ava` command, so you don't have to repeatedly type the same options on the command prompt.
+
+```json
+{
+ "ava": {
+ "files": [
+ "my-test-folder/*.js",
+ "!**/not-this-file.js"
+ ],
+ "source": [
+ "**/*.{js,jsx}",
+ "!dist/**/*"
+ ],
+ "match": [
+ "*oo",
+ "!foo"
+ ],
+ "concurrency": 5,
+ "failFast": true,
+ "failWithoutAssertions": false,
+ "tap": true,
+ "powerAssert": false,
+ "require": [
+ "babel-register"
+ ],
+ "babel": "inherit"
+ }
+}
+```
+
+Arguments passed to the CLI will always take precedence over the configuration in `package.json`.
+
+See the [ES2017 support](#es2017-support) section for details on the `babel` option.
+
+## Documentation
+
+Tests are run concurrently. You can specify synchronous and asynchronous tests. Tests are considered synchronous unless you return a promise or [observable](https://github.com/zenparsing/zen-observable).
+
+We *highly* recommend the use of [async functions](#async-function-support). They make asynchronous code concise and readable, and they implicitly return a promise so you don't have to.
+
+If you're unable to use promises or observables, you may enable "callback mode" by defining your test with `test.cb([title], fn)`. Tests declared this way **must** be manually ended with `t.end()`. This mode is mainly intended for testing callback-style APIs. However, we would strongly recommend [promisifying](https://github.com/sindresorhus/pify) callback-style APIs instead of using "callback mode", as this results in more correct and readable tests.
+
+You must define all tests synchronously. They can't be defined inside `setTimeout`, `setImmediate`, etc.
+
+AVA tries to run test files with their current working directory set to the directory that contains your `package.json` file.
+
+### Creating tests
+
+To create a test you call the `test` function you imported from AVA. Provide the optional title and implementation function. The function will be called when your test is run. It's passed an [execution object](#t) as its first argument.
+
+**Note:** In order for the [enhanced assertion messages](#enhanced-assertion-messages) to behave correctly, the first argument **must** be named `t`.
+
+```js
+import test from 'ava';
+
+test('my passing test', t => {
+ t.pass();
+});
+```
+
+#### Titles
+
+Titles are optional, meaning you can do:
+
+```js
+test(t => {
+ t.pass();
+});
+```
+
+It's recommended to provide test titles if you have more than one test.
+
+If you haven't provided a test title, but the implementation is a named function, that name will be used as the test title:
+
+```js
+test(function name(t) {
+ t.pass();
+});
+```
+
+### Assertion planning
+
+Assertion plans ensure tests only pass when a specific number of assertions have been executed. They'll help you catch cases where tests exit too early. They'll also cause tests to fail if too many assertions are executed, which can be useful if you have assertions inside callbacks or loops.
+
+If you do not specify an assertion plan, your test will still fail if no assertions are executed. Set the `failWithoutAssertions` option to `false` in AVA's [`package.json` configuration](#configuration) to disable this behavior.
+
+Note that, unlike [`tap`](https://www.npmjs.com/package/tap) and [`tape`](https://www.npmjs.com/package/tape), AVA does *not* automatically end a test when the planned assertion count is reached.
+
+These examples will result in a passed test:
+
+```js
+test(t => {
+ t.plan(1);
+
+ return Promise.resolve(3).then(n => {
+ t.is(n, 3);
+ });
+});
+
+test.cb(t => {
+ t.plan(1);
+
+ someAsyncFunction(() => {
+ t.pass();
+ t.end();
+ });
+});
+```
+
+These won't:
+
+```js
+test(t => {
+ t.plan(2);
+
+ for (let i = 0; i < 3; i++) {
+ t.true(i < 3);
+ }
+}); // Fails, 3 assertions are executed which is too many
+
+test(t => {
+ t.plan(1);
+
+ someAsyncFunction(() => {
+ t.pass();
+ });
+}); // Fails, the test ends synchronously before the assertion is executed
+```
+
+### Running tests serially
+
+By default tests are run concurrently, which is awesome. Sometimes though you have to write tests that cannot run concurrently.
+
+In these rare cases you can use the `.serial` modifier. It will force those tests to run serially *before* the concurrent ones.
+
+```js
+test.serial(t => {
+ t.pass();
+});
+```
+
+Note that this only applies to tests within a particular test file. AVA will still run multiple tests files at the same time unless you pass the [`--serial` CLI flag](#cli).
+
+### Running specific tests
+
+During development it can be helpful to only run a few specific tests. This can be accomplished using the `.only` modifier:
+
+```js
+test('will not be run', t => {
+ t.fail();
+});
+
+test.only('will be run', t => {
+ t.pass();
+});
+```
+
+`.only` applies across all test files, so if you use it in one file, no tests from the other file will run.
+
+### Running tests with matching titles
+
+The `--match` flag allows you to run just the tests that have a matching title. This is achieved with simple wildcard patterns. Patterns are case insensitive. See [`matcher`](https://github.com/sindresorhus/matcher) for more details.
+
+Match titles ending with `foo`:
+
+```console
+$ ava --match='*foo'
+```
+
+Match titles starting with `foo`:
+
+```console
+$ ava --match='foo*'
+```
+
+Match titles containing `foo`:
+
+```console
+$ ava --match='*foo*'
+```
+
+Match titles that are *exactly* `foo` (albeit case insensitively):
+
+```console
+$ ava --match='foo'
+```
+
+Match titles not containing `foo`:
+
+```console
+$ ava --match='!*foo*'
+```
+
+Match titles starting with `foo` and ending with `bar`:
+
+```console
+$ ava --match='foo*bar'
+```
+
+Match titles starting with `foo` or ending with `bar`:
+
+```console
+$ ava --match='foo*' --match='*bar'
+```
+
+Note that a match pattern takes precedence over the `.only` modifier. Only tests with an explicit title are matched. Tests without titles or whose title is derived from the implementation function will be skipped when `--match` is used.
+
+Here's what happens when you run AVA with a match pattern of `*oo*` and the following tests:
+
+```js
+test('foo will run', t => {
+ t.pass();
+});
+
+test('moo will also run', t => {
+ t.pass();
+});
+
+test.only('boo will run but not exclusively', t => {
+ t.pass();
+});
+
+// Won't run, no title
+test(function (t) {
+ t.fail();
+});
+
+// Won't run, no explicit title
+test(function foo(t) {
+ t.fail();
+});
+```
+
+### Skipping tests
+
+Sometimes failing tests can be hard to fix. You can tell AVA to skip these tests using the `.skip` modifier. They'll still be shown in the output (as having been skipped) but are never run.
+
+```js
+test.skip('will not be run', t => {
+ t.fail();
+});
+```
+
+You must specify the implementation function.
+
+### Test placeholders ("todo")
+
+You can use the `.todo` modifier when you're planning to write a test. Like skipped tests these placeholders are shown in the output. They only require a title; you cannot specify the implementation function.
+
+```js
+test.todo('will think about writing this later');
+```
+
+### Failing tests
+
+You can use the `.failing` modifier to document issues with your code that need to be fixed. Failing tests are run just like normal ones, but they are expected to fail, and will not break your build when they do. If a test marked as failing actually passes, it will be reported as an error and fail the build with a helpful message instructing you to remove the `.failing` modifier.
+
+This allows you to merge `.failing` tests before a fix is implemented without breaking CI. This is a great way to recognize good bug report PR's with a commit credit, even if the reporter is unable to actually fix the problem.
+
+```js
+// See: github.com/user/repo/issues/1234
+test.failing('demonstrate some bug', t => {
+ t.fail(); // Test will count as passed
+});
+```
+
+### Before & after hooks
+
+AVA lets you register hooks that are run before and after your tests. This allows you to run setup and/or teardown code.
+
+`test.before()` registers a hook to be run before the first test in your test file. Similarly `test.after()` registers a hook to be run after the last test. Use `test.after.always()` to register a hook that will **always** run once your tests and other hooks complete. `.always()` hooks run regardless of whether there were earlier failures, so they are ideal for cleanup tasks. There are two exceptions to this however. If you use `--fail-fast` AVA will stop testing as soon as a failure occurs, and it won't run any hooks including the `.always()` hooks. Uncaught exceptions will crash your tests, possibly preventing `.always()` hooks from running.
+
+`test.beforeEach()` registers a hook to be run before each test in your test file. Similarly `test.afterEach()` a hook to be run after each test. Use `test.afterEach.always()` to register an after hook that is called even if other test hooks, or the test itself, fail. `.always()` hooks are ideal for cleanup tasks.
+
+**Note**: If the `--fail-fast` flag is specified, AVA will stop after the first test failure and the `.always` hook will **not** run.
+
+Like `test()` these methods take an optional title and a callback function. The title is shown if your hook fails to execute. The callback is called with an [execution object](#t).
+
+`before` hooks execute before `beforeEach` hooks. `afterEach` hooks execute before `after` hooks. Within their category the hooks execute in the order they were defined.
+
+```js
+test.before(t => {
+ // This runs before all tests
+});
+
+test.before(t => {
+ // This runs after the above, but before tests
+});
+
+test.after('cleanup', t => {
+ // This runs after all tests
+});
+
+test.after.always('guaranteed cleanup', t => {
+ // This will always run, regardless of earlier failures
+});
+
+test.beforeEach(t => {
+ // This runs before each test
+});
+
+test.afterEach(t => {
+ // This runs after each test
+});
+
+test.afterEach.always(t => {
+ // This runs after each test and other test hooks, even if they failed
+});
+
+test(t => {
+ // Regular test
+});
+```
+
+Hooks can be synchronous or asynchronous, just like tests. To make a hook asynchronous return a promise or observable, use an async function, or enable callback mode via `test.cb.before()`, `test.cb.beforeEach()` etc.
+
+```js
+test.before(async t => {
+ await promiseFn();
+});
+
+test.after(t => {
+ return new Promise(/* ... */);
+});
+
+test.cb.beforeEach(t => {
+ setTimeout(t.end);
+});
+
+test.afterEach.cb(t => {
+ setTimeout(t.end);
+});
+```
+
+Keep in mind that the `beforeEach` and `afterEach` hooks run just before and after a test is run, and that by default tests run concurrently. If you need to set up global state for each test (like spying on `console.log` [for example](https://github.com/avajs/ava/issues/560)), you'll need to make sure the tests are [run serially](#running-tests-serially).
+
+Remember that AVA runs each test file in its own process. You may not have to clean up global state in a `after`-hook since that's only called right before the process exits.
+
+#### Test context
+
+The `beforeEach` & `afterEach` hooks can share context with the test:
+
+```js
+test.beforeEach(t => {
+ t.context.data = generateUniqueData();
+});
+
+test(t => {
+ t.is(t.context.data + 'bar', 'foobar');
+});
+```
+
+The context is not shared between tests, allowing you to set up data in a way where it will not risk leaking to other, subsequent tests. By default `t.context` is an object but you can reassign it:
+
+```js
+test.beforeEach(t => {
+ t.context = 'unicorn';
+});
+
+test(t => {
+ t.is(t.context, 'unicorn');
+});
+```
+
+Context sharing is *not* available to `before` and `after` hooks.
+
+### Chaining test modifiers
+
+You can use the `.serial`, `.only` and `.skip` modifiers in any order, with `test`, `before`, `after`, `beforeEach` and `afterEach`. For example:
+
+```js
+test.before.skip(...);
+test.skip.after(...);
+test.serial.only(...);
+test.only.serial(...);
+```
+
+This means you can temporarily add `.skip` or `.only` at the end of a test or hook definition without having to make any other changes.
+
+### Test macros
+
+Additional arguments passed to the test declaration will be passed to the test implementation. This is useful for creating reusable test macros.
+
+```js
+function macro(t, input, expected) {
+ t.is(eval(input), expected);
+}
+
+test('2 + 2 === 4', macro, '2 + 2', 4);
+test('2 * 3 === 6', macro, '2 * 3', 6);
+```
+
+You can build the test title programmatically by attaching a `title` function to the macro:
+
+```js
+function macro(t, input, expected) {
+ t.is(eval(input), expected);
+}
+
+macro.title = (providedTitle, input, expected) => `${providedTitle} ${input} === ${expected}`.trim();
+
+test(macro, '2 + 2', 4);
+test(macro, '2 * 3', 6);
+test('providedTitle', macro, '3 * 3', 9);
+```
+
+The `providedTitle` argument defaults to an empty string if the user does not supply a string title. This allows for easy concatenation without having to worry about `null` / `undefined`. It is worth remembering that the empty string is considered a falsy value, so you can still use `if(providedTitle) {...}`.
+
+You can also pass arrays of macro functions:
+
+```js
+const safeEval = require('safe-eval');
+
+function evalMacro(t, input, expected) {
+ t.is(eval(input), expected);
+}
+
+function safeEvalMacro(t, input, expected) {
+ t.is(safeEval(input), expected);
+}
+
+test([evalMacro, safeEvalMacro], '2 + 2', 4);
+test([evalMacro, safeEvalMacro], '2 * 3', 6);
+```
+
+We encourage you to use macros instead of building your own test generators ([here is an example](https://github.com/avajs/ava-codemods/blob/47073b5b58aa6f3fb24f98757be5d3f56218d160/test/ok-to-truthy.js#L7-L9) of code that should be replaced with a macro). Macros are designed to perform static analysis of your code, which can lead to better performance, IDE integration, and linter rules.
+
+### Custom assertions
+
+You can use any assertion library instead of or in addition to the built-in one, provided it throws exceptions when the assertion fails.
+
+This won't give you as nice an experience as you'd get with the [built-in assertions](#assertions) though, and you won't be able to use the [assertion planning](#assertion-planning) ([see #25](https://github.com/avajs/ava/issues/25)).
+
+You'll have to configure AVA to not fail tests if no assertions are executed, because AVA can't tell if custom assertions pass. Set the `failWithoutAssertions` option to `false` in AVA's [`package.json` configuration](#configuration).
+
+```js
+import assert from 'assert';
+
+test(t => {
+ assert(true);
+});
+```
+
+### ES2017 support
+
+AVA comes with built-in support for ES2017 through [Babel 6](https://babeljs.io). Just write your tests in ES2017. No extra setup needed. You can use any Babel version in your project. We use our own bundled Babel with our [`@ava/stage-4`](https://github.com/avajs/babel-preset-stage-4) preset, as well as [custom transforms](https://github.com/avajs/babel-preset-transform-test-files) for test and helper files.
+
+The corresponding Babel config for AVA's setup is as follows:
+
+```json
+{
+ "presets": [
+ "@ava/stage-4",
+ "@ava/transform-test-files"
+ ]
+}
+```
+
+You can customize how AVA transpiles the test files through the `babel` option in AVA's [`package.json` configuration](#configuration). For example to override the presets you can use:
+
+```json
+{
+ "ava": {
+ "babel": {
+ "presets": [
+ "es2015",
+ "stage-0",
+ "react"
+ ]
+ }
+ }
+}
+```
+
+You can also use the special `"inherit"` keyword. This makes AVA defer to the Babel config in your [`.babelrc` or `package.json` file](https://babeljs.io/docs/usage/babelrc/). This way your test files will be transpiled using the same config as your source files without having to repeat it just for AVA:
+
+```json
+{
+ "babel": {
+ "presets": [
+ "es2015",
+ "stage-0",
+ "react"
+ ]
+ },
+ "ava": {
+ "babel": "inherit"
+ }
+}
+```
+
+See AVA's [`.babelrc` recipe](docs/recipes/babelrc.md) for further examples and a more detailed explanation of configuration options.
+
+Note that AVA will *always* apply [a few internal plugins](docs/recipes/babelrc.md#notes) regardless of configuration, but they should not impact the behavior of your code.
+
+### TypeScript support
+
+AVA includes typings for TypeScript. You have to set up transpilation yourself. When you set `module` to `commonjs` in your `tsconfig.json` file, TypeScript will automatically find the type definitions for AVA. You should set `target` to `es2015` to use promises and async functions.
+
+See AVA's [TypeScript recipe](docs/recipes/typescript.md) for a more detailed explanation.
+
+### Transpiling imported modules
+
+AVA currently only transpiles the tests you ask it to run, as well as test helpers (files starting with `_` or in `helpers` directory) inside the test directory. *It will not transpile modules you `import` from outside of the test.* This may be unexpected but there are workarounds.
+
+If you use Babel you can use its [require hook](https://babeljs.io/docs/usage/require/) to transpile imported modules on-the-fly. To add it, [configure it in your `package.json`](#configuration).
+
+You can also transpile your modules in a separate process and refer to the transpiled files rather than the sources from your tests. Example [here](docs/recipes/precompiling-with-webpack.md).
+
+### Promise support
+
+If you return a promise in the test you don't need to explicitly end the test as it will end when the promise resolves.
+
+```js
+test(t => {
+ return somePromise().then(result => {
+ t.is(result, 'unicorn');
+ });
+});
+```
+
+### Generator function support
+
+AVA comes with built-in support for [generator functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*).
+
+```js
+test(function * (t) {
+ const value = yield generatorFn();
+ t.true(value);
+});
+```
+
+### Async function support
+
+AVA comes with built-in support for [async functions](https://tc39.github.io/ecmascript-asyncawait/) *(async/await)*.
+
+```js
+test(async function (t) {
+ const value = await promiseFn();
+ t.true(value);
+});
+
+// Async arrow function
+test(async t => {
+ const value = await promiseFn();
+ t.true(value);
+});
+```
+
+### Observable support
+
+AVA comes with built-in support for [observables](https://github.com/zenparsing/es-observable). If you return an observable from a test, AVA will automatically consume it to completion before ending the test.
+
+*You do not need to use "callback mode" or call `t.end()`.*
+
+```js
+test(t => {
+ t.plan(3);
+ return Observable.of(1, 2, 3, 4, 5, 6)
+ .filter(n => {
+ // Only even numbers
+ return n % 2 === 0;
+ })
+ .map(() => t.pass());
+});
+```
+
+### Callback support
+
+AVA supports using `t.end` as the final callback when using node-style error-first callback APIs. AVA will consider any truthy value passed as the first argument to `t.end` to be an error. Note that `t.end` requires "callback mode", which can be enabled by using the `test.cb` chain.
+
+```js
+test.cb(t => {
+ // `t.end` automatically checks for error as first argument
+ fs.readFile('data.txt', t.end);
+});
+```
+
+### Global timeout
+
+A global timeout can be set via the `--timeout` option.
+Timeout in AVA behaves differently than in other test frameworks.
+AVA resets a timer after each test, forcing tests to quit if no new test results were received within the specified timeout.
+
+You can set timeouts in a human-readable way:
+
+```console
+$ ava --timeout=10s # 10 seconds
+$ ava --timeout=2m # 2 minutes
+$ ava --timeout=100 # 100 milliseconds
+```
+
+## API
+
+### `test([title], implementation)`
+### `test.serial([title], implementation)`
+### `test.cb([title], implementation)`
+### `test.only([title], implementation)`
+### `test.skip([title], implementation)`
+### `test.todo(title)`
+### `test.failing([title], implementation)`
+### `test.before([title], implementation)`
+### `test.after([title], implementation)`
+### `test.beforeEach([title], implementation)`
+### `test.afterEach([title], implementation)`
+
+#### `title`
+
+Type: `string`
+
+Test title.
+
+#### `implementation(t)`
+
+Type: `function`
+
+Should contain the actual test.
+
+##### `t`
+
+Type: `object`
+
+The execution object of a particular test. Each test implementation receives a different object. Contains the [assertions](#assertions) as well as `.plan(count)` and `.end()` methods. `t.context` can contain shared state from `beforeEach` hooks.
+
+###### `t.plan(count)`
+
+Plan how many assertion there are in the test. The test will fail if the actual assertion count doesn't match the number of planned assertions. See [assertion planning](#assertion-planning).
+
+###### `t.end()`
+
+End the test. Only works with `test.cb()`.
+
+## Assertions
+
+Assertions are mixed into the [execution object](#t) provided to each test implementation:
+
+```js
+test(t => {
+ t.truthy('unicorn'); // Assertion
+});
+```
+
+If multiple assertion failures are encountered within a single test, AVA will only display the *first* one.
+
+### `.pass([message])`
+
+Passing assertion.
+
+### `.fail([message])`
+
+Failing assertion.
+
+### `.truthy(value, [message])`
+
+Assert that `value` is truthy.
+
+### `.falsy(value, [message])`
+
+Assert that `value` is falsy.
+
+### `.true(value, [message])`
+
+Assert that `value` is `true`.
+
+### `.false(value, [message])`
+
+Assert that `value` is `false`.
+
+### `.is(value, expected, [message])`
+
+Assert that `value` is equal to `expected`.
+
+### `.not(value, expected, [message])`
+
+Assert that `value` is not equal to `expected`.
+
+### `.deepEqual(value, expected, [message])`
+
+Assert that `value` is deep equal to `expected`. This is based on [Lodash' `isEqual()`](https://lodash.com/docs/4.17.4#isEqual):
+
+> Performs a deep comparison between two values to determine if they are equivalent.
+>
+> *Note*: This method supports comparing arrays, array buffers, booleans, date objects, error objects, maps, numbers, `Object` objects, regexes, sets, strings, symbols, and typed arrays. `Object` objects are compared by their own, not inherited, enumerable properties. Functions and DOM nodes are compared by strict equality, i.e. `===`.
+
+### `.notDeepEqual(value, expected, [message])`
+
+Assert that `value` is not deep equal to `expected`. The inverse of `.deepEqual()`.
+
+### `.throws(function|promise, [error, [message]])`
+
+Assert that `function` throws an error, or `promise` rejects with an error.
+
+`error` can be an error constructor, error message, regex matched against the error message, or validation function.
+
+Returns the error thrown by `function` or a promise for the rejection reason of the specified `promise`.
+
+Example:
+
+```js
+const fn = () => {
+ throw new TypeError('🦄');
+};
+
+test('throws', t => {
+ const error = t.throws(() => {
+ fn();
+ }, TypeError);
+
+ t.is(error.message, '🦄');
+});
+```
+
+```js
+const promise = Promise.reject(new TypeError('🦄'));
+
+test('rejects', async t => {
+ const error = await t.throws(promise);
+ t.is(error.message, '🦄');
+});
+```
+
+When testing a promise you must wait for the assertion to complete:
+
+```js
+test('rejects', async t => {
+ await t.throws(promise);
+});
+```
+
+### `.notThrows(function|promise, [message])`
+
+Assert that `function` does not throw an error or that `promise` does not reject with an error.
+
+Like the `.throws()` assertion, when testing a promise you must wait for the assertion to complete:
+
+```js
+test('rejects', async t => {
+ await t.notThrows(promise);
+});
+```
+
+### `.regex(contents, regex, [message])`
+
+Assert that `contents` matches `regex`.
+
+### `.notRegex(contents, regex, [message])`
+
+Assert that `contents` does not match `regex`.
+
+### `.ifError(error, [message])`
+
+Assert that `error` is falsy.
+
+### `.snapshot(contents, [message])`
+
+Make a snapshot of the stringified `contents`.
+
+## Snapshot testing
+
+Snapshot testing comes as another kind of assertion and uses [jest-snapshot](https://facebook.github.io/jest/blog/2016/07/27/jest-14.html) under the hood.
+
+When used with React, it looks very similar to Jest:
+
+```js
+// Your component
+const HelloWorld = () => <h1>Hello World...!</h1>;
+
+export default HelloWorld;
+```
+
+```js
+// Your test
+import test from 'ava';
+import render from 'react-test-renderer';
+
+import HelloWorld from '.';
+
+test('HelloWorld component', t => {
+ const tree = render.create(<HelloWorld />).toJSON();
+ t.snapshot(tree);
+});
+```
+
+The first time you run this test, a snapshot file will be created in `__snapshots__` folder looking something like this:
+
+```js
+exports[`HelloWorld component 1`] = `
+<h1>
+ Hello World...!
+</h1>
+`;
+```
+
+These snapshots should be committed together with your code so that everyone on the team shares current state of the app.
+
+Every time you run this test afterwards, it will check if the component render has changed. If it did, it will fail the test.
+
+<img src="media/snapshot-testing.png" width="814">
+
+Then you will have the choice to check your code - and if the change was intentional, you can use the `--update-snapshots` (or `-u`) flag to update the snapshots into their new version.
+
+That might look like this:
+
+```console
+$ ava --update-snapshots
+```
+
+Note that snapshots can be used for much more than just testing components - you can equally well test any other (data) structure that you can stringify.
+
+### Skipping assertions
+
+Any assertion can be skipped using the `skip` modifier. Skipped assertions are still counted, so there is no need to change your planned assertion count.
+
+```js
+test(t => {
+ t.plan(2);
+ t.skip.is(foo(), 5); // No need to change your plan count when skipping
+ t.is(1, 1);
+});
+```
+
+### Enhanced assertion messages
+
+AVA comes with [`power-assert`](https://github.com/power-assert-js/power-assert) built-in, giving you more descriptive assertion messages. It reads your test and tries to infer more information from the code.
+
+Let's take this example, using Node's standard [`assert` library](https://nodejs.org/api/assert.html):
+
+```js
+const a = /foo/;
+const b = 'bar';
+const c = 'baz';
+require('assert').ok(a.test(b) || b === c);
+```
+
+If you paste that into a Node REPL it'll return:
+
+```
+AssertionError: false == true
+```
+
+In AVA however, this test:
+
+```js
+test(t => {
+ const a = /foo/;
+ const b = 'bar';
+ const c = 'baz';
+ t.true(a.test(b) || b === c);
+});
+```
+
+Will output:
+
+```
+t.true(a.test(b) || b === c)
+ | | | |
+ | "bar" "bar" "baz"
+ false
+```
+
+## Process isolation
+
+Each test file is run in a separate Node.js process. This allows you to change the global state or overriding a built-in in one test file, without affecting another. It's also great for performance on modern multi-core processors, allowing multiple test files to execute in parallel.
+
+## Tips
+
+### Temp files
+
+Running tests concurrently comes with some challenges, doing file IO is one.
+
+Usually, serial tests create temp directories in the current test directory and clean them up at the end. This won't work when you run tests concurrently as tests will conflict with each other. The correct way to do it is to use a new temp directory for each test. The [`tempfile`](https://github.com/sindresorhus/tempfile) and [`temp-write`](https://github.com/sindresorhus/temp-write) modules can be helpful.
+
+### Code coverage
+
+You can't use [`istanbul`](https://github.com/gotwarlost/istanbul) for code coverage as AVA [spawns the test files](#process-isolation). You can use [`nyc`](https://github.com/bcoe/nyc) instead, which is basically `istanbul` with support for subprocesses.
+
+As of version `5.0.0` it uses source maps to report coverage for your actual code, regardless of transpilation. Make sure that the code you're testing includes an inline source map or references a source map file. If you use `babel-register` you can set the `sourceMaps` option in your Babel config to `inline`.
+
+### Common pitfalls
+
+We have a growing list of [common pitfalls](docs/common-pitfalls.md) you may experience while using AVA. If you encounter any issues you think are common, comment in [this issue](https://github.com/avajs/ava/issues/404).
+
+## FAQ
+
+### Why not `mocha`, `tape`, `tap`?
+
+Mocha requires you to use implicit globals like `describe` and `it` with the default interface (which most people use). It's not very opinionated and executes tests serially without process isolation, making it slow.
+
+Tape and tap are pretty good. AVA is highly inspired by their syntax. They too execute tests serially. Their default [TAP](https://testanything.org) output isn't very user-friendly though so you always end up using an external tap reporter.
+
+In contrast AVA is highly opinionated and runs tests concurrently, with a separate process for each test file. Its default reporter is easy on the eyes and yet AVA still supports TAP output through a CLI flag.
+
+### How is the name written and pronounced?
+
+AVA, not Ava or ava. Pronounced [`/ˈeɪvə/` ay-və](media/pronunciation.m4a?raw=true).
+
+### What is the header background?
+
+It's the [Andromeda galaxy](https://simple.wikipedia.org/wiki/Andromeda_galaxy).
+
+### What is the difference between concurrency and parallelism?
+
+[Concurrency is not parallelism. It enables parallelism.](https://stackoverflow.com/q/1050222)
+
+## Recipes
+
+- [Code coverage](docs/recipes/code-coverage.md)
+- [Watch mode](docs/recipes/watch-mode.md)
+- [Endpoint testing](docs/recipes/endpoint-testing.md)
+- [When to use `t.plan()`](docs/recipes/when-to-use-plan.md)
+- [Browser testing](docs/recipes/browser-testing.md)
+- [TypeScript](docs/recipes/typescript.md)
+- [Configuring Babel](docs/recipes/babelrc.md)
+- [Testing React components](docs/recipes/react.md)
+- [JSPM and SystemJS](docs/recipes/jspm-systemjs.md)
+- [Debugging tests with Chrome DevTools](docs/recipes/debugging-with-chrome-devtools.md)
+- [Debugging tests with WebStorm](docs/recipes/debugging-with-webstorm.md)
+- [Precompiling source files with webpack](docs/recipes/precompiling-with-webpack.md)
+
+## Support
+
+- [Stack Overflow](https://stackoverflow.com/questions/tagged/ava)
+- [Gitter chat](https://gitter.im/avajs/ava)
+- [Twitter](https://twitter.com/ava__js)
+
+## Related
+
+- [eslint-plugin-ava](https://github.com/avajs/eslint-plugin-ava) - Lint rules for AVA tests
+- [sublime-ava](https://github.com/avajs/sublime-ava) - Snippets for AVA tests
+- [atom-ava](https://github.com/avajs/atom-ava) - Snippets for AVA tests
+- [vscode-ava](https://github.com/samverschueren/vscode-ava) - Snippets for AVA tests
+- [gulp-ava](https://github.com/avajs/gulp-ava) - Run tests with gulp
+- [grunt-ava](https://github.com/avajs/grunt-ava) - Run tests with grunt
+- [More…](https://github.com/avajs/awesome-ava#packages)
+
+## Links
+
+- [Buy AVA stickers](https://www.stickermule.com/user/1070705604/stickers)
+- [Awesome list](https://github.com/avajs/awesome-ava)
+- [AVA Casts](http://avacasts.com)
+- [More…](https://github.com/avajs/awesome-ava)
+
+## Team
+
+[![Sindre Sorhus](https://avatars.githubusercontent.com/u/170270?s=130)](http://sindresorhus.com) | [![Vadim Demedes](https://avatars.githubusercontent.com/u/697676?s=130)](https://github.com/vadimdemedes) | [![James Talmage](https://avatars.githubusercontent.com/u/4082216?s=130)](https://github.com/jamestalmage) | [![Mark Wubben](https://avatars.githubusercontent.com/u/33538?s=130)](https://novemberborn.net) | [![Juan Soto](https://avatars.githubusercontent.com/u/8217766?s=130)](https://juansoto.me) | [![Jeroen Engels](https://avatars.githubusercontent.com/u/3869412?s=130)](https://github.com/jfmengels)
+---|---|---|---|---|---
+[Sindre Sorhus](http://sindresorhus.com) | [Vadim Demedes](https://github.com/vadimdemedes) | [James Talmage](https://github.com/jamestalmage) | [Mark Wubben](https://novemberborn.net) | [Juan Soto](http://juansoto.me) | [Jeroen Engels](https://github.com/jfmengels)
+
+### Former
+
+- [Kevin Mårtensson](https://github.com/kevva)
+
+
+<div align="center">
+ <br>
+ <br>
+ <br>
+ <a href="https://ava.li">
+ <img src="https://cdn.rawgit.com/avajs/ava/fe1cea1ca3d2c8518c0cc39ec8be592beab90558/media/logo.svg" width="200" alt="AVA">
+ </a>
+ <br>
+ <br>
+</div>
diff --git a/node_modules/ava/types/generated.d.ts b/node_modules/ava/types/generated.d.ts
new file mode 100644
index 000000000..85003c0cf
--- /dev/null
+++ b/node_modules/ava/types/generated.d.ts
@@ -0,0 +1,1142 @@
+export type ErrorValidator
+ = (new (...args: any[]) => any)
+ | RegExp
+ | string
+ | ((error: any) => boolean);
+
+export interface Observable {
+ subscribe(observer: (value: {}) => void): void;
+}
+export type Test = (t: TestContext) => PromiseLike<void> | Iterator<any> | Observable | void;
+export type GenericTest<T> = (t: GenericTestContext<T>) => PromiseLike<void> | Iterator<any> | Observable | void;
+export type CallbackTest = (t: CallbackTestContext) => void;
+export type GenericCallbackTest<T> = (t: GenericCallbackTestContext<T>) => void;
+
+export interface Context<T> { context: T }
+export type AnyContext = Context<any>;
+
+export type ContextualTest = GenericTest<AnyContext>;
+export type ContextualCallbackTest = GenericCallbackTest<AnyContext>;
+
+export interface AssertContext {
+ /**
+ * Passing assertion.
+ */
+ pass(message?: string): void;
+ /**
+ * Failing assertion.
+ */
+ fail(message?: string): void;
+ /**
+ * Assert that value is truthy.
+ */
+ truthy(value: any, message?: string): void;
+ /**
+ * Assert that value is falsy.
+ */
+ falsy(value: any, message?: string): void;
+ /**
+ * Assert that value is true.
+ */
+ true(value: any, message?: string): void;
+ /**
+ * Assert that value is false.
+ */
+ false(value: any, message?: string): void;
+ /**
+ * Assert that value is equal to expected.
+ */
+ is<U>(value: U, expected: U, message?: string): void;
+ /**
+ * Assert that value is not equal to expected.
+ */
+ not<U>(value: U, expected: U, message?: string): void;
+ /**
+ * Assert that value is deep equal to expected.
+ */
+ deepEqual<U>(value: U, expected: U, message?: string): void;
+ /**
+ * Assert that value is not deep equal to expected.
+ */
+ notDeepEqual<U>(value: U, expected: U, message?: string): void;
+ /**
+ * Assert that function throws an error or promise rejects.
+ * @param error Can be a constructor, regex, error message or validation function.
+ */
+ throws(value: PromiseLike<any>, error?: ErrorValidator, message?: string): Promise<any>;
+ throws(value: () => void, error?: ErrorValidator, message?: string): any;
+ /**
+ * Assert that function doesn't throw an error or promise resolves.
+ */
+ notThrows(value: PromiseLike<any>, message?: string): Promise<void>;
+ notThrows(value: () => void, message?: string): void;
+ /**
+ * Assert that contents matches regex.
+ */
+ regex(contents: string, regex: RegExp, message?: string): void;
+ /**
+ * Assert that contents matches a snapshot.
+ */
+ snapshot(contents: any, message?: string): void;
+ /**
+ * Assert that contents does not match regex.
+ */
+ notRegex(contents: string, regex: RegExp, message?: string): void;
+ /**
+ * Assert that error is falsy.
+ */
+ ifError(error: any, message?: string): void;
+}
+export interface TestContext extends AssertContext {
+ /**
+ * Plan how many assertion there are in the test.
+ * The test will fail if the actual assertion count doesn't match planned assertions.
+ */
+ plan(count: number): void;
+
+ skip: AssertContext;
+}
+export interface CallbackTestContext extends TestContext {
+ /**
+ * End the test.
+ */
+ end(): void;
+}
+
+export type GenericTestContext<T> = TestContext & T;
+export type GenericCallbackTestContext<T> = CallbackTestContext & T;
+
+export interface Macro<T> {
+ (t: T, ...args: any[]): void;
+ title? (providedTitle: string, ...args: any[]): string;
+}
+export type Macros<T> = Macro<T> | Macro<T>[];
+
+interface RegisterBase<T> {
+ (name: string, run: GenericTest<T>): void;
+ (run: GenericTest<T>): void;
+ (name: string, run: Macros<GenericTestContext<T>>, ...args: any[]): void;
+ (run: Macros<GenericTestContext<T>>, ...args: any[]): void;
+}
+
+interface CallbackRegisterBase<T> {
+ (name: string, run: GenericCallbackTest<T>): void;
+ (run: GenericCallbackTest<T>): void;
+ (name: string, run: Macros<GenericCallbackTestContext<T>>, ...args: any[]): void;
+ (run: Macros<GenericCallbackTestContext<T>>, ...args: any[]): void;
+}
+
+export default test;
+export const test: RegisterContextual<any>;
+export interface RegisterContextual<T> extends Register<Context<T>> {
+}
+export interface Register<T> extends RegisterBase<T> {
+ serial: RegisterBase<T> & Register_serial<T>;
+ before: RegisterBase<T> & Register_before<T>;
+ after: RegisterBase<T> & Register_after<T>;
+ skip: RegisterBase<T> & Register_skip<T>;
+ todo: (name: string) => void;
+ failing: RegisterBase<T> & Register_failing<T>;
+ only: RegisterBase<T> & Register_only<T>;
+ beforeEach: RegisterBase<T> & Register_beforeEach<T>;
+ afterEach: RegisterBase<T> & Register_afterEach<T>;
+ cb: CallbackRegisterBase<T> & Register_cb<T>;
+}
+interface Register_serial<T> {
+ before: Register_before_serial<T>;
+ after: Register_after_serial<T>;
+ skip: RegisterBase<T> & Register_serial_skip<T>;
+ todo: (name: string) => void;
+ failing: Register_failing_serial<T>;
+ only: Register_only_serial<T>;
+ beforeEach: Register_beforeEach_serial<T>;
+ afterEach: Register_afterEach_serial<T>;
+ cb: Register_cb_serial<T>;
+ always: Register_always_serial<T>;
+}
+interface Register_serial_skip<T> {
+ before: Register_before_serial_skip<T>;
+ after: Register_after_serial_skip<T>;
+ failing: Register_failing_serial_skip<T>;
+ beforeEach: Register_beforeEach_serial_skip<T>;
+ afterEach: Register_afterEach_serial_skip<T>;
+ cb: Register_cb_serial_skip<T>;
+ always: Register_always_serial_skip<T>;
+}
+interface Register_serial_todo<T> {
+ before: Register_before_serial_todo<T>;
+ after: Register_after_serial_todo<T>;
+ failing: Register_failing_serial_todo<T>;
+ beforeEach: Register_beforeEach_serial_todo<T>;
+ afterEach: Register_afterEach_serial_todo<T>;
+ cb: Register_cb_serial_todo<T>;
+ always: Register_always_serial_todo<T>;
+}
+interface Register_before<T> {
+ serial: RegisterBase<T> & Register_before_serial<T>;
+ skip: RegisterBase<T> & Register_before_skip<T>;
+ todo: (name: string) => void;
+ failing: RegisterBase<T> & Register_before_failing<T>;
+ cb: CallbackRegisterBase<T> & Register_before_cb<T>;
+}
+interface Register_before_serial<T> {
+ skip: RegisterBase<T> & Register_before_serial_skip<T>;
+ todo: (name: string) => void;
+ failing: Register_before_failing_serial<T>;
+ cb: Register_before_cb_serial<T>;
+}
+interface Register_before_serial_skip<T> {
+ failing: Register_before_failing_serial_skip<T>;
+ cb: Register_before_cb_serial_skip<T>;
+}
+interface Register_before_serial_todo<T> {
+ failing: Register_before_failing_serial_todo<T>;
+ cb: Register_before_cb_serial_todo<T>;
+}
+interface Register_before_skip<T> {
+ serial: Register_before_serial_skip<T>;
+ failing: Register_before_failing_skip<T>;
+ cb: Register_before_cb_skip<T>;
+}
+interface Register_before_todo<T> {
+ serial: Register_before_serial_todo<T>;
+ failing: Register_before_failing_todo<T>;
+ cb: Register_before_cb_todo<T>;
+}
+interface Register_before_failing<T> {
+ serial: RegisterBase<T> & Register_before_failing_serial<T>;
+ skip: RegisterBase<T> & Register_before_failing_skip<T>;
+ todo: (name: string) => void;
+ cb: Register_before_cb_failing<T>;
+}
+interface Register_before_failing_serial<T> {
+ skip: RegisterBase<T> & Register_before_failing_serial_skip<T>;
+ todo: (name: string) => void;
+ cb: Register_before_cb_failing_serial<T>;
+}
+interface Register_before_failing_serial_skip<T> {
+ cb: Register_before_cb_failing_serial<T>['skip'];
+}
+interface Register_before_failing_serial_todo<T> {
+ cb: Register_before_cb_failing_serial<T>['todo'];
+}
+interface Register_before_failing_skip<T> {
+ serial: Register_before_failing_serial_skip<T>;
+ cb: Register_before_cb_failing_skip<T>;
+}
+interface Register_before_failing_todo<T> {
+ serial: Register_before_failing_serial_todo<T>;
+ cb: Register_before_cb_failing_todo<T>;
+}
+interface Register_before_cb<T> {
+ serial: CallbackRegisterBase<T> & Register_before_cb_serial<T>;
+ skip: CallbackRegisterBase<T> & Register_before_cb_skip<T>;
+ todo: (name: string) => void;
+ failing: CallbackRegisterBase<T> & Register_before_cb_failing<T>;
+}
+interface Register_before_cb_serial<T> {
+ skip: CallbackRegisterBase<T> & Register_before_cb_serial_skip<T>;
+ todo: (name: string) => void;
+ failing: Register_before_cb_failing_serial<T>;
+}
+interface Register_before_cb_serial_skip<T> {
+ failing: Register_before_cb_failing_serial<T>['skip'];
+}
+interface Register_before_cb_serial_todo<T> {
+ failing: Register_before_cb_failing_serial<T>['todo'];
+}
+interface Register_before_cb_skip<T> {
+ serial: Register_before_cb_serial_skip<T>;
+ failing: Register_before_cb_failing_skip<T>;
+}
+interface Register_before_cb_todo<T> {
+ serial: Register_before_cb_serial_todo<T>;
+ failing: Register_before_cb_failing_todo<T>;
+}
+interface Register_before_cb_failing<T> {
+ serial: CallbackRegisterBase<T> & Register_before_cb_failing_serial<T>;
+ skip: CallbackRegisterBase<T> & Register_before_cb_failing_skip<T>;
+ todo: (name: string) => void;
+}
+interface Register_before_cb_failing_serial<T> {
+ skip: CallbackRegisterBase<T>;
+ todo: (name: string) => void;
+}
+interface Register_before_cb_failing_skip<T> {
+ serial: Register_before_cb_failing_serial<T>['skip'];
+}
+interface Register_before_cb_failing_todo<T> {
+ serial: Register_before_cb_failing_serial<T>['todo'];
+}
+interface Register_after<T> {
+ serial: RegisterBase<T> & Register_after_serial<T>;
+ skip: RegisterBase<T> & Register_after_skip<T>;
+ todo: (name: string) => void;
+ failing: RegisterBase<T> & Register_after_failing<T>;
+ cb: CallbackRegisterBase<T> & Register_after_cb<T>;
+ always: RegisterBase<T> & Register_after_always<T>;
+}
+interface Register_after_serial<T> {
+ skip: RegisterBase<T> & Register_after_serial_skip<T>;
+ todo: (name: string) => void;
+ failing: Register_after_failing_serial<T>;
+ cb: Register_after_cb_serial<T>;
+ always: Register_after_always_serial<T>;
+}
+interface Register_after_serial_skip<T> {
+ failing: Register_after_failing_serial_skip<T>;
+ cb: Register_after_cb_serial_skip<T>;
+ always: Register_after_always_serial_skip<T>;
+}
+interface Register_after_serial_todo<T> {
+ failing: Register_after_failing_serial_todo<T>;
+ cb: Register_after_cb_serial_todo<T>;
+ always: Register_after_always_serial_todo<T>;
+}
+interface Register_after_skip<T> {
+ serial: Register_after_serial_skip<T>;
+ failing: Register_after_failing_skip<T>;
+ cb: Register_after_cb_skip<T>;
+ always: Register_after_always_skip<T>;
+}
+interface Register_after_todo<T> {
+ serial: Register_after_serial_todo<T>;
+ failing: Register_after_failing_todo<T>;
+ cb: Register_after_cb_todo<T>;
+ always: Register_after_always_todo<T>;
+}
+interface Register_after_failing<T> {
+ serial: RegisterBase<T> & Register_after_failing_serial<T>;
+ skip: RegisterBase<T> & Register_after_failing_skip<T>;
+ todo: (name: string) => void;
+ cb: Register_after_cb_failing<T>;
+ always: Register_after_always_failing<T>;
+}
+interface Register_after_failing_serial<T> {
+ skip: RegisterBase<T> & Register_after_failing_serial_skip<T>;
+ todo: (name: string) => void;
+ cb: Register_after_cb_failing_serial<T>;
+ always: Register_after_always_failing_serial<T>;
+}
+interface Register_after_failing_serial_skip<T> {
+ cb: Register_after_cb_failing_serial_skip<T>;
+ always: Register_after_always_failing_serial_skip<T>;
+}
+interface Register_after_failing_serial_todo<T> {
+ cb: Register_after_cb_failing_serial_todo<T>;
+ always: Register_after_always_failing_serial_todo<T>;
+}
+interface Register_after_failing_skip<T> {
+ serial: Register_after_failing_serial_skip<T>;
+ cb: Register_after_cb_failing_skip<T>;
+ always: Register_after_always_failing_skip<T>;
+}
+interface Register_after_failing_todo<T> {
+ serial: Register_after_failing_serial_todo<T>;
+ cb: Register_after_cb_failing_todo<T>;
+ always: Register_after_always_failing_todo<T>;
+}
+interface Register_after_cb<T> {
+ serial: CallbackRegisterBase<T> & Register_after_cb_serial<T>;
+ skip: CallbackRegisterBase<T> & Register_after_cb_skip<T>;
+ todo: (name: string) => void;
+ failing: CallbackRegisterBase<T> & Register_after_cb_failing<T>;
+ always: Register_after_always_cb<T>;
+}
+interface Register_after_cb_serial<T> {
+ skip: CallbackRegisterBase<T> & Register_after_cb_serial_skip<T>;
+ todo: (name: string) => void;
+ failing: Register_after_cb_failing_serial<T>;
+ always: Register_after_always_cb_serial<T>;
+}
+interface Register_after_cb_serial_skip<T> {
+ failing: Register_after_cb_failing_serial_skip<T>;
+ always: Register_after_always_cb_serial_skip<T>;
+}
+interface Register_after_cb_serial_todo<T> {
+ failing: Register_after_cb_failing_serial_todo<T>;
+ always: Register_after_always_cb_serial_todo<T>;
+}
+interface Register_after_cb_skip<T> {
+ serial: Register_after_cb_serial_skip<T>;
+ failing: Register_after_cb_failing_skip<T>;
+ always: Register_after_always_cb_skip<T>;
+}
+interface Register_after_cb_todo<T> {
+ serial: Register_after_cb_serial_todo<T>;
+ failing: Register_after_cb_failing_todo<T>;
+ always: Register_after_always_cb_todo<T>;
+}
+interface Register_after_cb_failing<T> {
+ serial: CallbackRegisterBase<T> & Register_after_cb_failing_serial<T>;
+ skip: CallbackRegisterBase<T> & Register_after_cb_failing_skip<T>;
+ todo: (name: string) => void;
+ always: Register_after_always_cb_failing<T>;
+}
+interface Register_after_cb_failing_serial<T> {
+ skip: CallbackRegisterBase<T> & Register_after_cb_failing_serial_skip<T>;
+ todo: (name: string) => void;
+ always: Register_after_always_cb_failing_serial<T>;
+}
+interface Register_after_cb_failing_serial_skip<T> {
+ always: Register_after_always_cb_failing_serial<T>['skip'];
+}
+interface Register_after_cb_failing_serial_todo<T> {
+ always: Register_after_always_cb_failing_serial<T>['todo'];
+}
+interface Register_after_cb_failing_skip<T> {
+ serial: Register_after_cb_failing_serial_skip<T>;
+ always: Register_after_always_cb_failing_skip<T>;
+}
+interface Register_after_cb_failing_todo<T> {
+ serial: Register_after_cb_failing_serial_todo<T>;
+ always: Register_after_always_cb_failing_todo<T>;
+}
+interface Register_after_always<T> {
+ serial: RegisterBase<T> & Register_after_always_serial<T>;
+ skip: RegisterBase<T> & Register_after_always_skip<T>;
+ todo: (name: string) => void;
+ failing: RegisterBase<T> & Register_after_always_failing<T>;
+ cb: CallbackRegisterBase<T> & Register_after_always_cb<T>;
+}
+interface Register_after_always_serial<T> {
+ skip: RegisterBase<T> & Register_after_always_serial_skip<T>;
+ todo: (name: string) => void;
+ failing: Register_after_always_failing_serial<T>;
+ cb: Register_after_always_cb_serial<T>;
+}
+interface Register_after_always_serial_skip<T> {
+ failing: Register_after_always_failing_serial_skip<T>;
+ cb: Register_after_always_cb_serial_skip<T>;
+}
+interface Register_after_always_serial_todo<T> {
+ failing: Register_after_always_failing_serial_todo<T>;
+ cb: Register_after_always_cb_serial_todo<T>;
+}
+interface Register_after_always_skip<T> {
+ serial: Register_after_always_serial_skip<T>;
+ failing: Register_after_always_failing_skip<T>;
+ cb: Register_after_always_cb_skip<T>;
+}
+interface Register_after_always_todo<T> {
+ serial: Register_after_always_serial_todo<T>;
+ failing: Register_after_always_failing_todo<T>;
+ cb: Register_after_always_cb_todo<T>;
+}
+interface Register_after_always_failing<T> {
+ serial: RegisterBase<T> & Register_after_always_failing_serial<T>;
+ skip: RegisterBase<T> & Register_after_always_failing_skip<T>;
+ todo: (name: string) => void;
+ cb: Register_after_always_cb_failing<T>;
+}
+interface Register_after_always_failing_serial<T> {
+ skip: RegisterBase<T> & Register_after_always_failing_serial_skip<T>;
+ todo: (name: string) => void;
+ cb: Register_after_always_cb_failing_serial<T>;
+}
+interface Register_after_always_failing_serial_skip<T> {
+ cb: Register_after_always_cb_failing_serial<T>['skip'];
+}
+interface Register_after_always_failing_serial_todo<T> {
+ cb: Register_after_always_cb_failing_serial<T>['todo'];
+}
+interface Register_after_always_failing_skip<T> {
+ serial: Register_after_always_failing_serial_skip<T>;
+ cb: Register_after_always_cb_failing_skip<T>;
+}
+interface Register_after_always_failing_todo<T> {
+ serial: Register_after_always_failing_serial_todo<T>;
+ cb: Register_after_always_cb_failing_todo<T>;
+}
+interface Register_after_always_cb<T> {
+ serial: CallbackRegisterBase<T> & Register_after_always_cb_serial<T>;
+ skip: CallbackRegisterBase<T> & Register_after_always_cb_skip<T>;
+ todo: (name: string) => void;
+ failing: CallbackRegisterBase<T> & Register_after_always_cb_failing<T>;
+}
+interface Register_after_always_cb_serial<T> {
+ skip: CallbackRegisterBase<T> & Register_after_always_cb_serial_skip<T>;
+ todo: (name: string) => void;
+ failing: Register_after_always_cb_failing_serial<T>;
+}
+interface Register_after_always_cb_serial_skip<T> {
+ failing: Register_after_always_cb_failing_serial<T>['skip'];
+}
+interface Register_after_always_cb_serial_todo<T> {
+ failing: Register_after_always_cb_failing_serial<T>['todo'];
+}
+interface Register_after_always_cb_skip<T> {
+ serial: Register_after_always_cb_serial_skip<T>;
+ failing: Register_after_always_cb_failing_skip<T>;
+}
+interface Register_after_always_cb_todo<T> {
+ serial: Register_after_always_cb_serial_todo<T>;
+ failing: Register_after_always_cb_failing_todo<T>;
+}
+interface Register_after_always_cb_failing<T> {
+ serial: CallbackRegisterBase<T> & Register_after_always_cb_failing_serial<T>;
+ skip: CallbackRegisterBase<T> & Register_after_always_cb_failing_skip<T>;
+ todo: (name: string) => void;
+}
+interface Register_after_always_cb_failing_serial<T> {
+ skip: CallbackRegisterBase<T>;
+ todo: (name: string) => void;
+}
+interface Register_after_always_cb_failing_skip<T> {
+ serial: Register_after_always_cb_failing_serial<T>['skip'];
+}
+interface Register_after_always_cb_failing_todo<T> {
+ serial: Register_after_always_cb_failing_serial<T>['todo'];
+}
+interface Register_skip<T> {
+ serial: Register_serial_skip<T>;
+ before: Register_before_skip<T>;
+ after: Register_after_skip<T>;
+ failing: Register_failing_skip<T>;
+ beforeEach: Register_beforeEach_skip<T>;
+ afterEach: Register_afterEach_skip<T>;
+ cb: Register_cb_skip<T>;
+ always: Register_always_skip<T>;
+}
+interface Register_todo<T> {
+ serial: Register_serial_todo<T>;
+ before: Register_before_todo<T>;
+ after: Register_after_todo<T>;
+ failing: Register_failing_todo<T>;
+ beforeEach: Register_beforeEach_todo<T>;
+ afterEach: Register_afterEach_todo<T>;
+ cb: Register_cb_todo<T>;
+ always: Register_always_todo<T>;
+}
+interface Register_failing<T> {
+ serial: RegisterBase<T> & Register_failing_serial<T>;
+ before: Register_before_failing<T>;
+ after: Register_after_failing<T>;
+ skip: RegisterBase<T> & Register_failing_skip<T>;
+ todo: (name: string) => void;
+ only: RegisterBase<T> & Register_failing_only<T>;
+ beforeEach: Register_beforeEach_failing<T>;
+ afterEach: Register_afterEach_failing<T>;
+ cb: Register_cb_failing<T>;
+ always: Register_always_failing<T>;
+}
+interface Register_failing_serial<T> {
+ before: Register_before_failing_serial<T>;
+ after: Register_after_failing_serial<T>;
+ skip: RegisterBase<T> & Register_failing_serial_skip<T>;
+ todo: (name: string) => void;
+ only: Register_failing_only_serial<T>;
+ beforeEach: Register_beforeEach_failing_serial<T>;
+ afterEach: Register_afterEach_failing_serial<T>;
+ cb: Register_cb_failing_serial<T>;
+ always: Register_always_failing_serial<T>;
+}
+interface Register_failing_serial_skip<T> {
+ before: Register_before_failing_serial_skip<T>;
+ after: Register_after_failing_serial_skip<T>;
+ beforeEach: Register_beforeEach_failing_serial_skip<T>;
+ afterEach: Register_afterEach_failing_serial_skip<T>;
+ cb: Register_cb_failing_serial_skip<T>;
+ always: Register_always_failing_serial_skip<T>;
+}
+interface Register_failing_serial_todo<T> {
+ before: Register_before_failing_serial_todo<T>;
+ after: Register_after_failing_serial_todo<T>;
+ beforeEach: Register_beforeEach_failing_serial_todo<T>;
+ afterEach: Register_afterEach_failing_serial_todo<T>;
+ cb: Register_cb_failing_serial_todo<T>;
+ always: Register_always_failing_serial_todo<T>;
+}
+interface Register_failing_skip<T> {
+ serial: Register_failing_serial_skip<T>;
+ before: Register_before_failing_skip<T>;
+ after: Register_after_failing_skip<T>;
+ beforeEach: Register_beforeEach_failing_skip<T>;
+ afterEach: Register_afterEach_failing_skip<T>;
+ cb: Register_cb_failing_skip<T>;
+ always: Register_always_failing_skip<T>;
+}
+interface Register_failing_todo<T> {
+ serial: Register_failing_serial_todo<T>;
+ before: Register_before_failing_todo<T>;
+ after: Register_after_failing_todo<T>;
+ beforeEach: Register_beforeEach_failing_todo<T>;
+ afterEach: Register_afterEach_failing_todo<T>;
+ cb: Register_cb_failing_todo<T>;
+ always: Register_always_failing_todo<T>;
+}
+interface Register_failing_only<T> {
+ serial: RegisterBase<T> & Register_failing_only_serial<T>;
+ cb: Register_cb_failing_only<T>;
+}
+interface Register_failing_only_serial<T> {
+ cb: Register_cb_failing_only<T>['serial'];
+}
+interface Register_only<T> {
+ serial: RegisterBase<T> & Register_only_serial<T>;
+ failing: Register_failing_only<T>;
+ cb: Register_cb_only<T>;
+}
+interface Register_only_serial<T> {
+ failing: Register_failing_only_serial<T>;
+ cb: Register_cb_only_serial<T>;
+}
+interface Register_beforeEach<T> {
+ serial: RegisterBase<T> & Register_beforeEach_serial<T>;
+ skip: RegisterBase<T> & Register_beforeEach_skip<T>;
+ todo: (name: string) => void;
+ failing: RegisterBase<T> & Register_beforeEach_failing<T>;
+ cb: CallbackRegisterBase<T> & Register_beforeEach_cb<T>;
+}
+interface Register_beforeEach_serial<T> {
+ skip: RegisterBase<T> & Register_beforeEach_serial_skip<T>;
+ todo: (name: string) => void;
+ failing: Register_beforeEach_failing_serial<T>;
+ cb: Register_beforeEach_cb_serial<T>;
+}
+interface Register_beforeEach_serial_skip<T> {
+ failing: Register_beforeEach_failing_serial_skip<T>;
+ cb: Register_beforeEach_cb_serial_skip<T>;
+}
+interface Register_beforeEach_serial_todo<T> {
+ failing: Register_beforeEach_failing_serial_todo<T>;
+ cb: Register_beforeEach_cb_serial_todo<T>;
+}
+interface Register_beforeEach_skip<T> {
+ serial: Register_beforeEach_serial_skip<T>;
+ failing: Register_beforeEach_failing_skip<T>;
+ cb: Register_beforeEach_cb_skip<T>;
+}
+interface Register_beforeEach_todo<T> {
+ serial: Register_beforeEach_serial_todo<T>;
+ failing: Register_beforeEach_failing_todo<T>;
+ cb: Register_beforeEach_cb_todo<T>;
+}
+interface Register_beforeEach_failing<T> {
+ serial: RegisterBase<T> & Register_beforeEach_failing_serial<T>;
+ skip: RegisterBase<T> & Register_beforeEach_failing_skip<T>;
+ todo: (name: string) => void;
+ cb: Register_beforeEach_cb_failing<T>;
+}
+interface Register_beforeEach_failing_serial<T> {
+ skip: RegisterBase<T> & Register_beforeEach_failing_serial_skip<T>;
+ todo: (name: string) => void;
+ cb: Register_beforeEach_cb_failing_serial<T>;
+}
+interface Register_beforeEach_failing_serial_skip<T> {
+ cb: Register_beforeEach_cb_failing_serial<T>['skip'];
+}
+interface Register_beforeEach_failing_serial_todo<T> {
+ cb: Register_beforeEach_cb_failing_serial<T>['todo'];
+}
+interface Register_beforeEach_failing_skip<T> {
+ serial: Register_beforeEach_failing_serial_skip<T>;
+ cb: Register_beforeEach_cb_failing_skip<T>;
+}
+interface Register_beforeEach_failing_todo<T> {
+ serial: Register_beforeEach_failing_serial_todo<T>;
+ cb: Register_beforeEach_cb_failing_todo<T>;
+}
+interface Register_beforeEach_cb<T> {
+ serial: CallbackRegisterBase<T> & Register_beforeEach_cb_serial<T>;
+ skip: CallbackRegisterBase<T> & Register_beforeEach_cb_skip<T>;
+ todo: (name: string) => void;
+ failing: CallbackRegisterBase<T> & Register_beforeEach_cb_failing<T>;
+}
+interface Register_beforeEach_cb_serial<T> {
+ skip: CallbackRegisterBase<T> & Register_beforeEach_cb_serial_skip<T>;
+ todo: (name: string) => void;
+ failing: Register_beforeEach_cb_failing_serial<T>;
+}
+interface Register_beforeEach_cb_serial_skip<T> {
+ failing: Register_beforeEach_cb_failing_serial<T>['skip'];
+}
+interface Register_beforeEach_cb_serial_todo<T> {
+ failing: Register_beforeEach_cb_failing_serial<T>['todo'];
+}
+interface Register_beforeEach_cb_skip<T> {
+ serial: Register_beforeEach_cb_serial_skip<T>;
+ failing: Register_beforeEach_cb_failing_skip<T>;
+}
+interface Register_beforeEach_cb_todo<T> {
+ serial: Register_beforeEach_cb_serial_todo<T>;
+ failing: Register_beforeEach_cb_failing_todo<T>;
+}
+interface Register_beforeEach_cb_failing<T> {
+ serial: CallbackRegisterBase<T> & Register_beforeEach_cb_failing_serial<T>;
+ skip: CallbackRegisterBase<T> & Register_beforeEach_cb_failing_skip<T>;
+ todo: (name: string) => void;
+}
+interface Register_beforeEach_cb_failing_serial<T> {
+ skip: CallbackRegisterBase<T>;
+ todo: (name: string) => void;
+}
+interface Register_beforeEach_cb_failing_skip<T> {
+ serial: Register_beforeEach_cb_failing_serial<T>['skip'];
+}
+interface Register_beforeEach_cb_failing_todo<T> {
+ serial: Register_beforeEach_cb_failing_serial<T>['todo'];
+}
+interface Register_afterEach<T> {
+ serial: RegisterBase<T> & Register_afterEach_serial<T>;
+ skip: RegisterBase<T> & Register_afterEach_skip<T>;
+ todo: (name: string) => void;
+ failing: RegisterBase<T> & Register_afterEach_failing<T>;
+ cb: CallbackRegisterBase<T> & Register_afterEach_cb<T>;
+ always: RegisterBase<T> & Register_afterEach_always<T>;
+}
+interface Register_afterEach_serial<T> {
+ skip: RegisterBase<T> & Register_afterEach_serial_skip<T>;
+ todo: (name: string) => void;
+ failing: Register_afterEach_failing_serial<T>;
+ cb: Register_afterEach_cb_serial<T>;
+ always: Register_afterEach_always_serial<T>;
+}
+interface Register_afterEach_serial_skip<T> {
+ failing: Register_afterEach_failing_serial_skip<T>;
+ cb: Register_afterEach_cb_serial_skip<T>;
+ always: Register_afterEach_always_serial_skip<T>;
+}
+interface Register_afterEach_serial_todo<T> {
+ failing: Register_afterEach_failing_serial_todo<T>;
+ cb: Register_afterEach_cb_serial_todo<T>;
+ always: Register_afterEach_always_serial_todo<T>;
+}
+interface Register_afterEach_skip<T> {
+ serial: Register_afterEach_serial_skip<T>;
+ failing: Register_afterEach_failing_skip<T>;
+ cb: Register_afterEach_cb_skip<T>;
+ always: Register_afterEach_always_skip<T>;
+}
+interface Register_afterEach_todo<T> {
+ serial: Register_afterEach_serial_todo<T>;
+ failing: Register_afterEach_failing_todo<T>;
+ cb: Register_afterEach_cb_todo<T>;
+ always: Register_afterEach_always_todo<T>;
+}
+interface Register_afterEach_failing<T> {
+ serial: RegisterBase<T> & Register_afterEach_failing_serial<T>;
+ skip: RegisterBase<T> & Register_afterEach_failing_skip<T>;
+ todo: (name: string) => void;
+ cb: Register_afterEach_cb_failing<T>;
+ always: Register_afterEach_always_failing<T>;
+}
+interface Register_afterEach_failing_serial<T> {
+ skip: RegisterBase<T> & Register_afterEach_failing_serial_skip<T>;
+ todo: (name: string) => void;
+ cb: Register_afterEach_cb_failing_serial<T>;
+ always: Register_afterEach_always_failing_serial<T>;
+}
+interface Register_afterEach_failing_serial_skip<T> {
+ cb: Register_afterEach_cb_failing_serial_skip<T>;
+ always: Register_afterEach_always_failing_serial_skip<T>;
+}
+interface Register_afterEach_failing_serial_todo<T> {
+ cb: Register_afterEach_cb_failing_serial_todo<T>;
+ always: Register_afterEach_always_failing_serial_todo<T>;
+}
+interface Register_afterEach_failing_skip<T> {
+ serial: Register_afterEach_failing_serial_skip<T>;
+ cb: Register_afterEach_cb_failing_skip<T>;
+ always: Register_afterEach_always_failing_skip<T>;
+}
+interface Register_afterEach_failing_todo<T> {
+ serial: Register_afterEach_failing_serial_todo<T>;
+ cb: Register_afterEach_cb_failing_todo<T>;
+ always: Register_afterEach_always_failing_todo<T>;
+}
+interface Register_afterEach_cb<T> {
+ serial: CallbackRegisterBase<T> & Register_afterEach_cb_serial<T>;
+ skip: CallbackRegisterBase<T> & Register_afterEach_cb_skip<T>;
+ todo: (name: string) => void;
+ failing: CallbackRegisterBase<T> & Register_afterEach_cb_failing<T>;
+ always: Register_afterEach_always_cb<T>;
+}
+interface Register_afterEach_cb_serial<T> {
+ skip: CallbackRegisterBase<T> & Register_afterEach_cb_serial_skip<T>;
+ todo: (name: string) => void;
+ failing: Register_afterEach_cb_failing_serial<T>;
+ always: Register_afterEach_always_cb_serial<T>;
+}
+interface Register_afterEach_cb_serial_skip<T> {
+ failing: Register_afterEach_cb_failing_serial_skip<T>;
+ always: Register_afterEach_always_cb_serial_skip<T>;
+}
+interface Register_afterEach_cb_serial_todo<T> {
+ failing: Register_afterEach_cb_failing_serial_todo<T>;
+ always: Register_afterEach_always_cb_serial_todo<T>;
+}
+interface Register_afterEach_cb_skip<T> {
+ serial: Register_afterEach_cb_serial_skip<T>;
+ failing: Register_afterEach_cb_failing_skip<T>;
+ always: Register_afterEach_always_cb_skip<T>;
+}
+interface Register_afterEach_cb_todo<T> {
+ serial: Register_afterEach_cb_serial_todo<T>;
+ failing: Register_afterEach_cb_failing_todo<T>;
+ always: Register_afterEach_always_cb_todo<T>;
+}
+interface Register_afterEach_cb_failing<T> {
+ serial: CallbackRegisterBase<T> & Register_afterEach_cb_failing_serial<T>;
+ skip: CallbackRegisterBase<T> & Register_afterEach_cb_failing_skip<T>;
+ todo: (name: string) => void;
+ always: Register_afterEach_always_cb_failing<T>;
+}
+interface Register_afterEach_cb_failing_serial<T> {
+ skip: CallbackRegisterBase<T> & Register_afterEach_cb_failing_serial_skip<T>;
+ todo: (name: string) => void;
+ always: Register_afterEach_always_cb_failing_serial<T>;
+}
+interface Register_afterEach_cb_failing_serial_skip<T> {
+ always: Register_afterEach_always_cb_failing_serial<T>['skip'];
+}
+interface Register_afterEach_cb_failing_serial_todo<T> {
+ always: Register_afterEach_always_cb_failing_serial<T>['todo'];
+}
+interface Register_afterEach_cb_failing_skip<T> {
+ serial: Register_afterEach_cb_failing_serial_skip<T>;
+ always: Register_afterEach_always_cb_failing_skip<T>;
+}
+interface Register_afterEach_cb_failing_todo<T> {
+ serial: Register_afterEach_cb_failing_serial_todo<T>;
+ always: Register_afterEach_always_cb_failing_todo<T>;
+}
+interface Register_afterEach_always<T> {
+ serial: RegisterBase<T> & Register_afterEach_always_serial<T>;
+ skip: RegisterBase<T> & Register_afterEach_always_skip<T>;
+ todo: (name: string) => void;
+ failing: RegisterBase<T> & Register_afterEach_always_failing<T>;
+ cb: CallbackRegisterBase<T> & Register_afterEach_always_cb<T>;
+}
+interface Register_afterEach_always_serial<T> {
+ skip: RegisterBase<T> & Register_afterEach_always_serial_skip<T>;
+ todo: (name: string) => void;
+ failing: Register_afterEach_always_failing_serial<T>;
+ cb: Register_afterEach_always_cb_serial<T>;
+}
+interface Register_afterEach_always_serial_skip<T> {
+ failing: Register_afterEach_always_failing_serial_skip<T>;
+ cb: Register_afterEach_always_cb_serial_skip<T>;
+}
+interface Register_afterEach_always_serial_todo<T> {
+ failing: Register_afterEach_always_failing_serial_todo<T>;
+ cb: Register_afterEach_always_cb_serial_todo<T>;
+}
+interface Register_afterEach_always_skip<T> {
+ serial: Register_afterEach_always_serial_skip<T>;
+ failing: Register_afterEach_always_failing_skip<T>;
+ cb: Register_afterEach_always_cb_skip<T>;
+}
+interface Register_afterEach_always_todo<T> {
+ serial: Register_afterEach_always_serial_todo<T>;
+ failing: Register_afterEach_always_failing_todo<T>;
+ cb: Register_afterEach_always_cb_todo<T>;
+}
+interface Register_afterEach_always_failing<T> {
+ serial: RegisterBase<T> & Register_afterEach_always_failing_serial<T>;
+ skip: RegisterBase<T> & Register_afterEach_always_failing_skip<T>;
+ todo: (name: string) => void;
+ cb: Register_afterEach_always_cb_failing<T>;
+}
+interface Register_afterEach_always_failing_serial<T> {
+ skip: RegisterBase<T> & Register_afterEach_always_failing_serial_skip<T>;
+ todo: (name: string) => void;
+ cb: Register_afterEach_always_cb_failing_serial<T>;
+}
+interface Register_afterEach_always_failing_serial_skip<T> {
+ cb: Register_afterEach_always_cb_failing_serial<T>['skip'];
+}
+interface Register_afterEach_always_failing_serial_todo<T> {
+ cb: Register_afterEach_always_cb_failing_serial<T>['todo'];
+}
+interface Register_afterEach_always_failing_skip<T> {
+ serial: Register_afterEach_always_failing_serial_skip<T>;
+ cb: Register_afterEach_always_cb_failing_skip<T>;
+}
+interface Register_afterEach_always_failing_todo<T> {
+ serial: Register_afterEach_always_failing_serial_todo<T>;
+ cb: Register_afterEach_always_cb_failing_todo<T>;
+}
+interface Register_afterEach_always_cb<T> {
+ serial: CallbackRegisterBase<T> & Register_afterEach_always_cb_serial<T>;
+ skip: CallbackRegisterBase<T> & Register_afterEach_always_cb_skip<T>;
+ todo: (name: string) => void;
+ failing: CallbackRegisterBase<T> & Register_afterEach_always_cb_failing<T>;
+}
+interface Register_afterEach_always_cb_serial<T> {
+ skip: CallbackRegisterBase<T> & Register_afterEach_always_cb_serial_skip<T>;
+ todo: (name: string) => void;
+ failing: Register_afterEach_always_cb_failing_serial<T>;
+}
+interface Register_afterEach_always_cb_serial_skip<T> {
+ failing: Register_afterEach_always_cb_failing_serial<T>['skip'];
+}
+interface Register_afterEach_always_cb_serial_todo<T> {
+ failing: Register_afterEach_always_cb_failing_serial<T>['todo'];
+}
+interface Register_afterEach_always_cb_skip<T> {
+ serial: Register_afterEach_always_cb_serial_skip<T>;
+ failing: Register_afterEach_always_cb_failing_skip<T>;
+}
+interface Register_afterEach_always_cb_todo<T> {
+ serial: Register_afterEach_always_cb_serial_todo<T>;
+ failing: Register_afterEach_always_cb_failing_todo<T>;
+}
+interface Register_afterEach_always_cb_failing<T> {
+ serial: CallbackRegisterBase<T> & Register_afterEach_always_cb_failing_serial<T>;
+ skip: CallbackRegisterBase<T> & Register_afterEach_always_cb_failing_skip<T>;
+ todo: (name: string) => void;
+}
+interface Register_afterEach_always_cb_failing_serial<T> {
+ skip: CallbackRegisterBase<T>;
+ todo: (name: string) => void;
+}
+interface Register_afterEach_always_cb_failing_skip<T> {
+ serial: Register_afterEach_always_cb_failing_serial<T>['skip'];
+}
+interface Register_afterEach_always_cb_failing_todo<T> {
+ serial: Register_afterEach_always_cb_failing_serial<T>['todo'];
+}
+interface Register_cb<T> {
+ serial: CallbackRegisterBase<T> & Register_cb_serial<T>;
+ before: Register_before_cb<T>;
+ after: Register_after_cb<T>;
+ skip: CallbackRegisterBase<T> & Register_cb_skip<T>;
+ todo: (name: string) => void;
+ failing: CallbackRegisterBase<T> & Register_cb_failing<T>;
+ only: CallbackRegisterBase<T> & Register_cb_only<T>;
+ beforeEach: Register_beforeEach_cb<T>;
+ afterEach: Register_afterEach_cb<T>;
+ always: Register_always_cb<T>;
+}
+interface Register_cb_serial<T> {
+ before: Register_before_cb_serial<T>;
+ after: Register_after_cb_serial<T>;
+ skip: CallbackRegisterBase<T> & Register_cb_serial_skip<T>;
+ todo: (name: string) => void;
+ failing: Register_cb_failing_serial<T>;
+ only: Register_cb_only_serial<T>;
+ beforeEach: Register_beforeEach_cb_serial<T>;
+ afterEach: Register_afterEach_cb_serial<T>;
+ always: Register_always_cb_serial<T>;
+}
+interface Register_cb_serial_skip<T> {
+ before: Register_before_cb_serial_skip<T>;
+ after: Register_after_cb_serial_skip<T>;
+ failing: Register_cb_failing_serial_skip<T>;
+ beforeEach: Register_beforeEach_cb_serial_skip<T>;
+ afterEach: Register_afterEach_cb_serial_skip<T>;
+ always: Register_always_cb_serial_skip<T>;
+}
+interface Register_cb_serial_todo<T> {
+ before: Register_before_cb_serial_todo<T>;
+ after: Register_after_cb_serial_todo<T>;
+ failing: Register_cb_failing_serial_todo<T>;
+ beforeEach: Register_beforeEach_cb_serial_todo<T>;
+ afterEach: Register_afterEach_cb_serial_todo<T>;
+ always: Register_always_cb_serial_todo<T>;
+}
+interface Register_cb_skip<T> {
+ serial: Register_cb_serial_skip<T>;
+ before: Register_before_cb_skip<T>;
+ after: Register_after_cb_skip<T>;
+ failing: Register_cb_failing_skip<T>;
+ beforeEach: Register_beforeEach_cb_skip<T>;
+ afterEach: Register_afterEach_cb_skip<T>;
+ always: Register_always_cb_skip<T>;
+}
+interface Register_cb_todo<T> {
+ serial: Register_cb_serial_todo<T>;
+ before: Register_before_cb_todo<T>;
+ after: Register_after_cb_todo<T>;
+ failing: Register_cb_failing_todo<T>;
+ beforeEach: Register_beforeEach_cb_todo<T>;
+ afterEach: Register_afterEach_cb_todo<T>;
+ always: Register_always_cb_todo<T>;
+}
+interface Register_cb_failing<T> {
+ serial: CallbackRegisterBase<T> & Register_cb_failing_serial<T>;
+ before: Register_before_cb_failing<T>;
+ after: Register_after_cb_failing<T>;
+ skip: CallbackRegisterBase<T> & Register_cb_failing_skip<T>;
+ todo: (name: string) => void;
+ only: CallbackRegisterBase<T> & Register_cb_failing_only<T>;
+ beforeEach: Register_beforeEach_cb_failing<T>;
+ afterEach: Register_afterEach_cb_failing<T>;
+ always: Register_always_cb_failing<T>;
+}
+interface Register_cb_failing_serial<T> {
+ before: Register_before_cb_failing_serial<T>;
+ after: Register_after_cb_failing_serial<T>;
+ skip: CallbackRegisterBase<T> & Register_cb_failing_serial_skip<T>;
+ todo: (name: string) => void;
+ only: Register_cb_failing_only<T>['serial'];
+ beforeEach: Register_beforeEach_cb_failing_serial<T>;
+ afterEach: Register_afterEach_cb_failing_serial<T>;
+ always: Register_always_cb_failing_serial<T>;
+}
+interface Register_cb_failing_serial_skip<T> {
+ before: Register_before_cb_failing_serial<T>['skip'];
+ after: Register_after_cb_failing_serial_skip<T>;
+ beforeEach: Register_beforeEach_cb_failing_serial<T>['skip'];
+ afterEach: Register_afterEach_cb_failing_serial_skip<T>;
+ always: Register_always_cb_failing_serial_skip<T>;
+}
+interface Register_cb_failing_serial_todo<T> {
+ before: Register_before_cb_failing_serial<T>['todo'];
+ after: Register_after_cb_failing_serial_todo<T>;
+ beforeEach: Register_beforeEach_cb_failing_serial<T>['todo'];
+ afterEach: Register_afterEach_cb_failing_serial_todo<T>;
+ always: Register_always_cb_failing_serial_todo<T>;
+}
+interface Register_cb_failing_skip<T> {
+ serial: Register_cb_failing_serial_skip<T>;
+ before: Register_before_cb_failing_skip<T>;
+ after: Register_after_cb_failing_skip<T>;
+ beforeEach: Register_beforeEach_cb_failing_skip<T>;
+ afterEach: Register_afterEach_cb_failing_skip<T>;
+ always: Register_always_cb_failing_skip<T>;
+}
+interface Register_cb_failing_todo<T> {
+ serial: Register_cb_failing_serial_todo<T>;
+ before: Register_before_cb_failing_todo<T>;
+ after: Register_after_cb_failing_todo<T>;
+ beforeEach: Register_beforeEach_cb_failing_todo<T>;
+ afterEach: Register_afterEach_cb_failing_todo<T>;
+ always: Register_always_cb_failing_todo<T>;
+}
+interface Register_cb_failing_only<T> {
+ serial: CallbackRegisterBase<T>;
+}
+interface Register_cb_only<T> {
+ serial: CallbackRegisterBase<T> & Register_cb_only_serial<T>;
+ failing: Register_cb_failing_only<T>;
+}
+interface Register_cb_only_serial<T> {
+ failing: Register_cb_failing_only<T>['serial'];
+}
+interface Register_always<T> {
+ after: Register_after_always<T>;
+ afterEach: Register_afterEach_always<T>;
+}
+interface Register_always_serial<T> {
+ after: Register_after_always_serial<T>;
+ failing: Register_always_failing_serial<T>;
+ afterEach: Register_afterEach_always_serial<T>;
+ cb: Register_always_cb_serial<T>;
+}
+interface Register_always_serial_skip<T> {
+ after: Register_after_always_serial_skip<T>;
+ failing: Register_always_failing_serial_skip<T>;
+ afterEach: Register_afterEach_always_serial_skip<T>;
+ cb: Register_always_cb_serial_skip<T>;
+}
+interface Register_always_serial_todo<T> {
+ after: Register_after_always_serial_todo<T>;
+ failing: Register_always_failing_serial_todo<T>;
+ afterEach: Register_afterEach_always_serial_todo<T>;
+ cb: Register_always_cb_serial_todo<T>;
+}
+interface Register_always_skip<T> {
+ serial: Register_always_serial_skip<T>;
+ after: Register_after_always_skip<T>;
+ failing: Register_always_failing_skip<T>;
+ afterEach: Register_afterEach_always_skip<T>;
+ cb: Register_always_cb_skip<T>;
+}
+interface Register_always_todo<T> {
+ serial: Register_always_serial_todo<T>;
+ after: Register_after_always_todo<T>;
+ failing: Register_always_failing_todo<T>;
+ afterEach: Register_afterEach_always_todo<T>;
+ cb: Register_always_cb_todo<T>;
+}
+interface Register_always_failing<T> {
+ after: Register_after_always_failing<T>;
+ afterEach: Register_afterEach_always_failing<T>;
+ cb: Register_always_cb_failing<T>;
+}
+interface Register_always_failing_serial<T> {
+ after: Register_after_always_failing_serial<T>;
+ afterEach: Register_afterEach_always_failing_serial<T>;
+ cb: Register_always_cb_failing_serial<T>;
+}
+interface Register_always_failing_serial_skip<T> {
+ after: Register_after_always_failing_serial_skip<T>;
+ afterEach: Register_afterEach_always_failing_serial_skip<T>;
+ cb: Register_always_cb_failing_serial_skip<T>;
+}
+interface Register_always_failing_serial_todo<T> {
+ after: Register_after_always_failing_serial_todo<T>;
+ afterEach: Register_afterEach_always_failing_serial_todo<T>;
+ cb: Register_always_cb_failing_serial_todo<T>;
+}
+interface Register_always_failing_skip<T> {
+ serial: Register_always_failing_serial_skip<T>;
+ after: Register_after_always_failing_skip<T>;
+ afterEach: Register_afterEach_always_failing_skip<T>;
+ cb: Register_always_cb_failing_skip<T>;
+}
+interface Register_always_failing_todo<T> {
+ serial: Register_always_failing_serial_todo<T>;
+ after: Register_after_always_failing_todo<T>;
+ afterEach: Register_afterEach_always_failing_todo<T>;
+ cb: Register_always_cb_failing_todo<T>;
+}
+interface Register_always_cb<T> {
+ after: Register_after_always_cb<T>;
+ afterEach: Register_afterEach_always_cb<T>;
+}
+interface Register_always_cb_serial<T> {
+ after: Register_after_always_cb_serial<T>;
+ failing: Register_always_cb_failing_serial<T>;
+ afterEach: Register_afterEach_always_cb_serial<T>;
+}
+interface Register_always_cb_serial_skip<T> {
+ after: Register_after_always_cb_serial_skip<T>;
+ failing: Register_always_cb_failing_serial_skip<T>;
+ afterEach: Register_afterEach_always_cb_serial_skip<T>;
+}
+interface Register_always_cb_serial_todo<T> {
+ after: Register_after_always_cb_serial_todo<T>;
+ failing: Register_always_cb_failing_serial_todo<T>;
+ afterEach: Register_afterEach_always_cb_serial_todo<T>;
+}
+interface Register_always_cb_skip<T> {
+ serial: Register_always_cb_serial_skip<T>;
+ after: Register_after_always_cb_skip<T>;
+ failing: Register_always_cb_failing_skip<T>;
+ afterEach: Register_afterEach_always_cb_skip<T>;
+}
+interface Register_always_cb_todo<T> {
+ serial: Register_always_cb_serial_todo<T>;
+ after: Register_after_always_cb_todo<T>;
+ failing: Register_always_cb_failing_todo<T>;
+ afterEach: Register_afterEach_always_cb_todo<T>;
+}
+interface Register_always_cb_failing<T> {
+ after: Register_after_always_cb_failing<T>;
+ afterEach: Register_afterEach_always_cb_failing<T>;
+}
+interface Register_always_cb_failing_serial<T> {
+ after: Register_after_always_cb_failing_serial<T>;
+ afterEach: Register_afterEach_always_cb_failing_serial<T>;
+}
+interface Register_always_cb_failing_serial_skip<T> {
+ after: Register_after_always_cb_failing_serial<T>['skip'];
+ afterEach: Register_afterEach_always_cb_failing_serial<T>['skip'];
+}
+interface Register_always_cb_failing_serial_todo<T> {
+ after: Register_after_always_cb_failing_serial<T>['todo'];
+ afterEach: Register_afterEach_always_cb_failing_serial<T>['todo'];
+}
+interface Register_always_cb_failing_skip<T> {
+ serial: Register_always_cb_failing_serial_skip<T>;
+ after: Register_after_always_cb_failing_skip<T>;
+ afterEach: Register_afterEach_always_cb_failing_skip<T>;
+}
+interface Register_always_cb_failing_todo<T> {
+ serial: Register_always_cb_failing_serial_todo<T>;
+ after: Register_after_always_cb_failing_todo<T>;
+ afterEach: Register_afterEach_always_cb_failing_todo<T>;
+}
diff --git a/node_modules/ava/types/make.js b/node_modules/ava/types/make.js
new file mode 100644
index 000000000..9516fbb61
--- /dev/null
+++ b/node_modules/ava/types/make.js
@@ -0,0 +1,184 @@
+'use strict';
+
+// TypeScript definitions are generated here.
+// AVA allows chaining of function names, like `test.after.cb.always`.
+// The order of these names is not important.
+// Writing these definitions by hand is hard. Because of chaining,
+// the number of combinations grows fast (2^n). To reduce this number,
+// illegal combinations are filtered out in `verify`.
+// The order of the options is not important. We could generate full
+// definitions for each possible order, but that would give a very big
+// output. Instead, we write an alias for different orders. For instance,
+// `after.cb` is fully written, and `cb.after` is emitted as an alias
+// using `typeof after.cb`.
+
+const path = require('path');
+const fs = require('fs');
+const isArraySorted = require('is-array-sorted');
+const Runner = require('../lib/runner');
+
+const arrayHas = parts => part => parts.indexOf(part) !== -1;
+
+const base = fs.readFileSync(path.join(__dirname, 'base.d.ts'), 'utf8');
+
+// All suported function names
+const allParts = Object.keys(new Runner({}).chain).filter(name => name !== 'test');
+
+// The output consists of the base declarations, the actual 'test' function declarations,
+// and the namespaced chainable methods.
+const output = base + generatePrefixed([]);
+
+fs.writeFileSync(path.join(__dirname, 'generated.d.ts'), output);
+
+// Generates type definitions, for the specified prefix
+// The prefix is an array of function names
+function generatePrefixed(prefix) {
+ let output = '';
+ let children = '';
+
+ for (const part of allParts) {
+ const parts = prefix.concat([part]);
+
+ if (prefix.indexOf(part) !== -1 || !verify(parts, true)) {
+ // Function already in prefix or not allowed here
+ continue;
+ }
+
+ // If `parts` is not sorted, we alias it to the sorted chain
+ if (!isArraySorted(parts)) {
+ if (exists(parts)) {
+ parts.sort();
+
+ let chain;
+ if (hasChildren(parts)) {
+ chain = parts.join('_') + '<T>';
+ } else {
+ // This is a single function, not a namespace, so there's no type associated
+ // and we need to dereference it as a property type
+ const last = parts.pop();
+ const joined = parts.join('_');
+ chain = `${joined}<T>['${last}']`;
+ }
+
+ output += `\t${part}: Register_${chain};\n`;
+ }
+
+ continue;
+ }
+
+ // Check that `part` is a valid function name.
+ // `always` is a valid prefix, for instance of `always.after`,
+ // but not a valid function name.
+ if (verify(parts, false)) {
+ if (arrayHas(parts)('todo')) {
+ // 'todo' functions don't have a function argument, just a string
+ output += `\t${part}: (name: string) => void;\n`;
+ } else {
+ if (arrayHas(parts)('cb')) {
+ output += `\t${part}: CallbackRegisterBase<T>`;
+ } else {
+ output += `\t${part}: RegisterBase<T>`;
+ }
+
+ if (hasChildren(parts)) {
+ // This chain can be continued, make the property an intersection type with the chain continuation
+ const joined = parts.join('_');
+ output += ` & Register_${joined}<T>`;
+ }
+
+ output += ';\n';
+ }
+ }
+
+ children += generatePrefixed(parts);
+ }
+
+ if (output === '') {
+ return children;
+ }
+
+ const typeBody = `{\n${output}}\n${children}`;
+
+ if (prefix.length === 0) {
+ // No prefix, so this is the type for the default export
+ return `export interface Register<T> extends RegisterBase<T> ${typeBody}`;
+ }
+ const namespace = ['Register'].concat(prefix).join('_');
+ return `interface ${namespace}<T> ${typeBody}`;
+}
+
+// Checks whether a chain is a valid function name (when `asPrefix === false`)
+// or a valid prefix that could contain members.
+// For instance, `test.always` is not a valid function name, but it is a valid
+// prefix of `test.always.after`.
+function verify(parts, asPrefix) {
+ const has = arrayHas(parts);
+
+ if (has('only') + has('skip') + has('todo') > 1) {
+ return false;
+ }
+
+ const beforeAfterCount = has('before') + has('beforeEach') + has('after') + has('afterEach');
+
+ if (beforeAfterCount > 1) {
+ return false;
+ }
+
+ if (beforeAfterCount === 1) {
+ if (has('only')) {
+ return false;
+ }
+ }
+
+ if (has('always')) {
+ // `always` can only be used with `after` or `afterEach`.
+ // Without it can still be a valid prefix
+ if (has('after') || has('afterEach')) {
+ return true;
+ }
+
+ if (!verify(parts.concat(['after']), false) && !verify(parts.concat(['afterEach']), false)) {
+ // If `after` nor `afterEach` cannot be added to this prefix,
+ // `always` is not allowed here.
+ return false;
+ }
+
+ // Only allowed as a prefix
+ return asPrefix;
+ }
+
+ return true;
+}
+
+// Returns true if a chain can have any child properties
+function hasChildren(parts) {
+ // Concatenate the chain with each other part, and see if any concatenations are valid functions
+ const validChildren = allParts
+ .filter(newPart => parts.indexOf(newPart) === -1)
+ .map(newPart => parts.concat([newPart]))
+ .filter(longer => verify(longer, false));
+
+ return validChildren.length > 0;
+}
+
+// Checks whether a chain is a valid function name or a valid prefix with some member
+function exists(parts) {
+ if (verify(parts, false)) {
+ // Valid function name
+ return true;
+ }
+
+ if (!verify(parts, true)) {
+ // Not valid prefix
+ return false;
+ }
+
+ // Valid prefix, check whether it has members
+ for (const prefix of allParts) {
+ if (parts.indexOf(prefix) === -1 && exists(parts.concat([prefix]))) {
+ return true;
+ }
+ }
+
+ return false;
+}