ava 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -123,11 +123,11 @@ MiniReporter.prototype.unhandledError = function (err) {
123
123
 
124
124
  MiniReporter.prototype.reportCounts = function (time) {
125
125
  var lines = [
126
- this.passCount > 0 ? '\n ' + colors.pass(this.passCount, 'passed') : '',
127
- this.knownFailureCount > 0 ? '\n ' + colors.error(this.knownFailureCount, plur('known failure', this.knownFailureCount)) : '',
128
- this.failCount > 0 ? '\n ' + colors.error(this.failCount, 'failed') : '',
129
- this.skipCount > 0 ? '\n ' + colors.skip(this.skipCount, 'skipped') : '',
130
- this.todoCount > 0 ? '\n ' + colors.todo(this.todoCount, 'todo') : ''
126
+ this.passCount > 0 ? '\n ' + colors.pass(this.passCount, 'passed') : '',
127
+ this.knownFailureCount > 0 ? '\n ' + colors.error(this.knownFailureCount, plur('known failure', this.knownFailureCount)) : '',
128
+ this.failCount > 0 ? '\n ' + colors.error(this.failCount, 'failed') : '',
129
+ this.skipCount > 0 ? '\n ' + colors.skip(this.skipCount, 'skipped') : '',
130
+ this.todoCount > 0 ? '\n ' + colors.todo(this.todoCount, 'todo') : ''
131
131
  ].filter(Boolean);
132
132
 
133
133
  if (time && lines.length > 0) {
@@ -148,26 +148,22 @@ MiniReporter.prototype.finish = function (runStatus) {
148
148
  var status = this.reportCounts(time);
149
149
 
150
150
  if (this.rejectionCount > 0) {
151
- status += '\n ' + colors.error(this.rejectionCount, plur('rejection', this.rejectionCount));
151
+ status += '\n ' + colors.error(this.rejectionCount, plur('rejection', this.rejectionCount));
152
152
  }
153
153
 
154
154
  if (this.exceptionCount > 0) {
155
- status += '\n ' + colors.error(this.exceptionCount, plur('exception', this.exceptionCount));
155
+ status += '\n ' + colors.error(this.exceptionCount, plur('exception', this.exceptionCount));
156
156
  }
157
157
 
158
158
  if (runStatus.previousFailCount > 0) {
159
- status += '\n ' + colors.error(runStatus.previousFailCount, 'previous', plur('failure', runStatus.previousFailCount), 'in test files that were not rerun');
159
+ status += '\n ' + colors.error(runStatus.previousFailCount, 'previous', plur('failure', runStatus.previousFailCount), 'in test files that were not rerun');
160
160
  }
161
161
 
162
- var i = 0;
163
-
164
162
  if (this.knownFailureCount > 0) {
165
163
  runStatus.knownFailures.forEach(function (test) {
166
- i++;
167
-
168
164
  var title = test.title;
169
165
 
170
- status += '\n\n\n ' + colors.error(i + '.', title);
166
+ status += '\n\n ' + colors.title(title);
171
167
  // TODO output description with link
172
168
  // status += colors.stack(description);
173
169
  });
@@ -179,19 +175,26 @@ MiniReporter.prototype.finish = function (runStatus) {
179
175
  return;
180
176
  }
181
177
 
182
- i++;
183
-
184
178
  var title = test.error ? test.title : 'Unhandled Error';
185
179
  var description;
180
+ var errorTitle = ' ' + test.error.message + '\n';
181
+ var isPowerAssert = test.error.message.split('\n').length > 1;
186
182
 
187
183
  if (test.error) {
188
- description = ' ' + test.error.message + '\n ' + stripFirstLine(test.error.stack).trimRight();
184
+ description = stripFirstLine(test.error.stack).trimRight();
189
185
  } else {
190
186
  description = JSON.stringify(test);
191
187
  }
192
188
 
193
- status += '\n\n\n ' + colors.error(i + '.', title) + '\n';
194
- status += colors.stack(description);
189
+ if (isPowerAssert) {
190
+ description = stripFirstLine(description).replace(/ {3}/g, ' ');
191
+ } else {
192
+ description.replace(/ {3}/g, ' ');
193
+ }
194
+
195
+ status += '\n\n ' + colors.title(title) + '\n';
196
+ status += colors.stack(errorTitle);
197
+ status += colors.errorStack(description);
195
198
  });
196
199
  }
197
200
 
@@ -201,21 +204,23 @@ MiniReporter.prototype.finish = function (runStatus) {
201
204
  return;
202
205
  }
203
206
 
204
- i++;
205
-
206
207
  if (err.type === 'exception' && err.name === 'AvaError') {
207
- status += '\n\n\n ' + colors.error(cross + ' ' + err.message);
208
+ status += '\n\n ' + colors.error(cross + ' ' + err.message);
208
209
  } else {
209
210
  var title = err.type === 'rejection' ? 'Unhandled Rejection' : 'Uncaught Exception';
210
211
  var description = err.stack ? err.stack.trimRight() : JSON.stringify(err);
212
+ description = description.split('\n');
213
+ var errorTitle = description[0];
214
+ var errorStack = description.slice(1).join('\n');
211
215
 
212
- status += '\n\n\n ' + colors.error(i + '.', title) + '\n';
213
- status += ' ' + colors.stack(description);
216
+ status += '\n\n ' + colors.title(title) + '\n';
217
+ status += ' ' + colors.stack(errorTitle) + '\n';
218
+ status += colors.errorStack(errorStack);
214
219
  }
215
220
  });
