Skip to content
TypeScript

test(web): ChatView's React Compiler check no longer times out on slow CI runners (#22649)

Theo Browne4f651cb10d2a
diff --git a/apps/web/src/reactCompilerCoverage.test.ts b/apps/web/src/reactCompilerCoverage.test.ts
index 1d43c9e38b0..f0e479d2710 100644
--- a/apps/web/src/reactCompilerCoverage.test.ts
+++ b/apps/web/src/reactCompilerCoverage.test.ts
@@ -18,16 +18,24 @@ const webSourceFiles = NodeFS.readdirSync(NodePath.join(repoRoot, "apps/web/src"
.filter((file) => !file.endsWith(".gen.ts"))
.map((file) => `apps/web/src/${file}`);
+// ChatView is ~9k lines. Compiling it takes ~9s on a fast machine and passes the
+// 15s project timeout on loaded CI runners.
+const slowFiles = new Set(["apps/web/src/components/ChatView.tsx"]);
+
+const compile = async (file: string) => {
+ const absolute = NodePath.join(repoRoot, file);
+ const result = await transform(absolute, NodeFS.readFileSync(absolute, "utf8"), {
+ jsx: { runtime: "automatic", development: false, refresh: false },
+ reactCompiler: { reportDiagnostics: true },
+ });
+ const bailouts = result.errors.map((error) => error.codeframe ?? error.message);
+ expect(bailouts).toEqual([]);
+};
+
// Lint reports most compiler bailouts, but not every one (try/finally, throw
// inside try). A skipped file still builds, just unmemoized, so check the output.
describe("React Compiler coverage", () => {
- it.each(webSourceFiles)("compiles %s", async (file) => {
- const absolute = NodePath.join(repoRoot, file);
- const result = await transform(absolute, NodeFS.readFileSync(absolute, "utf8"), {
- jsx: { runtime: "automatic", development: false, refresh: false },
- reactCompiler: { reportDiagnostics: true },
- });
- const bailouts = result.errors.map((error) => error.codeframe ?? error.message);
- expect(bailouts).toEqual([]);
- });
+ it.each(webSourceFiles.filter((file) => !slowFiles.has(file)))("compiles %s", compile);
+ // oxlint-disable-next-line t3code/no-test-timeout-or-unreasoned-skip -- CPU-bound compile of a huge file, not a hidden wait.
+ it.each([...slowFiles])("compiles %s", compile, 60_000);
});