Skip to content

Commit 08ce255

Browse files
Juanjamestalmage
authored andcommitted
Replace "callback" with "implementation" when talking about tests
1 parent 21bdcc5 commit 08ce255

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

lib/runner.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ optionChain(chainableMethods, function (opts, title, fn) {
6969
throw new TypeError('`todo` tests require a title');
7070
}
7171
} else if (typeof fn !== 'function') {
72-
throw new TypeError('Expected a function. Use `test.todo()` for tests without a function.');
72+
throw new TypeError('Expected an implementation. Use `test.todo()` for tests without an implementation.');
7373
}
7474

7575
if (this._serial) {

readme.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ Test files are run from their current directory, so [`process.cwd()`](https://no
213213

214214
### Creating tests
215215

216-
To create a test you call the `test` function you imported from AVA. Provide the optional title and callback 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`.
216+
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`.
217217

218218
```js
219219
import test from 'ava';
@@ -235,7 +235,7 @@ test(t => {
235235

236236
It's recommended to provide test titles if you have more than one test.
237237

238-
If you haven't provided a test title, but the callback is a named function, that name will be used as the test title:
238+
If you haven't provided a test title, but the implementation is a named function, that name will be used as the test title:
239239

240240
```js
241241
test(function name(t) {
@@ -366,7 +366,7 @@ Match titles starting with `foo` or ending with `bar`:
366366
$ ava --match='foo*' --match='*bar'
367367
```
368368

369-
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 callback function will be skipped when `--match` is used.
369+
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.
370370

371371
Here's what happens when you run AVA with a match pattern of `*oo*` and the following tests:
372372

@@ -404,11 +404,11 @@ test.skip('will not be run', t => {
404404
});
405405
```
406406

407-
You must specify the callback function.
407+
You must specify the implementation function.
408408

409409
### Test placeholders ("todo")
410410

411-
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 callback function.
411+
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.
412412

413413
```js
414414
test.todo('will think about writing this later');
@@ -698,24 +698,24 @@ $ ava --timeout=100 # 100 milliseconds
698698

699699
## API
700700

701-
### `test([title], callback)`
702-
### `test.serial([title], callback)`
703-
### `test.cb([title], callback)`
704-
### `test.only([title], callback)`
705-
### `test.skip([title], callback)`
701+
### `test([title], implementation)`
702+
### `test.serial([title], implementation)`
703+
### `test.cb([title], implementation)`
704+
### `test.only([title], implementation)`
705+
### `test.skip([title], implementation)`
706706
### `test.todo(title)`
707-
### `test.before([title], callback)`
708-
### `test.after([title], callback)`
709-
### `test.beforeEach([title], callback)`
710-
### `test.afterEach([title], callback)`
707+
### `test.before([title], implementation)`
708+
### `test.after([title], implementation)`
709+
### `test.beforeEach([title], implementation)`
710+
### `test.afterEach([title], implementation)`
711711

712712
#### `title`
713713

714714
Type: `string`
715715

716716
Test title.
717717

718-
#### `callback(t)`
718+
#### `implementation(t)`
719719

720720
Type: `function`
721721

@@ -725,7 +725,7 @@ Should contain the actual test.
725725

726726
Type: `object`
727727

728-
The execution object of a particular test. Each test callback 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.
728+
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.
729729

730730
###### `t.plan(count)`
731731

@@ -737,7 +737,7 @@ End the test. Only works with `test.cb()`.
737737

738738
## Assertions
739739

740-
Assertions are mixed into the [execution object](#t) provided to each test callback:
740+
Assertions are mixed into the [execution object](#t) provided to each test implementation:
741741

742742
```js
743743
test(t => {

test/runner.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ test('skip test', function (t) {
192192

193193
t.throws(function () {
194194
runner.skip('should be a todo');
195-
}, {message: 'Expected a function. Use `test.todo()` for tests without a function.'});
195+
}, {message: 'Expected an implementation. Use `test.todo()` for tests without an implementation.'});
196196

197197
runner.run({}).then(function () {
198198
t.is(runner.stats.testCount, 2);
@@ -210,7 +210,7 @@ test('test throws when given no function', function (t) {
210210

211211
t.throws(function () {
212212
runner.test();
213-
}, {message: 'Expected a function. Use `test.todo()` for tests without a function.'});
213+
}, {message: 'Expected an implementation. Use `test.todo()` for tests without an implementation.'});
214214
});
215215

216216
test('todo test', function (t) {

0 commit comments

Comments
 (0)