Skip to content

Commit 589489d

Browse files
committed
Meta tweaks
Use tab indentation
1 parent f507e36 commit 589489d

11 files changed

+379
-389
lines changed

docs/recipes/babelrc.md

+49-44
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ You can override the default Babel configuration AVA uses for test transpilation
2121

2222
```json
2323
{
24-
"ava": {
25-
"babel": {
26-
"plugins": ["rewire"],
27-
"presets": ["@ava/stage-4", "stage-3"]
28-
}
29-
}
24+
"ava": {
25+
"babel": {
26+
"plugins": ["rewire"],
27+
"presets": ["@ava/stage-4", "stage-3"]
28+
}
29+
}
3030
}
3131
```
3232

@@ -40,11 +40,11 @@ You can enable `babel-polyfill` by adding it to AVA's `require` option:
4040

4141
```json
4242
{
43-
"ava": {
44-
"require": [
45-
"babel-polyfill"
46-
]
47-
}
43+
"ava": {
44+
"require": [
45+
"babel-polyfill"
46+
]
47+
}
4848
}
4949
```
5050

@@ -56,12 +56,12 @@ To transpile your sources, you will need to define a [`babel config` ](http://ba
5656

5757
```json
5858
{
59-
"ava": {
60-
"require": ["babel-register"]
61-
},
62-
"babel": {
63-
"presets": ["@ava/stage-4"]
64-
}
59+
"ava": {
60+
"require": ["babel-register"]
61+
},
62+
"babel": {
63+
"presets": ["@ava/stage-4"]
64+
}
6565
}
6666
```
6767

@@ -75,13 +75,16 @@ Using the `"inherit"` shortcut will cause your tests to be transpiled the same a
7575

7676
```json
7777
{
78-
"ava": {
79-
"require": "babel-register",
80-
"babel": "inherit"
81-
},
82-
"babel": {
83-
"presets": ["@ava/stage-4", "react"]
84-
}
78+
"ava": {
79+
"require": "babel-register",
80+
"babel": "inherit"
81+
},
82+
"babel": {
83+
"presets": [
84+
"@ava/stage-4",
85+
"react"
86+
]
87+
}
8588
}
8689
```
8790

@@ -97,17 +100,20 @@ When specifying the Babel config for your tests, you can set the `babelrc` optio
97100

98101
```json
99102
{
100-
"ava": {
101-
"require": "babel-register",
102-
"babel": {
103-
"babelrc": true,
104-
"plugins": ["custom-plugin-name"],
105-
"presets": ["custom-preset"]
106-
}
107-
},
108-
"babel": {
109-
"presets": ["@ava/stage-4", "react"]
110-
}
103+
"ava": {
104+
"require": "babel-register",
105+
"babel": {
106+
"babelrc": true,
107+
"plugins": ["custom-plugin-name"],
108+
"presets": ["custom-preset"]
109+
}
110+
},
111+
"babel": {
112+
"presets": [
113+
"@ava/stage-4",
114+
"react"
115+
]
116+
}
111117
}
112118
```
113119

@@ -117,21 +123,20 @@ AVA will only look for a `.babelrc` file in the same directory as the `package.j
117123

118124
## Extend an alternate config file.
119125

120-
121126
If, for some reason, your Babel config is not specified in one of the default locations ([`.babelrc` or `package.json`](http://babeljs.io/docs/usage/babelrc/), you can set the `extends` option to the alternate config you want to use during testing.
122127

123128
`package.json`:
124129

125130
```json
126131
{
127-
"ava": {
128-
"require": "babel-register",
129-
"babel": {
130-
"extends": "./babel-test-config.json",
131-
"plugins": ["custom-plugin-name"],
132-
"presets": ["custom-preset"]
133-
}
134-
}
132+
"ava": {
133+
"require": "babel-register",
134+
"babel": {
135+
"extends": "./babel-test-config.json",
136+
"plugins": ["custom-plugin-name"],
137+
"presets": ["custom-preset"]
138+
}
139+
}
135140
}
136141
```
137142

docs/recipes/browser-testing.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ Configure AVA to `require` the helper before every test file.
4747

4848
```json
4949
{
50-
"ava": {
51-
"require": [
52-
"./test/helpers/setup-browser-env.js"
53-
]
54-
}
50+
"ava": {
51+
"require": [
52+
"./test/helpers/setup-browser-env.js"
53+
]
54+
}
5555
}
5656
```
5757

docs/recipes/debugging-with-vscode.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ Add following to the `configurations` object:
1212

1313
```json
1414
{
15-
"type": "node",
16-
"request": "launch",
17-
"name": "Run AVA test",
18-
"program": "${workspaceRoot}/node_modules/ava/profile.js",
19-
"args": [
20-
"${file}"
21-
]
15+
"type": "node",
16+
"request": "launch",
17+
"name": "Run AVA test",
18+
"program": "${workspaceRoot}/node_modules/ava/profile.js",
19+
"args": [
20+
"${file}"
21+
]
2222
}
2323
```
2424

docs/recipes/jspm-systemjs.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Configure your .babelrc to work with AVA if you have not already. NOTE: You can
1414

1515
```json
1616
{
17-
"presets": ["es2015", "stage-2"]
17+
"presets": ["es2015", "stage-2"]
1818
}
1919
```
2020

@@ -32,12 +32,12 @@ You will also need to update your AVA config in package.json to use the JSPM loa
3232

3333
```json
3434
{
35-
"ava": {
36-
"require": [
37-
"babel-register",
38-
"ava-jspm-loader"
39-
]
40-
}
35+
"ava": {
36+
"require": [
37+
"babel-register",
38+
"ava-jspm-loader"
39+
]
40+
}
4141
}
4242
```
4343

@@ -49,8 +49,8 @@ Note that you will need to use `System.import` paths for all of your project fil
4949

5050
```js
5151
import test from 'ava';
52-
import main from 'app/main'; // maps to your JSPM config for "app/main.js"
53-
import BigNumber from 'bignumber.js'; // in jspm_packages
52+
import main from 'app/main'; // Maps to your JSPM config for "app/main.js"
53+
import BigNumber from 'bignumber.js'; // In jspm_packages
5454

5555
function fn() {
5656
return Promise.resolve(new BigNumber('1234567890.123456789'));

docs/recipes/react.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ The first step is setting up Babel to transpile JSX code from the tests by addin
88

99
```json
1010
{
11-
"ava": {
12-
"require": ["babel-register"],
13-
"babel": "inherit"
14-
},
15-
"babel": {
16-
"presets": ["react"]
17-
}
11+
"ava": {
12+
"require": ["babel-register"],
13+
"babel": "inherit"
14+
},
15+
"babel": {
16+
"presets": ["react"]
17+
}
1818
}
1919
```
2020

docs/recipes/typescript.md

+12-14
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ Add a `test` script in the `package.json` file. It will compile the project firs
2727

2828
```json
2929
{
30-
"scripts": {
31-
"test": "tsc && ava"
32-
}
30+
"scripts": {
31+
"test": "tsc && ava"
32+
}
3333
}
3434
```
3535

@@ -41,12 +41,10 @@ Create a `test.ts` file.
4141
```ts
4242
import test from 'ava';
4343

44-
async function fn() {
45-
return Promise.resolve('foo');
46-
}
44+
const fn = async () => Promise.resolve('foo');
4745

4846
test(async (t) => {
49-
t.is(await fn(), 'foo');
47+
t.is(await fn(), 'foo');
5048
});
5149
```
5250

@@ -58,25 +56,25 @@ By default, the type of `t.context` will be [`any`](https://www.typescriptlang.o
5856
import * as ava from 'ava';
5957

6058
function contextualize<T>(getContext: () => T): ava.RegisterContextual<T> {
61-
ava.test.beforeEach(t => {
62-
Object.assign(t.context, getContext());
63-
});
59+
ava.test.beforeEach(t => {
60+
Object.assign(t.context, getContext());
61+
});
6462

65-
return ava.test;
63+
return ava.test;
6664
}
6765

6866
const test = contextualize(() => ({ foo: 'bar' }));
6967

7068
test.beforeEach(t => {
71-
t.context.foo = 123; // error: Type '123' is not assignable to type 'string'
69+
t.context.foo = 123; // error: Type '123' is not assignable to type 'string'
7270
});
7371

7472
test.after.always.failing.cb.serial('very long chains are properly typed', t => {
75-
t.context.fooo = 'a value'; // error: Property 'fooo' does not exist on type '{ foo: string }'
73+
t.context.fooo = 'a value'; // error: Property 'fooo' does not exist on type '{ foo: string }'
7674
});
7775

7876
test('an actual test', t => {
79-
t.deepEqual(t.context.foo.map(c => c), ['b', 'a', 'r']); // error: Property 'map' does not exist on type 'string'
77+
t.deepEqual(t.context.foo.map(c => c), ['b', 'a', 'r']); // error: Property 'map' does not exist on type 'string'
8078
});
8179
```
8280

docs/recipes/watch-mode.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ If you've configured it in your `package.json` like this:
1616

1717
```json
1818
{
19-
"scripts": {
20-
"test": "ava"
21-
}
19+
"scripts": {
20+
"test": "ava"
21+
}
2222
}
2323
```
2424

@@ -32,10 +32,10 @@ You could also set up a special script:
3232

3333
```json
3434
{
35-
"scripts": {
36-
"test": "ava",
37-
"watch:test": "ava --watch"
38-
}
35+
"scripts": {
36+
"test": "ava",
37+
"watch:test": "ava --watch"
38+
}
3939
}
4040
```
4141

@@ -49,9 +49,9 @@ Finally you could configure AVA to *always* run in watch mode by setting the `wa
4949

5050
```json
5151
{
52-
"ava": {
53-
"watch": true
54-
}
52+
"ava": {
53+
"watch": true
54+
}
5555
}
5656
```
5757

license

+4-16
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
1-
The MIT License (MIT)
1+
MIT License
22

33
Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)
44

5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
5+
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:
116

12-
The above copyright notice and this permission notice shall be included in
13-
all copies or substantial portions of the Software.
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
148

15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21-
THE SOFTWARE.
9+
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.

0 commit comments

Comments
 (0)