Skip to content

Commit 8d23a5a

Browse files
test(compiler): give the TSRX incomplete-snapshot projection test a WASI-safe timeout (#3903)
Co-authored-by: Cursor <[email protected]>
1 parent 7932287 commit 8d23a5a

1 file changed

Lines changed: 34 additions & 28 deletions

File tree

‎packages/compiler/__tests__/tsrx-typecheck-projection.test.js‎

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -202,37 +202,43 @@ export function Rows({ rows }: { rows: { name: string }[] }) @{
202202
}
203203
);
204204

205-
test("recovers common incomplete editor snapshots into valid virtual TSX", () => {
206-
for (const source of [
207-
"export function View() @{",
208-
"export function View() @{ const value = ",
209-
"export function View() @{ @ }",
210-
'const marker = "🚀"; export function View() @{\n <div>'
211-
]) {
212-
const output = projectTsrxForTypecheck(source, { filename: "incomplete.tsrx" });
205+
test(
206+
"recovers common incomplete editor snapshots into valid virtual TSX",
207+
{ timeout: 30000 },
208+
() => {
209+
for (const source of [
210+
"export function View() @{",
211+
"export function View() @{ const value = ",
212+
"export function View() @{ @ }",
213+
'const marker = "🚀"; export function View() @{\n <div>'
214+
]) {
215+
const output = projectTsrxForTypecheck(source, { filename: "incomplete.tsrx" });
213216

214-
expect(typecheck(output.code)).toEqual([]);
215-
expect(output.code).not.toContain("@{");
216-
for (const mapping of output.mappings) {
217-
expect(source.slice(mapping.sourceStart, mapping.sourceStart + mapping.sourceLength)).toBe(
218-
output.code.slice(
219-
mapping.generatedStart,
220-
mapping.generatedStart + mapping.generatedLength
221-
)
222-
);
223-
}
224-
if (source.endsWith("<div>")) {
225-
const generatedClosingName = output.code.indexOf("</div>") + 2;
226-
expect(
227-
output.mappings.some(
228-
mapping =>
229-
mapping.generatedStart <= generatedClosingName &&
230-
mapping.generatedStart + mapping.generatedLength >= generatedClosingName + 3
231-
)
232-
).toBe(false);
217+
expect(typecheck(output.code)).toEqual([]);
218+
expect(output.code).not.toContain("@{");
219+
for (const mapping of output.mappings) {
220+
expect(
221+
source.slice(mapping.sourceStart, mapping.sourceStart + mapping.sourceLength)
222+
).toBe(
223+
output.code.slice(
224+
mapping.generatedStart,
225+
mapping.generatedStart + mapping.generatedLength
226+
)
227+
);
228+
}
229+
if (source.endsWith("<div>")) {
230+
const generatedClosingName = output.code.indexOf("</div>") + 2;
231+
expect(
232+
output.mappings.some(
233+
mapping =>
234+
mapping.generatedStart <= generatedClosingName &&
235+
mapping.generatedStart + mapping.generatedLength >= generatedClosingName + 3
236+
)
237+
).toBe(false);
238+
}
233239
}
234240
}
235-
});
241+
);
236242

237243
test("rejects authored lazy destructuring", () => {
238244
expect(() =>

0 commit comments

Comments
 (0)