Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit aa5f068

Browse files
authored
Merge pull request #263 from Haeresis/deployment-tools
[Doc EN]: `development-tools.md` review.
2 parents 4e30e08 + f545bb1 commit aa5f068

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

en/guide/development-tools.md

+11-7
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ description: Nuxt.js helps you to make your web development enjoyable.
77
88
## End-to-End Testing
99

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:
1113

12-
First, we need to add ava and jsdom as development dependencies:
1314
```bash
1415
npm install --save-dev ava jsdom
1516
```
1617

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.
1819

1920
```javascript
2021
"scripts": {
@@ -33,11 +34,13 @@ And add a test script to our `package.json` and configure ava to compile files t
3334
```
3435

3536
We are going to write our tests in the `test` folder:
37+
3638
```bash
3739
mkdir test
3840
```
3941

4042
Let's say we have a page in `pages/index.vue`:
43+
4144
```html
4245
<template>
4346
<h1 class="red">Hello {{ name }}!</h1>
@@ -58,7 +61,7 @@ export default {
5861
</style>
5962
```
6063

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.
6265

6366
We add our test file `test/index.test.js`:
6467

@@ -67,7 +70,7 @@ import test from 'ava'
6770
import { Nuxt, Builder } from 'nuxt'
6871
import { resolve } from 'path'
6972

70-
// We keep a reference to nuxt so we can close
73+
// We keep a reference to Nuxt so we can close
7174
// the server at the end of the test
7275
let nuxt = null
7376

@@ -90,7 +93,7 @@ test('Route / exits and render HTML', async t => {
9093
t.true(html.includes('<h1 class="red">Hello world!</h1>'))
9194
})
9295

93-
// Example of testing via dom checking
96+
// Example of testing via DOM checking
9497
test('Route / exits and render HTML with CSS applied', async t => {
9598
const window = await nuxt.renderAndGetWindow('http://localhost:4000/')
9699
const element = window.document.querySelector('.red')
@@ -100,13 +103,14 @@ test('Route / exits and render HTML with CSS applied', async t => {
100103
t.is(window.getComputedStyle(element).color, 'red')
101104
})
102105

103-
// Close the nuxt server
106+
// Close the Nuxt server
104107
test.after('Closing server', t => {
105108
nuxt.close()
106109
})
107110
```
108111

109112
We can now launch our tests:
113+
110114
```bash
111115
npm test
112116
```

0 commit comments

Comments
 (0)