@@ -15,6 +15,7 @@ type TestCase = {
15
15
skipTypecheck ?: boolean ;
16
16
wantConfigNotFoundError ?: boolean ;
17
17
wantBadConfigError ?: boolean ;
18
+ wantCompilationError ?: boolean ;
18
19
} ;
19
20
20
21
const allTestCases : TestCase [ ] = [
@@ -60,7 +61,13 @@ if (testCases.length > 0) {
60
61
61
62
describe . each ( testCases ) (
62
63
"fixture $name" ,
63
- async ( { name, skipTypecheck, wantConfigNotFoundError, wantBadConfigError } : TestCase ) => {
64
+ async ( {
65
+ name,
66
+ skipTypecheck,
67
+ wantConfigNotFoundError,
68
+ wantBadConfigError,
69
+ wantCompilationError,
70
+ } : TestCase ) => {
64
71
const fixtureDir = resolve ( join ( process . cwd ( ) , "e2e/fixtures" , name ) ) ;
65
72
66
73
beforeAll ( async ( ) => {
@@ -154,22 +161,32 @@ if (testCases.length > 0) {
154
161
let workerMetadata : Metafile [ "outputs" ] [ "out/stdin.js" ] ;
155
162
156
163
test (
157
- "compiles" ,
164
+ wantCompilationError ? "does not compile" : "compiles" ,
158
165
async ( ) => {
159
166
expect ( global . resolvedConfig . status ) . not . toBe ( "error" ) ;
160
167
161
- await expect (
168
+ const expectation = expect (
162
169
( async ( ) => {
163
170
const { entryPointMetaOutput, metaOutput } = await compile ( {
164
171
resolvedConfig : global . resolvedConfig ,
165
172
} ) ;
166
173
entrypointMetadata = entryPointMetaOutput ;
167
174
workerMetadata = metaOutput ;
168
175
} ) ( )
169
- ) . resolves . not . toThrowError ( ) ;
176
+ ) ;
177
+
178
+ if ( wantCompilationError ) {
179
+ await expectation . rejects . toThrowError ( ) ;
180
+ } else {
181
+ await expectation . resolves . not . toThrowError ( ) ;
182
+ }
170
183
} ,
171
184
{ timeout : 60_000 }
172
185
) ;
186
+
187
+ describe . skipIf ( wantCompilationError ) ( "with successful compilation" , ( ) => {
188
+ test . todo ( "dependencies handling" ) ;
189
+ } ) ;
173
190
} ) ;
174
191
}
175
192
) ;
0 commit comments