|
19 | 19 |
|
20 | 20 | import { parseExpression, ParseResult } from '../../../../parser-evaluator/parser'; |
21 | 21 |
|
22 | | -jest.setTimeout(60000); |
| 22 | +/* If tests are timing out, increase the timeout value here: |
| 23 | + * jest.setTimeout(10000); |
| 24 | + */ |
23 | 25 |
|
24 | 26 | interface ExpressionRow { |
25 | 27 | expr: string; |
@@ -62,12 +64,21 @@ function parseAll(rows: ExpressionRow[]): { parsed: ParseResult[]; diagnostics: |
62 | 64 |
|
63 | 65 | describe('Parser over SCVD expression fixtures', () => { |
64 | 66 | it('parses every expression without throwing', () => { |
| 67 | + const timeoutHint = setTimeout(() => { |
| 68 | + // If this prints, the default Jest timeout is likely to be hit. |
| 69 | + // eslint-disable-next-line no-console |
| 70 | + console.warn('Parser SCVD expressions test is running long; consider increasing the test timeout or reducing fixture size.'); |
| 71 | + }, 4500); |
65 | 72 | const { _meta, expressions } = readExpressions('expressions.json'); |
66 | | - expect(expressions.length).toBe(_meta.totalUnique); |
| 73 | + try { |
| 74 | + expect(expressions.length).toBe(_meta.totalUnique); |
67 | 75 |
|
68 | | - const { diagnostics } = parseAll(expressions); |
| 76 | + const { diagnostics } = parseAll(expressions); |
69 | 77 |
|
70 | | - // The parser should be tolerant; fail hard if diagnostics explode unexpectedly. |
71 | | - expect(diagnostics).toBeGreaterThanOrEqual(0); |
| 78 | + // The parser should be tolerant; fail hard if diagnostics explode unexpectedly. |
| 79 | + expect(diagnostics).toBeGreaterThanOrEqual(0); |
| 80 | + } finally { |
| 81 | + clearTimeout(timeoutHint); |
| 82 | + } |
72 | 83 | }); |
73 | 84 | }); |
0 commit comments