@@ -10,48 +10,48 @@ import {
10
10
untilUpdated
11
11
} from '~utils'
12
12
13
- const url = `http://localhost:${ port } `
13
+ const url = `http://localhost:${ port } /test/ `
14
14
15
15
test ( 'vuex can be import succeed by named import' , async ( ) => {
16
16
// wait networkidle for dynamic optimize vuex
17
- await page . goto ( url + '/ store' , { waitUntil : 'networkidle' } )
17
+ await page . goto ( url + 'store' , { waitUntil : 'networkidle' } )
18
18
expect ( await page . textContent ( 'h1' ) ) . toMatch ( 'bar' )
19
19
20
20
// raw http request
21
- const storeHtml = await ( await fetch ( url + '/ store' ) ) . text ( )
21
+ const storeHtml = await ( await fetch ( url + 'store' ) ) . text ( )
22
22
expect ( storeHtml ) . toMatch ( 'bar' )
23
23
} )
24
24
25
25
test ( '/about' , async ( ) => {
26
- await page . goto ( url + '/ about' )
26
+ await page . goto ( url + 'about' )
27
27
expect ( await page . textContent ( 'h1' ) ) . toMatch ( 'About' )
28
28
// should not have hydration mismatch
29
29
browserLogs . forEach ( ( msg ) => {
30
30
expect ( msg ) . not . toMatch ( 'mismatch' )
31
31
} )
32
32
33
33
// fetch sub route
34
- const aboutHtml = await ( await fetch ( url + '/ about' ) ) . text ( )
34
+ const aboutHtml = await ( await fetch ( url + 'about' ) ) . text ( )
35
35
expect ( aboutHtml ) . toMatch ( 'About' )
36
36
if ( isBuild ) {
37
37
// assert correct preload directive generation for async chunks and CSS
38
38
expect ( aboutHtml ) . not . toMatch (
39
- / l i n k r e l = " m o d u l e p r e l o a d " .* ?h r e f = " \/ a s s e t s \/ H o m e \. \w { 8 } \. j s " /
39
+ / l i n k r e l = " m o d u l e p r e l o a d " .* ?h r e f = " \/ t e s t \/ a s s e t s \/ H o m e \. \w { 8 } \. j s " /
40
40
)
41
41
expect ( aboutHtml ) . not . toMatch (
42
- / l i n k r e l = " s t y l e s h e e t " .* ?h r e f = " \/ a s s e t s \/ H o m e \. \w { 8 } \. c s s " /
42
+ / l i n k r e l = " s t y l e s h e e t " .* ?h r e f = " \/ t e s t \/ a s s e t s \/ H o m e \. \w { 8 } \. c s s " /
43
43
)
44
44
expect ( aboutHtml ) . toMatch (
45
- / l i n k r e l = " m o d u l e p r e l o a d " .* ?h r e f = " \/ a s s e t s \/ A b o u t \. \w { 8 } \. j s " /
45
+ / l i n k r e l = " m o d u l e p r e l o a d " .* ?h r e f = " \/ t e s t \/ a s s e t s \/ A b o u t \. \w { 8 } \. j s " /
46
46
)
47
47
expect ( aboutHtml ) . toMatch (
48
- / l i n k r e l = " s t y l e s h e e t " .* ?h r e f = " \/ a s s e t s \/ A b o u t \. \w { 8 } \. c s s " /
48
+ / l i n k r e l = " s t y l e s h e e t " .* ?h r e f = " \/ t e s t \/ a s s e t s \/ A b o u t \. \w { 8 } \. c s s " /
49
49
)
50
50
}
51
51
} )
52
52
53
53
test ( '/external' , async ( ) => {
54
- await page . goto ( url + '/ external' )
54
+ await page . goto ( url + 'external' )
55
55
expect ( await page . textContent ( 'div' ) ) . toMatch (
56
56
'Example external component content'
57
57
)
@@ -61,18 +61,18 @@ test('/external', async () => {
61
61
} )
62
62
63
63
// fetch sub route
64
- const externalHtml = await ( await fetch ( url + '/ external' ) ) . text ( )
64
+ const externalHtml = await ( await fetch ( url + 'external' ) ) . text ( )
65
65
expect ( externalHtml ) . toMatch ( 'Example external component content' )
66
66
if ( isBuild ) {
67
67
// assert correct preload directive generation for async chunks and CSS
68
68
expect ( externalHtml ) . not . toMatch (
69
- / l i n k r e l = " m o d u l e p r e l o a d " .* ?h r e f = " \/ a s s e t s \/ H o m e \. \w { 8 } \. j s " /
69
+ / l i n k r e l = " m o d u l e p r e l o a d " .* ?h r e f = " \/ t e s t \/ a s s e t s \/ H o m e \. \w { 8 } \. j s " /
70
70
)
71
71
expect ( externalHtml ) . not . toMatch (
72
- / l i n k r e l = " s t y l e s h e e t " .* ?h r e f = " \/ a s s e t s \/ H o m e \. \w { 8 } \. c s s " /
72
+ / l i n k r e l = " s t y l e s h e e t " .* ?h r e f = " \/ t e s t \/ a s s e t s \/ H o m e \. \w { 8 } \. c s s " /
73
73
)
74
74
expect ( externalHtml ) . toMatch (
75
- / l i n k r e l = " m o d u l e p r e l o a d " .* ?h r e f = " \/ a s s e t s \/ E x t e r n a l \. \w { 8 } \. j s " /
75
+ / l i n k r e l = " m o d u l e p r e l o a d " .* ?h r e f = " \/ t e s t \/ a s s e t s \/ E x t e r n a l \. \w { 8 } \. j s " /
76
76
)
77
77
}
78
78
} )
@@ -90,23 +90,23 @@ test('/', async () => {
90
90
if ( isBuild ) {
91
91
// assert correct preload directive generation for async chunks and CSS
92
92
expect ( html ) . toMatch (
93
- / l i n k r e l = " m o d u l e p r e l o a d " .* ?h r e f = " \/ a s s e t s \/ H o m e \. \w { 8 } \. j s " /
93
+ / l i n k r e l = " m o d u l e p r e l o a d " .* ?h r e f = " \/ t e s t \/ a s s e t s \/ H o m e \. \w { 8 } \. j s " /
94
94
)
95
95
expect ( html ) . toMatch (
96
- / l i n k r e l = " s t y l e s h e e t " .* ?h r e f = " \/ a s s e t s \/ H o m e \. \w { 8 } \. c s s " /
96
+ / l i n k r e l = " s t y l e s h e e t " .* ?h r e f = " \/ t e s t \/ a s s e t s \/ H o m e \. \w { 8 } \. c s s " /
97
97
)
98
98
// JSX component preload registration
99
99
expect ( html ) . toMatch (
100
- / l i n k r e l = " m o d u l e p r e l o a d " .* ?h r e f = " \/ a s s e t s \/ F o o \. \w { 8 } \. j s " /
100
+ / l i n k r e l = " m o d u l e p r e l o a d " .* ?h r e f = " \/ t e s t \/ a s s e t s \/ F o o \. \w { 8 } \. j s " /
101
101
)
102
102
expect ( html ) . toMatch (
103
- / l i n k r e l = " s t y l e s h e e t " .* ?h r e f = " \/ a s s e t s \/ F o o \. \w { 8 } \. c s s " /
103
+ / l i n k r e l = " s t y l e s h e e t " .* ?h r e f = " \/ t e s t \/ a s s e t s \/ F o o \. \w { 8 } \. c s s " /
104
104
)
105
105
expect ( html ) . not . toMatch (
106
- / l i n k r e l = " m o d u l e p r e l o a d " .* ?h r e f = " \/ a s s e t s \/ A b o u t \. \w { 8 } \. j s " /
106
+ / l i n k r e l = " m o d u l e p r e l o a d " .* ?h r e f = " \/ t e s t \/ a s s e t s \/ A b o u t \. \w { 8 } \. j s " /
107
107
)
108
108
expect ( html ) . not . toMatch (
109
- / l i n k r e l = " s t y l e s h e e t " .* ?h r e f = " \/ a s s e t s \/ A b o u t \. \w { 8 } \. c s s " /
109
+ / l i n k r e l = " s t y l e s h e e t " .* ?h r e f = " \/ t e s t \/ a s s e t s \/ A b o u t \. \w { 8 } \. c s s " /
110
110
)
111
111
}
112
112
} )
@@ -132,7 +132,7 @@ test('asset', async () => {
132
132
} )
133
133
const img = await page . $ ( 'img' )
134
134
expect ( await img . getAttribute ( 'src' ) ) . toMatch (
135
- isBuild ? / \/ a s s e t s \/ l o g o \. \w { 8 } \. p n g / : '/src/assets/logo.png'
135
+ isBuild ? / \/ t e s t \/ a s s e t s \/ l o g o \. \w { 8 } \. p n g / : '/src/assets/logo.png'
136
136
)
137
137
} )
138
138
@@ -166,13 +166,13 @@ test('hmr', async () => {
166
166
167
167
test ( 'client navigation' , async ( ) => {
168
168
await page . goto ( url )
169
- await untilUpdated ( ( ) => page . textContent ( 'a[href="/about"]' ) , 'About' )
170
- await page . click ( 'a[href="/about"]' )
169
+ await untilUpdated ( ( ) => page . textContent ( 'a[href="/test/ about"]' ) , 'About' )
170
+ await page . click ( 'a[href="/test/ about"]' )
171
171
await untilUpdated ( ( ) => page . textContent ( 'h1' ) , 'About' )
172
172
editFile ( 'src/pages/About.vue' , ( code ) => code . replace ( 'About' , 'changed' ) )
173
173
await untilUpdated ( ( ) => page . textContent ( 'h1' ) , 'changed' )
174
- await page . click ( 'a[href="/"]' )
175
- await untilUpdated ( ( ) => page . textContent ( 'a[href="/"]' ) , 'Home' )
174
+ await page . click ( 'a[href="/test/ "]' )
175
+ await untilUpdated ( ( ) => page . textContent ( 'a[href="/test/ "]' ) , 'Home' )
176
176
} )
177
177
178
178
test ( 'import.meta.url' , async ( ) => {
@@ -183,7 +183,8 @@ test('import.meta.url', async () => {
183
183
test . runIf ( isBuild ) ( 'dynamic css file should be preloaded' , async ( ) => {
184
184
await page . goto ( url )
185
185
const homeHtml = await ( await fetch ( url ) ) . text ( )
186
- const re = / l i n k r e l = " m o d u l e p r e l o a d " .* ?h r e f = " \/ a s s e t s \/ ( H o m e \. \w { 8 } \. j s ) " /
186
+ const re =
187
+ / l i n k r e l = " m o d u l e p r e l o a d " .* ?h r e f = " \/ t e s t \/ a s s e t s \/ ( H o m e \. \w { 8 } \. j s ) " /
187
188
const filename = re . exec ( homeHtml ) [ 1 ]
188
189
const manifest = require ( resolve (
189
190
process . cwd ( ) ,
0 commit comments