88} from '../../../src/parsers/sany' ;
99
1010const FIXTURES_DIR = path . join ( __dirname , '..' , '..' , '..' , '..' , 'tests' , 'fixtures' ) ;
11+ const TEST_TIMEOUT_MS = 5 * 60 * 1000 ;
1112
1213suite ( 'PlusCal Divergence Detection Integration Tests' , ( ) => {
1314 let tempDir : string ;
@@ -23,7 +24,7 @@ suite('PlusCal Divergence Detection Integration Tests', () => {
2324 } ) ;
2425
2526 test ( 'SANY detects no divergence on clean file with matching checksums' , async function ( ) {
26- this . timeout ( 15000 ) ;
27+ this . timeout ( TEST_TIMEOUT_MS ) ;
2728 const filePath = copyFixture ( 'DivergenceTest.tla' ) ;
2829 const output = await runSanyOnFile ( filePath ) ;
2930 assert . ok ( output . includes ( 'Semantic processing of module DivergenceTest' ) ,
@@ -34,7 +35,7 @@ suite('PlusCal Divergence Detection Integration Tests', () => {
3435 } ) ;
3536
3637 test ( 'SANY detects TLA+ translation divergence when translation is modified' , async function ( ) {
37- this . timeout ( 15000 ) ;
38+ this . timeout ( TEST_TIMEOUT_MS ) ;
3839 const filePath = copyFixture ( 'DivergenceTest.tla' ) ;
3940
4041 let content = fs . readFileSync ( filePath , 'utf-8' ) ;
@@ -47,7 +48,7 @@ suite('PlusCal Divergence Detection Integration Tests', () => {
4748 } ) ;
4849
4950 test ( 'SANY detects PlusCal divergence when algorithm is modified' , async function ( ) {
50- this . timeout ( 15000 ) ;
51+ this . timeout ( TEST_TIMEOUT_MS ) ;
5152 const filePath = copyFixture ( 'DivergenceTest.tla' ) ;
5253
5354 let content = fs . readFileSync ( filePath , 'utf-8' ) ;
@@ -60,7 +61,7 @@ suite('PlusCal Divergence Detection Integration Tests', () => {
6061 } ) ;
6162
6263 test ( 'SANY detects both divergences when algorithm and translation are modified' , async function ( ) {
63- this . timeout ( 15000 ) ;
64+ this . timeout ( TEST_TIMEOUT_MS ) ;
6465 const filePath = copyFixture ( 'DivergenceTest.tla' ) ;
6566
6667 let content = fs . readFileSync ( filePath , 'utf-8' ) ;
@@ -74,7 +75,7 @@ suite('PlusCal Divergence Detection Integration Tests', () => {
7475 } ) ;
7576
7677 test ( 'Pre-model-check: divergence detected on modified TLA+ translation' , async function ( ) {
77- this . timeout ( 15000 ) ;
78+ this . timeout ( TEST_TIMEOUT_MS ) ;
7879 const filePath = copyFixture ( 'DivergenceTest.tla' ) ;
7980
8081 let content = fs . readFileSync ( filePath , 'utf-8' ) ;
@@ -90,7 +91,7 @@ suite('PlusCal Divergence Detection Integration Tests', () => {
9091 } ) ;
9192
9293 test ( 'Pre-model-check: no divergence on clean file' , async function ( ) {
93- this . timeout ( 15000 ) ;
94+ this . timeout ( TEST_TIMEOUT_MS ) ;
9495 const filePath = copyFixture ( 'DivergenceTest.tla' ) ;
9596 const content = fs . readFileSync ( filePath , 'utf-8' ) ;
9697
@@ -103,7 +104,7 @@ suite('PlusCal Divergence Detection Integration Tests', () => {
103104 } ) ;
104105
105106 test ( 'Pre-model-check: skipped when no checksums' , async function ( ) {
106- this . timeout ( 15000 ) ;
107+ this . timeout ( TEST_TIMEOUT_MS ) ;
107108 const filePath = copyFixture ( 'DivergenceTest.tla' ) ;
108109
109110 // Remove checksums from the BEGIN TRANSLATION line
@@ -119,7 +120,7 @@ suite('PlusCal Divergence Detection Integration Tests', () => {
119120 } ) ;
120121
121122 test ( 'SANY detects divergence in an imported module' , async function ( ) {
122- this . timeout ( 15000 ) ;
123+ this . timeout ( TEST_TIMEOUT_MS ) ;
123124 // Copy the fixture as an imported module and break its TLA+ translation.
124125 const helperPath = path . join ( tempDir , 'DivHelper.tla' ) ;
125126 let helperContent = fs . readFileSync ( path . join ( FIXTURES_DIR , 'DivergenceTest.tla' ) , 'utf-8' ) ;
@@ -159,19 +160,12 @@ suite('PlusCal Divergence Detection Integration Tests', () => {
159160 capturedOutput += chunk . toString ( ) ;
160161 } ) ;
161162
162- await new Promise < void > ( ( resolve , reject ) => {
163+ await new Promise < void > ( ( resolve ) => {
163164 if ( procInfo . mergedOutput . readableEnded ) {
164165 resolve ( ) ;
165166 return ;
166167 }
167- const timer = setTimeout (
168- ( ) => reject ( new Error ( 'SANY did not finish in time' ) ) ,
169- 10000
170- ) ;
171- procInfo . mergedOutput . once ( 'end' , ( ) => {
172- clearTimeout ( timer ) ;
173- resolve ( ) ;
174- } ) ;
168+ procInfo . mergedOutput . once ( 'end' , resolve ) ;
175169 } ) ;
176170
177171 return capturedOutput ;
0 commit comments