You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/recipes/babelrc.md
+49-44
Original file line number
Diff line number
Diff line change
@@ -21,12 +21,12 @@ You can override the default Babel configuration AVA uses for test transpilation
21
21
22
22
```json
23
23
{
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
+
}
30
30
}
31
31
```
32
32
@@ -40,11 +40,11 @@ You can enable `babel-polyfill` by adding it to AVA's `require` option:
40
40
41
41
```json
42
42
{
43
-
"ava": {
44
-
"require": [
45
-
"babel-polyfill"
46
-
]
47
-
}
43
+
"ava": {
44
+
"require": [
45
+
"babel-polyfill"
46
+
]
47
+
}
48
48
}
49
49
```
50
50
@@ -56,12 +56,12 @@ To transpile your sources, you will need to define a [`babel config` ](http://ba
56
56
57
57
```json
58
58
{
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
+
}
65
65
}
66
66
```
67
67
@@ -75,13 +75,16 @@ Using the `"inherit"` shortcut will cause your tests to be transpiled the same a
75
75
76
76
```json
77
77
{
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
+
}
85
88
}
86
89
```
87
90
@@ -97,17 +100,20 @@ When specifying the Babel config for your tests, you can set the `babelrc` optio
97
100
98
101
```json
99
102
{
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
+
}
111
117
}
112
118
```
113
119
@@ -117,21 +123,20 @@ AVA will only look for a `.babelrc` file in the same directory as the `package.j
117
123
118
124
## Extend an alternate config file.
119
125
120
-
121
126
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.
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:
11
6
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.
14
8
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