Skip to content

Commit 20973c8

Browse files
committed
test: tests for e2e plugins
1 parent 5fef42c commit 20973c8

File tree

6 files changed

+55
-0
lines changed

6 files changed

+55
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"rules": {
3+
"vue-libs/no-async-functions": 0
4+
}
5+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
jest.setTimeout(30000)
2+
3+
const create = require('@vue/cli-test-utils/createTestProject')
4+
5+
test('should work', async () => {
6+
const project = await create('e2e-cypress', {
7+
plugins: {
8+
'@vue/cli-plugin-babel': {},
9+
'@vue/cli-plugin-e2e-cypress': {}
10+
}
11+
})
12+
13+
const config = JSON.parse(await project.read('cypress.json'))
14+
config.videoRecording = false
15+
await project.write('cypress.json', JSON.stringify(config))
16+
17+
await project.run(`vue-cli-service e2e`)
18+
})

packages/@vue/cli-plugin-e2e-cypress/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ module.exports = (api, options) => {
2828
runner.on('exit', () => server.close())
2929
runner.on('error', () => server.close())
3030
}
31+
32+
if (process.env.VUE_CLI_TEST) {
33+
runner.on('exit', code => {
34+
process.exit(code)
35+
})
36+
}
37+
3138
return runner
3239
})
3340
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"rules": {
3+
"vue-libs/no-async-functions": 0
4+
}
5+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
jest.setTimeout(20000)
2+
3+
const create = require('@vue/cli-test-utils/createTestProject')
4+
5+
test('should work', async () => {
6+
const project = await create('e2e-nightwatch', {
7+
plugins: {
8+
'@vue/cli-plugin-babel': {},
9+
'@vue/cli-plugin-e2e-nightwatch': {}
10+
}
11+
})
12+
await project.run(`vue-cli-service e2e`)
13+
})

packages/@vue/cli-plugin-e2e-nightwatch/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ module.exports = (api, options) => {
3939
runner.on('exit', () => server.close())
4040
runner.on('error', () => server.close())
4141
}
42+
43+
if (process.env.VUE_CLI_TEST) {
44+
runner.on('exit', code => {
45+
process.exit(code)
46+
})
47+
}
48+
4249
return runner
4350
})
4451
})

0 commit comments

Comments
 (0)