@@ -15,7 +15,7 @@ test('types', () => () => {
15
15
16
16
test ( 'defaults' , async ( ) => {
17
17
const plugin = await mockPlugin ( ) ;
18
- const opts = plugin . normalizeOptions ( ) ;
18
+ const opts = await plugin . normalizeOptions ( ) ;
19
19
assert . deepEqual ( opts . target , 'client' ) ;
20
20
assert . deepEqual ( opts . buildMode , 'development' ) ;
21
21
assert . deepEqual ( opts . entryStrategy , { type : 'segment' } ) ;
@@ -31,7 +31,7 @@ test('defaults', async () => {
31
31
32
32
test ( 'defaults (buildMode: production)' , async ( ) => {
33
33
const plugin = await mockPlugin ( ) ;
34
- const opts = plugin . normalizeOptions ( { buildMode : 'production' } ) ;
34
+ const opts = await plugin . normalizeOptions ( { buildMode : 'production' } ) ;
35
35
assert . deepEqual ( opts . target , 'client' ) ;
36
36
assert . deepEqual ( opts . buildMode , 'production' ) ;
37
37
assert . deepEqual ( opts . entryStrategy , { type : 'smart' } ) ;
@@ -49,7 +49,7 @@ test('defaults (buildMode: production)', async () => {
49
49
50
50
test ( 'defaults (target: ssr)' , async ( ) => {
51
51
const plugin = await mockPlugin ( ) ;
52
- const opts = plugin . normalizeOptions ( { target : 'ssr' } ) ;
52
+ const opts = await plugin . normalizeOptions ( { target : 'ssr' } ) ;
53
53
assert . deepEqual ( opts . target , 'ssr' ) ;
54
54
assert . deepEqual ( opts . buildMode , 'development' ) ;
55
55
assert . deepEqual ( opts . entryStrategy , { type : 'hoist' } ) ;
@@ -66,7 +66,7 @@ test('defaults (target: ssr)', async () => {
66
66
67
67
test ( 'defaults (buildMode: production, target: ssr)' , async ( ) => {
68
68
const plugin = await mockPlugin ( ) ;
69
- const opts = plugin . normalizeOptions ( { buildMode : 'production' , target : 'ssr' } ) ;
69
+ const opts = await plugin . normalizeOptions ( { buildMode : 'production' , target : 'ssr' } ) ;
70
70
assert . deepEqual ( opts . target , 'ssr' ) ;
71
71
assert . deepEqual ( opts . buildMode , 'production' ) ;
72
72
assert . deepEqual ( opts . entryStrategy , { type : 'hoist' } ) ;
@@ -83,19 +83,19 @@ test('defaults (buildMode: production, target: ssr)', async () => {
83
83
84
84
test ( 'debug true' , async ( ) => {
85
85
const plugin = await mockPlugin ( ) ;
86
- const opts = plugin . normalizeOptions ( { debug : true } ) ;
86
+ const opts = await plugin . normalizeOptions ( { debug : true } ) ;
87
87
assert . deepEqual ( opts . debug , true ) ;
88
88
} ) ;
89
89
90
90
test ( 'csr' , async ( ) => {
91
91
const plugin = await mockPlugin ( ) ;
92
- const opts = plugin . normalizeOptions ( { csr : true } ) ;
92
+ const opts = await plugin . normalizeOptions ( { csr : true } ) ;
93
93
assert . deepEqual ( opts . outDir , '' ) ;
94
94
} ) ;
95
95
96
96
test ( 'override entryStrategy' , async ( ) => {
97
97
const plugin = await mockPlugin ( ) ;
98
- const opts = plugin . normalizeOptions ( {
98
+ const opts = await plugin . normalizeOptions ( {
99
99
entryStrategy : { type : 'component' } ,
100
100
buildMode : 'production' ,
101
101
} ) ;
@@ -104,21 +104,21 @@ test('override entryStrategy', async () => {
104
104
105
105
test ( 'entryStrategy, smart' , async ( ) => {
106
106
const plugin = await mockPlugin ( ) ;
107
- const opts = plugin . normalizeOptions ( {
107
+ const opts = await plugin . normalizeOptions ( {
108
108
entryStrategy : { type : 'smart' } ,
109
109
} ) ;
110
110
assert . deepEqual ( opts . entryStrategy . type , 'smart' ) ;
111
111
} ) ;
112
112
113
113
test ( 'entryStrategy, segment no forceFullBuild' , async ( ) => {
114
114
const plugin = await mockPlugin ( ) ;
115
- const opts = plugin . normalizeOptions ( { entryStrategy : { type : 'segment' } } ) ;
115
+ const opts = await plugin . normalizeOptions ( { entryStrategy : { type : 'segment' } } ) ;
116
116
assert . deepEqual ( opts . entryStrategy . type , 'segment' ) ;
117
117
} ) ;
118
118
119
119
test ( 'entryStrategy, segment and srcInputs' , async ( ) => {
120
120
const plugin = await mockPlugin ( ) ;
121
- const opts = plugin . normalizeOptions ( {
121
+ const opts = await plugin . normalizeOptions ( {
122
122
entryStrategy : { type : 'segment' } ,
123
123
} ) ;
124
124
assert . deepEqual ( opts . entryStrategy . type , 'segment' ) ;
@@ -127,42 +127,42 @@ test('entryStrategy, segment and srcInputs', async () => {
127
127
test ( 'rootDir, abs path' , async ( ) => {
128
128
const plugin = await mockPlugin ( ) ;
129
129
const customRoot = normalizePath ( resolve ( cwd , 'abs-path' ) ) ;
130
- const opts = plugin . normalizeOptions ( { rootDir : customRoot } ) ;
130
+ const opts = await plugin . normalizeOptions ( { rootDir : customRoot } ) ;
131
131
assert . deepEqual ( opts . rootDir , customRoot ) ;
132
132
} ) ;
133
133
134
134
test ( 'rootDir, rel path' , async ( ) => {
135
135
const plugin = await mockPlugin ( ) ;
136
136
const customRoot = 'rel-path' ;
137
- const opts = plugin . normalizeOptions ( { rootDir : customRoot } ) ;
137
+ const opts = await plugin . normalizeOptions ( { rootDir : customRoot } ) ;
138
138
assert . deepEqual ( opts . rootDir , normalizePath ( resolve ( cwd , customRoot ) ) ) ;
139
139
} ) ;
140
140
141
141
test ( 'tsconfigFileNames' , async ( ) => {
142
142
const plugin = await mockPlugin ( ) ;
143
- const opts = plugin . normalizeOptions ( {
143
+ const opts = await plugin . normalizeOptions ( {
144
144
tsconfigFileNames : [ './tsconfig.json' , './tsconfig.app.json' ] ,
145
145
} ) ;
146
146
assert . deepEqual ( opts . tsconfigFileNames , [ './tsconfig.json' , './tsconfig.app.json' ] ) ;
147
147
} ) ;
148
148
149
149
test ( 'tsconfigFileNames, empty array fallback to default' , async ( ) => {
150
150
const plugin = await mockPlugin ( ) ;
151
- const opts = plugin . normalizeOptions ( {
151
+ const opts = await plugin . normalizeOptions ( {
152
152
tsconfigFileNames : [ ] ,
153
153
} ) ;
154
154
assert . deepEqual ( opts . tsconfigFileNames , [ './tsconfig.json' ] ) ;
155
155
} ) ;
156
156
157
157
test ( 'input string' , async ( ) => {
158
158
const plugin = await mockPlugin ( ) ;
159
- const opts = plugin . normalizeOptions ( { input : 'src/cmps/main.tsx' } ) ;
159
+ const opts = await plugin . normalizeOptions ( { input : 'src/cmps/main.tsx' } ) ;
160
160
assert . deepEqual ( opts . input , [ normalizePath ( resolve ( cwd , 'src' , 'cmps' , 'main.tsx' ) ) ] ) ;
161
161
} ) ;
162
162
163
163
test ( 'input array' , async ( ) => {
164
164
const plugin = await mockPlugin ( ) ;
165
- const opts = plugin . normalizeOptions ( {
165
+ const opts = await plugin . normalizeOptions ( {
166
166
input : [ 'src/cmps/a.tsx' , 'src/cmps/b.tsx' ] ,
167
167
} ) ;
168
168
assert . deepEqual ( opts . input , [
@@ -173,14 +173,14 @@ test('input array', async () => {
173
173
174
174
test ( 'outDir' , async ( ) => {
175
175
const plugin = await mockPlugin ( ) ;
176
- const opts = plugin . normalizeOptions ( { outDir : 'out' } ) ;
176
+ const opts = await plugin . normalizeOptions ( { outDir : 'out' } ) ;
177
177
assert . deepEqual ( opts . outDir , normalizePath ( resolve ( cwd , 'out' ) ) ) ;
178
178
} ) ;
179
179
180
180
test ( 'manifestOutput' , async ( ) => {
181
181
const plugin = await mockPlugin ( ) ;
182
182
const manifestOutput = ( ) => { } ;
183
- const opts = plugin . normalizeOptions ( { manifestOutput } ) ;
183
+ const opts = await plugin . normalizeOptions ( { manifestOutput } ) ;
184
184
assert . deepEqual ( opts . manifestOutput , manifestOutput ) ;
185
185
} ) ;
186
186
@@ -193,19 +193,19 @@ test('manifestInput', async () => {
193
193
bundles : { } ,
194
194
version : '1' ,
195
195
} ;
196
- const opts = plugin . normalizeOptions ( { manifestInput } ) ;
196
+ const opts = await plugin . normalizeOptions ( { manifestInput } ) ;
197
197
assert . deepEqual ( opts . manifestInput , manifestInput ) ;
198
198
} ) ;
199
199
200
200
test ( 'resolveQwikBuild true' , async ( ) => {
201
201
const plugin = await mockPlugin ( ) ;
202
- const opts = plugin . normalizeOptions ( { resolveQwikBuild : true } ) ;
202
+ const opts = await plugin . normalizeOptions ( { resolveQwikBuild : true } ) ;
203
203
assert . deepEqual ( opts . resolveQwikBuild , true ) ;
204
204
} ) ;
205
205
206
206
test ( 'resolveQwikBuild false' , async ( ) => {
207
207
const plugin = await mockPlugin ( ) ;
208
- const opts = plugin . normalizeOptions ( { resolveQwikBuild : false } ) ;
208
+ const opts = await plugin . normalizeOptions ( { resolveQwikBuild : false } ) ;
209
209
assert . deepEqual ( opts . resolveQwikBuild , false ) ;
210
210
} ) ;
211
211
@@ -216,7 +216,7 @@ test('experimental[]', async () => {
216
216
// we can't test this without a flag
217
217
return ;
218
218
}
219
- const opts = plugin . normalizeOptions ( { experimental : [ flag ] } ) ;
219
+ const opts = await plugin . normalizeOptions ( { experimental : [ flag ] } ) ;
220
220
assert . deepEqual ( opts . experimental , { [ flag ] : true } as any ) ;
221
221
} ) ;
222
222
0 commit comments