Skip to content

Commit 3080a84

Browse files
committed
Add wantCompilationError option
1 parent 8076648 commit 3080a84

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

packages/cli-v3/e2e/index.test.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type TestCase = {
1515
skipTypecheck?: boolean;
1616
wantConfigNotFoundError?: boolean;
1717
wantBadConfigError?: boolean;
18+
wantCompilationError?: boolean;
1819
};
1920

2021
const allTestCases: TestCase[] = [
@@ -60,7 +61,13 @@ if (testCases.length > 0) {
6061

6162
describe.each(testCases)(
6263
"fixture $name",
63-
async ({ name, skipTypecheck, wantConfigNotFoundError, wantBadConfigError }: TestCase) => {
64+
async ({
65+
name,
66+
skipTypecheck,
67+
wantConfigNotFoundError,
68+
wantBadConfigError,
69+
wantCompilationError,
70+
}: TestCase) => {
6471
const fixtureDir = resolve(join(process.cwd(), "e2e/fixtures", name));
6572

6673
beforeAll(async () => {
@@ -154,22 +161,32 @@ if (testCases.length > 0) {
154161
let workerMetadata: Metafile["outputs"]["out/stdin.js"];
155162

156163
test(
157-
"compiles",
164+
wantCompilationError ? "does not compile" : "compiles",
158165
async () => {
159166
expect(global.resolvedConfig.status).not.toBe("error");
160167

161-
await expect(
168+
const expectation = expect(
162169
(async () => {
163170
const { entryPointMetaOutput, metaOutput } = await compile({
164171
resolvedConfig: global.resolvedConfig,
165172
});
166173
entrypointMetadata = entryPointMetaOutput;
167174
workerMetadata = metaOutput;
168175
})()
169-
).resolves.not.toThrowError();
176+
);
177+
178+
if (wantCompilationError) {
179+
await expectation.rejects.toThrowError();
180+
} else {
181+
await expectation.resolves.not.toThrowError();
182+
}
170183
},
171184
{ timeout: 60_000 }
172185
);
186+
187+
describe.skipIf(wantCompilationError)("with successful compilation", () => {
188+
test.todo("dependencies handling");
189+
});
173190
});
174191
}
175192
);

0 commit comments

Comments
 (0)