Skip to content

Commit 9a438d5

Browse files
committed
test: test serve inline entry
1 parent 05f9f3a commit 9a438d5

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

packages/@vue/cli-service/__tests__/serve.spec.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
jest.setTimeout(30000)
1+
jest.setTimeout(45000)
22

33
const { defaultPreset } = require('@vue/cli/lib/options')
44
const create = require('@vue/cli-test-utils/createTestProject')
@@ -46,3 +46,29 @@ test('serve with router', async () => {
4646
}
4747
)
4848
})
49+
50+
test('serve with inline entry', async () => {
51+
const project = await create('e2e-serve-inline-entry', defaultPreset)
52+
53+
const path = require('path')
54+
const fs = require('fs-extra')
55+
await fs.move(
56+
path.resolve(project.dir, 'src/main.js'),
57+
path.resolve(project.dir, 'src/index.js')
58+
)
59+
60+
await serve(
61+
() => project.run('vue-cli-service serve src/index.js'),
62+
async ({ nextUpdate, helpers }) => {
63+
const msg = `Welcome to Your Vue.js App`
64+
expect(await helpers.getText('h1')).toMatch(msg)
65+
66+
// test hot reload
67+
const file = await project.read(`src/App.vue`)
68+
project.write(`src/App.vue`, file.replace(msg, `Updated`))
69+
await nextUpdate() // wait for child stdout update signal
70+
await sleep(1000) // give the client time to update
71+
expect(await helpers.getText('h1')).toMatch(`Updated`)
72+
}
73+
)
74+
})

0 commit comments

Comments
 (0)