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
{{ message }}
This repository was archived by the owner on Sep 3, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: en/guide/development-tools.md
+11-7
Original file line number
Diff line number
Diff line change
@@ -7,14 +7,15 @@ description: Nuxt.js helps you to make your web development enjoyable.
7
7
8
8
## End-to-End Testing
9
9
10
-
[Ava](https://github.com/avajs/ava) is a powerful JavaScript testing framework, mixed with [jsdom](https://github.com/tmpvar/jsdom), we can use them to do end-to-end testing easily.
10
+
[AVA](https://github.com/avajs/ava) is a powerful JavaScript testing framework, mixed with [jsdom](https://github.com/tmpvar/jsdom), we can use them to do end-to-end testing easily.
11
+
12
+
First, we need to add AVA and jsdom as development dependencies:
11
13
12
-
First, we need to add ava and jsdom as development dependencies:
13
14
```bash
14
15
npm install --save-dev ava jsdom
15
16
```
16
17
17
-
And add a test script to our `package.json` and configure ava to compile files that we import into our tests.
18
+
Then add a test script to our `package.json` and configure AVA to compile files that we import into our tests.
18
19
19
20
```javascript
20
21
"scripts": {
@@ -33,11 +34,13 @@ And add a test script to our `package.json` and configure ava to compile files t
33
34
```
34
35
35
36
We are going to write our tests in the `test` folder:
37
+
36
38
```bash
37
39
mkdir test
38
40
```
39
41
40
42
Let's say we have a page in `pages/index.vue`:
43
+
41
44
```html
42
45
<template>
43
46
<h1class="red">Hello {{ name }}!</h1>
@@ -58,7 +61,7 @@ export default {
58
61
</style>
59
62
```
60
63
61
-
When we launch our app with `npm run dev` and open [http://localhost:3000](http://localhost:3000), we can see our red `Hello world!` title.
64
+
When we launch our app with `npm run dev` and open http://localhost:3000, we can see our red `Hello world!` title.
62
65
63
66
We add our test file `test/index.test.js`:
64
67
@@ -67,7 +70,7 @@ import test from 'ava'
67
70
import { Nuxt, Builder } from'nuxt'
68
71
import { resolve } from'path'
69
72
70
-
// We keep a reference to nuxt so we can close
73
+
// We keep a reference to Nuxt so we can close
71
74
// the server at the end of the test
72
75
let nuxt =null
73
76
@@ -90,7 +93,7 @@ test('Route / exits and render HTML', async t => {
0 commit comments