216
221
  }
217
222
 
218
- return status + '\n';
223
+ return status + '\n\n';
219
224
  };
220
225
 
221
226
  MiniReporter.prototype.section = function () {
@@ -247,7 +252,7 @@ MiniReporter.prototype._update = function (data) {
247
252
  lastLine = lastLine.substring(lastLine.length - (lastLine.length % columns));
248
253
 
249
254
  // Don't delete the last log line if it's completely empty.
250
- if (lastLine.length) {
255
+ if (lastLine.length > 0) {
251
256
  ct++;
252
257
  }
253
258
 
@@ -257,7 +262,7 @@ MiniReporter.prototype._update = function (data) {
257
262
  // Rewrite the last log line.
258
263
  str += lastLine;
259
264
 
260
- if (str.length) {
265
+ if (str.length > 0) {
261
266
  this.stream.write(str);
262
267
  }
263
268
 
@@ -269,7 +274,7 @@ MiniReporter.prototype._update = function (data) {
269
274
 
270
275
  var currentStatus = this.currentStatus;
271
276
 
272
- if (currentStatus.length) {
277
+ if (currentStatus.length > 0) {
273
278
  lastLine = this.lastLineTracker.lastLine();
274
279
  // We need a newline at the end of the last log line, before the status message.
275
280
  // However, if the last log line is the exact width of the terminal a newline is implied,
package/lib/run-status.js CHANGED
@@ -1,11 +1,12 @@
1
1
  'use strict';
2
2
  var EventEmitter = require('events').EventEmitter;
3
- var path = require('path');
4
3
  var util = require('util');
5
4
  var chalk = require('chalk');
6
5
  var isObj = require('is-obj');
7
6
  var flatten = require('arr-flatten');
8
7
  var figures = require('figures');
8
+ var autoBind = require('auto-bind');
9
+ var prefixTitle = require('./prefix-title');
9
10
 
10
11
  function RunStatus(opts) {
11
12
  if (!(this instanceof RunStatus)) {
@@ -33,9 +34,7 @@ function RunStatus(opts) {
33
34
  this.stats = [];
34
35
  this.tests = [];
35
36
 
36
- Object.keys(RunStatus.prototype).forEach(function (key) {
37
- this[key] = this[key].bind(this);
38
- }, this);
37
+ autoBind(this);
39
38
  }
40
39
 
41
40
  util.inherits(RunStatus, EventEmitter);
@@ -108,7 +107,7 @@ RunStatus.prototype.handleTest = function (test) {
108
107
 
109
108
  if (test.error) {
110
109
  if (test.error.name !== 'AssertionError') {
111
- test.error.message = 'failed with "' + test.error.message + '"';
110
+ test.error.message = 'Error: ' + test.error.message;
112
111
  }
113
112
 
114
113
  this.errors.push(test);
@@ -128,26 +127,7 @@ RunStatus.prototype.prefixTitle = function (file) {
128
127
 
129
128
  var separator = ' ' + chalk.gray.dim(figures.pointerSmall) + ' ';
130
129
 
131
- var prefix = path.relative('.', file)
132
- .replace(this.base, function (match, offset) {
133
- // only replace this.base if it is found at the start of the path
134
- return offset === 0 ? '' : match;
135
- })
136
- .replace(/\.spec/, '')
137
- .replace(/\.test/, '')
138
- .replace(/test\-/g, '')
139
- .replace(/\.js$/, '')
140
- .split(path.sep)
141
- .filter(function (p) {
142
- return p !== '__tests__';
143
- })
144
- .join(separator);
145
-
146
- if (prefix.length > 0) {
147
- prefix += separator;
148
- }
149
-
150
- return prefix;
130
+ return prefixTitle(file, this.base, separator);
151
131
  };
152
132
 
153
133
  RunStatus.prototype.handleOutput = function (channel, data) {
package/lib/sequence.js CHANGED
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
  var isPromise = require('is-promise');
3
+ var autoBind = require('auto-bind');
3
4
  var AvaError = require('./ava-error');
4
5
 
5
6
  function noop() {}
@@ -21,10 +22,7 @@ function Sequence(tests, bail) {
21
22
  this.tests = tests;
22
23
  this.bail = bail || false;
23
24
 
24
- // TODO(vdemedes): separate into a utility (it's being used in serveral places)
25
- Object.keys(Sequence.prototype).forEach(function (key) {
26
- this[key] = this[key].bind(this);
27
- }, this);
25
+ autoBind(this);
28
26
  }
29
27
 
30
28
  Sequence.prototype.run = function () {
@@ -1,40 +1,9 @@
1
1
  'use strict';
2
2
  /* eslint-disable import/order */
3
- var opts = JSON.parse(process.argv[2]);
4
- var testPath = opts.file;
5
-
6
- // Fake TTY support
7
- if (opts.tty) {
8
- process.stdout.isTTY = true;
9
- process.stdout.columns = opts.tty.columns || 80;
10
- process.stdout.rows = opts.tty.rows;
11
-
12
- var tty = require('tty');
13
- var isatty = tty.isatty;
14
-
15
- tty.isatty = function (fd) {
16
- if (fd === 1 || fd === process.stdout) {
17
- return true;
18
- }
19
-
20
- return isatty(fd);
21
- };
22
- }
23
-
24
- var path = require('path');
25
- var fs = require('fs');
26
- var debug = require('debug')('ava');
27
- var sourceMapSupport = require('source-map-support');
28
-
29
- if (debug.enabled) {
30
- // Forward the `time-require` `--sorted` flag.
31
- // Intended for internal optimization tests only.
32
- if (opts._sorted) {
33
- process.argv.push('--sorted');
34
- }
3
+ var process = require('./process-adapter');
35
4
 
36
- require('time-require');
37
- }
5
+ var opts = process.opts;
6
+ var testPath = opts.file;
38
7
 
39
8
  // bind globals first before anything has a chance to interfere
40
9
  var globals = require('./globals');
@@ -46,54 +15,22 @@ Promise.longStackTraces();
46
15
 
47
16
  (opts.require || []).forEach(require);
48
17
 
49
- var sourceMapCache = Object.create(null);
50
-
51
- sourceMapSupport.install({
52
- environment: 'node',
53
- handleUncaughtExceptions: false,
54
- retrieveSourceMap: function (source) {
55
- if (sourceMapCache[source]) {
56
- return {
57
- url: source,
58
- map: fs.readFileSync(sourceMapCache[source], 'utf8')
59
- };
60
- }
61
- }
62
- });
18
+ process.installSourceMapSupport();
63
19
 
64
20
  var currentlyUnhandled = require('currently-unhandled')();
65
21
  var serializeError = require('./serialize-error');
66
- var send = require('./send');
22
+ var send = process.send;
67
23
  var throwsHelper = require('./throws-helper');
68
- var installPrecompiler = require('require-precompiled');
69
- var cacheDir = opts.cacheDir;
70
24
 
71
25
  // check if test files required ava and show error, when they didn't
72
26
  exports.avaRequired = false;
73
27
 
74
- installPrecompiler(function (filename) {
75
- var precompiled = opts.precompiled[filename];
76
-
77
- if (precompiled) {
78
- sourceMapCache[filename] = path.join(cacheDir, precompiled + '.js.map');
79
- return fs.readFileSync(path.join(cacheDir, precompiled + '.js'), 'utf8');
80
- }
81
-
82
- return null;
83
- });
28
+ process.installPrecompilerHook();
84
29
 
85
30
  var dependencies = [];
86
- Object.keys(require.extensions).forEach(function (ext) {
87
- var wrappedHandler = require.extensions[ext];
88
- require.extensions[ext] = function (module, filename) {
89
- if (filename !== testPath) {
90
- dependencies.push(filename);
91
- }
92
- wrappedHandler(module, filename);
93
- };
94
- });
31
+ process.installDependencyTracking(dependencies, testPath);
95
32
 
96
- require(testPath);
33
+ require(testPath); // eslint-disable-line import/no-dynamic-require
97
34
 
98
35
  process.on('unhandledRejection', throwsHelper);
99
36
 
@@ -4,7 +4,7 @@ var path = require('path');
4
4
  var chalk = require('chalk');
5
5
  var globals = require('./globals');
6
6
 
7
- module.exports = function throwsHelper(error) {
7
+ module.exports = function (error) {
8
8
  if (!error || !error._avaThrowsHelperData) {
9
9
  return;
10
10
  }
package/lib/watcher.js CHANGED
@@ -23,8 +23,6 @@ function Watcher(logger, api, files, sources) {
23
23
  sources: sources
24
24
  });
25
25
 
26
- this.isTest = this.avaFiles.makeTestMatcher();
27
-
28
26
  this.clearLogOnNextRun = true;
29
27
  this.runVector = 0;
30
28
  this.run = function (specificFiles) {
@@ -105,7 +103,6 @@ Watcher.prototype.watchFiles = function () {
105
103
 
106
104
  Watcher.prototype.trackTestDependencies = function (api) {
107
105
  var self = this;
108
- var isSource = this.avaFiles.makeSourceMatcher();
109
106
 
110
107
  var relative = function (absPath) {
111
108
  return nodePath.relative('.', absPath);
@@ -113,7 +110,7 @@ Watcher.prototype.trackTestDependencies = function (api) {
113
110
 
114
111
  api.on('test-run', function (runStatus) {
115
112
  runStatus.on('dependencies', function (file, dependencies) {
116
- var sourceDeps = dependencies.map(relative).filter(isSource);
113
+ var sourceDeps = dependencies.map(relative).filter(self.avaFiles.isSource);
117
114
  self.updateTestDependencies(file, sourceDeps);
118
115
  });
119
116
  });
@@ -261,7 +258,7 @@ Watcher.prototype.runAfterChanges = function () {
261
258
  this.dirtyStates = {};
262
259
 
263
260
  var dirtyPaths = Object.keys(dirtyStates);
264
- var dirtyTests = dirtyPaths.filter(this.isTest);
261
+ var dirtyTests = dirtyPaths.filter(this.avaFiles.isTest);
265
262
  var dirtySources = diff(dirtyPaths, dirtyTests);
266
263
  var addedOrChangedTests = dirtyTests.filter(function (path) {
267
264
  return dirtyStates[path] !== 'unlink';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ava",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "Futuristic test runner 🚀",
5
5
  "license": "MIT",
6
6
  "repository": "avajs/ava",
@@ -30,6 +30,11 @@
30
30
  "name": "Juan Soto",
31
31
  "email": "juan@juansoto.me",
32
32
  "url": "juansoto.me"
33
+ },
34
+ {
35
+ "name": "Jeroen Engels",
36
+ "email": "jfm.engels@gmail.com",
37
+ "url": "github.com/jfmengels"
33
38
  }
34
39
  ],
35
40
  "bin": "cli.js",
@@ -38,7 +43,7 @@
38
43
  "node": ">=0.10.0"
39
44
  },
40
45
  "scripts": {
41
- "test": "xo && nyc --cache --reporter=lcov --reporter=text tap --no-cov --timeout=150 test/*.js test/reporters/*.js",
46
+ "test": "scripts/xo.js && nyc --cache --reporter=lcov --reporter=text tap --no-cov --timeout=150 test/*.js test/reporters/*.js",
42
47
  "test-win": "tap --no-cov --reporter=classic --timeout=150 test/*.js test/reporters/*.js",
43
48
  "visual": "node test/visual/run-visual-tests.js",
44
49
  "prepublish": "npm run make-ts",
@@ -47,6 +52,7 @@
47
52
  "files": [
48
53
  "lib",
49
54
  "*.js",
55
+ "*.js.flow",
50
56
  "types/generated.d.ts"
51
57
  ],
52
58
  "keywords": [
@@ -84,17 +90,19 @@
84
90
  "array-union": "^1.0.1",
85
91
  "array-uniq": "^1.0.2",
86
92
  "arrify": "^1.0.0",
87
- "ava-files": "^0.1.1",
93
+ "auto-bind": "^0.1.0",
94
+ "ava-files": "^0.2.0",
88
95
  "ava-init": "^0.1.0",
89
- "babel-code-frame": "^6.7.5",
90
- "babel-core": "^6.3.21",
96
+ "babel-code-frame": "^6.16.0",
97
+ "babel-core": "^6.17.0",
91
98
  "babel-plugin-ava-throws-helper": "^0.1.0",
92
99
  "babel-plugin-detective": "^2.0.0",
93
- "babel-plugin-espower": "^2.2.0",
94
- "babel-plugin-transform-runtime": "^6.3.13",
95
- "babel-preset-es2015": "^6.3.13",
96
- "babel-preset-stage-2": "^6.3.13",
97
- "babel-runtime": "^6.3.19",
100
+ "babel-plugin-espower": "^2.3.1",
101
+ "babel-plugin-transform-runtime": "^6.15.0",
102
+ "babel-preset-es2015": "^6.16.0",
103
+ "babel-preset-es2015-node4": "^2.1.0",
104
+ "babel-preset-stage-2": "^6.17.0",
105
+ "babel-runtime": "^6.11.6",
98
106
  "bluebird": "^3.0.0",
99
107
  "caching-transform": "^1.0.0",
100
108
  "chalk": "^1.0.0",
@@ -113,6 +121,7 @@
113
121
  "figures": "^1.4.0",
114
122
  "find-cache-dir": "^0.1.1",
115
123
  "fn-name": "^2.0.0",
124
+ "get-port": "^2.1.0",
116
125
  "has-flag": "^2.0.0",
117
126
  "ignore-by-default": "^1.0.0",
118
127
  "is-ci": "^1.0.7",
@@ -123,13 +132,13 @@
123
132
  "last-line-stream": "^1.0.0",
124
133
  "lodash.debounce": "^4.0.3",
125
134
  "lodash.difference": "^4.3.0",
135
+ "lodash.isequal": "^4.4.0",
126
136
  "loud-rejection": "^1.2.0",
127
137
  "matcher": "^0.1.1",
128
138
  "max-timeout": "^1.0.0",
129
139
  "md5-hex": "^1.2.0",
130
140
  "meow": "^3.7.0",
131
141
  "ms": "^0.7.1",
132
- "not-so-shallow": "^0.1.3",
133
142
  "object-assign": "^4.0.1",
134
143
  "observable-to-promise": "^0.4.0",
135
144
  "option-chain": "^0.1.0",
@@ -143,6 +152,7 @@
143
152
  "repeating": "^2.0.0",
144
153
  "require-precompiled": "^0.1.0",
145
154
  "resolve-cwd": "^1.0.0",
155
+ "semver": "^5.3.0",
146
156
  "set-immediate-shim": "^1.0.1",
147
157
  "source-map-support": "^0.4.0",
148
158
  "stack-utils": "^0.4.0",
@@ -165,31 +175,22 @@
165
175
  "inquirer": "^1.0.2",
166
176
  "lolex": "^1.4.0",
167
177
  "mkdirp": "^0.5.1",
168
- "nyc": "^7.1.0",
178
+ "nyc": "^9.0.1",
169
179
  "pify": "^2.3.0",
170
180
  "proxyquire": "^1.7.4",
171
181
  "rimraf": "^2.5.0",
172
182
  "signal-exit": "^3.0.0",
173
183
  "sinon": "^1.17.2",
174
184
  "source-map-fixtures": "^2.1.0",
175
- "tap": "^6.3.0",
185
+ "tap": "^8.0.0",
176
186
  "touch": "^1.0.0",
177
- "xo": "*",
187
+ "xo": "^0.17.0",
178
188
  "zen-observable": "^0.3.0"
179
189
  },
180
190
  "xo": {
181
191
  "rules": {
182
- "import/newline-after-import": 0
183
- },
184
- "overrides": [
185
- {
186
- "files": [
187
- "test/**/*.js"
188
- ],
189
- "rules": {
190
- "max-lines": 0
191
- }
192
- }
193
- ]
192
+ "import/newline-after-import": "off",
193
+ "no-use-extend-native/no-use-extend-native": "off"
194
+ }
194
195
  }
195
196
  }
package/profile.js CHANGED
@@ -9,7 +9,6 @@ var EventEmitter = require('events').EventEmitter;
9
9
  var meow = require('meow');
10
10
  var Promise = require('bluebird');
11
11
  var pkgConf = require('pkg-conf');
12
- var arrify = require('arrify');
13
12
  var findCacheDir = require('find-cache-dir');
14
13
  var uniqueTempDir = require('unique-temp-dir');
15
14
  var CachingPrecompiler = require('./lib/caching-precompiler');
@@ -35,12 +34,10 @@ var cli = meow([
35
34
  'Options',
36
35
  ' --fail-fast Stop after first test failure',
37
36
  ' --serial, -s Run tests serially',
38
- ' --require, -r Module to preload (Can be repeated)',
39
37
  ''
40
38
  ], {
41
39
  string: [
42
- '_',
43
- 'require'
40
+ '_'
44
41
  ],
45
42
  boolean: [
46
43
  'fail-fast',
@@ -50,7 +47,6 @@ var cli = meow([
50
47
  ],
51
48
  default: conf,
52
49
  alias: {
53
- r: 'require',
54
50
  s: 'serial'
55
51
  }
56
52
  });
@@ -64,14 +60,19 @@ var cacheDir = findCacheDir({
64
60
  name: 'ava',
65
61
  files: [file]
66
62
  }) || uniqueTempDir();
63
+
64
+ var precompiler = new CachingPrecompiler({
65
+ path: cacheDir,
66
+ babel: conf.babel
67
+ });
68
+
67
69
  var precompiled = {};
68
- precompiled[file] = new CachingPrecompiler(cacheDir, conf.babel).precompileFile(file);
70
+ precompiled[file] = precompiler.precompileFile(file);
69
71
 
70
72
  var opts = {
71
73
  file: file,
72
74
  failFast: cli.flags.failFast,
73
75
  serial: cli.flags.serial,
74
- require: arrify(cli.flags.require),
75
76
  tty: false,
76
77
  cacheDir: cacheDir,
77
78
  precompiled: precompiled
@@ -111,7 +112,7 @@ events.on('results', function (data) {
111
112
  if (process.exit) {
112
113
  // Delay is For Node 0.10 which emits uncaughtExceptions async.
113
114
  setTimeout(function () {
114
- process.exit(data.stats.failCount + uncaughtExceptionCount); // eslint-disable-line xo/no-process-exit
115
+ process.exit(data.stats.failCount + uncaughtExceptionCount); // eslint-disable-line unicorn/no-process-exit
115
116
  }, 20);
116
117
  }
117
118
  });
@@ -138,5 +139,5 @@ if (console.profile) {
138
139
  }
139
140
 
140
141
  setImmediate(function () {
141
- require('./lib/test-worker');
142
+ require('./lib/test-worker'); // eslint-disable-line import/no-unassigned-import
142
143
  });
package/readme.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Futuristic test runner
4
4
 
5
- [![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) [![Gitter](https://badges.gitter.im/join_chat.svg)](https://gitter.im/avajs/ava)
5
+ [![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)
6
6
 
7
7
  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 sec to 11 sec. 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!
8
8
 
@@ -47,6 +47,7 @@ Translations: [Español](https://github.com/avajs/ava-docs/blob/master/es_ES/rea
47
47
  - [Enhanced assertion messages](#enhanced-assertion-messages)
48
48
  - [TAP reporter](#tap-reporter)
49
49
  - [Clean stack traces](#clean-stack-traces)
50
+ - [Automatic migration from other test runners](https://github.com/avajs/ava-codemods#migrating-to-ava)
50
51
 
51
52
  ## Test syntax
52
53
 
@@ -114,8 +115,6 @@ test('bar', async t => {
114
115
  });
115
116
  ```
116
117
 
117
- <img src="media/screenshot.png" width="150" align="right">
118
-
119
118
  ### Run it
120
119
 
121
120
  ```console
@@ -142,10 +141,10 @@ $ ava --help
142
141
  --init Add AVA to your project
143
142
  --fail-fast Stop after first test failure
144
143
  --serial, -s Run tests serially
145
- --require, -r Module to preload (Can be repeated)
146
144
  --tap, -t Generate TAP output
147
145
  --verbose, -v Enable verbose output
148
146
  --no-cache Disable the transpiler cache
147
+ --no-power-assert Disable Power Assert
149
148
  --match, -m Only run tests with matching title (Can be repeated)
150
149
  --watch, -w Re-run tests when tests and source files change
151
150
  --source, -S Pattern to match source files so tests can be re-run (Can be repeated)
@@ -225,6 +224,7 @@ All of the CLI options can be configured in the `ava` section of your `package.j
225
224
  "concurrency": 5,
226
225
  "failFast": true,
227
226
  "tap": true,
227
+ "powerAssert": false,
228
228
  "require": [
229
229
  "babel-register"
230
230
  ],
@@ -247,11 +247,13 @@ If you're unable to use promises or observables, you may enable "callback mode"
247
247
 
248
248
  You must define all tests synchronously. They can't be defined inside `setTimeout`, `setImmediate`, etc.
249
249
 
250
- Test files are run from their current directory, so [`process.cwd()`](https://nodejs.org/api/process.html#process_process_cwd) is always the same as [`__dirname`](https://nodejs.org/api/globals.html#globals_dirname). You can just use relative paths instead of doing `path.join(__dirname, 'relative/path')`.
250
+ AVA tries to run test files with their current working directory set to the directory that contains your `package.json` file.
251
251
 
252
252
  ### Creating tests
253
253
 
254
- 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 and only argument. By convention this argument is named `t`.
254
+ 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.
255
+
256
+ **Note:** In order for the [enhanced assertion messages](#enhanced-assertion-messages) to behave correctly, the first argument **must** be named `t`.
255
257
 
256
258
  ```js
257
259
  import test from 'ava';
@@ -386,7 +388,7 @@ Match titles that are *exactly* `foo` (albeit case insensitively):
386
388
  $ ava --match='foo'
387
389
  ```
388
390
 
389
- Watch titles not containing `foo`:
391
+ Match titles not containing `foo`:
390
392
 
391
393
  ```console
392
394
  $ ava --match='!*foo*'
@@ -549,7 +551,7 @@ test(t => {
549
551
  });
550
552
  ```
551
553
 
552
- By default `t.context` is an object but you can reassign it:
554
+ 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:
553
555
 
554
556
  ```js
555
557
  test.beforeEach(t => {
@@ -704,7 +706,7 @@ See AVA's [TypeScript recipe](docs/recipes/typescript.md) for a more detailed ex
704
706
 
705
707
  AVA currently only transpiles the tests you ask it to run. *It will not transpile modules you `import` from outside of the test.* This may be unexpected but there are workarounds.
706
708
 
707
- If you use Babel you can use its [require hook](https://babeljs.io/docs/usage/require/) to transpile imported modules on-the-fly. Run AVA with `--require babel-register` (see [CLI](#cli)) or [configure it in your `package.json`](#configuration).
709
+ 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).
708
710
 
709
711
  You can also transpile your modules in a separate process and refer to the transpiled files rather than the sources from your tests.
710
712
 
@@ -1021,6 +1023,7 @@ It's the [Andromeda galaxy](https://simple.wikipedia.org/wiki/Andromeda_galaxy).
1021
1023
  - [Configuring Babel](docs/recipes/babelrc.md)
1022
1024
  - [Testing React components](docs/recipes/react.md)
1023
1025
  - [JSPM and SystemJS](docs/recipes/jspm-systemjs.md)
1026
+ - [Debugging tests with WebStorm](docs/recipes/debugging-with-webstorm.md)
1024
1027
 
1025
1028
  ## Support
1026
1029
 
@@ -1049,9 +1052,9 @@ It's the [Andromeda galaxy](https://simple.wikipedia.org/wiki/Andromeda_galaxy).
1049
1052
 
1050
1053
  ## Team
1051
1054
 
1052
- [![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/vdemedes) | [![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)
1053
- ---|---|---|---|---|---
1054
- [Sindre Sorhus](http://sindresorhus.com) | [Vadim Demedes](https://github.com/vdemedes) | [James Talmage](https://github.com/jamestalmage) | [Mark Wubben](https://novemberborn.net) | [Juan Soto](http://juansoto.me)
1055
+ [![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/vdemedes) | [![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)
1056
+ ---|---|---|---|---|---|---
1057
+ [Sindre Sorhus](http://sindresorhus.com) | [Vadim Demedes](https://github.com/vdemedes) | [James Talmage](https://github.com/jamestalmage) | [Mark Wubben](https://novemberborn.net) | [Juan Soto](http://juansoto.me) | [Jeroen Engels](https://github.com/jfmengels)
1055
1058
 
1056
1059
  ### Former
1057
1060